Getting Curl "Unsupported protocol" error - networking

So i am trying to build a project with gcc and it emits the following compile failure
/home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp:247:26: error: ‘CURLOPT_HTTPPOST’ is deprecated: since 7.56.0. Use CURLOPT_MIMEPOST [-Werror=deprecated-declarations]
247 | ret = setopt(CURLOPT_HTTPPOST, m_post);
| ^~~~~~~~~~~~~~~~
In file included from /home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/include/AVSCommon/Utils/LibcurlUtils/CurlEasyHandleWrapper.h:20,
from /home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp:20:
/usr/include/curl/curl.h:1195:3: note: declared here
1195 | CURLOPTDEPRECATED(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24,
| ^~~~~~~~~~~~~~~~~
/home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp: In member function ‘void alexaClientSDK::avsCommon::utils::libcurlUtils::CurlEasyHandleWrapper::cleanupResources()’:
/home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp:302:22: error: ‘void curl_formfree(curl_httppost*)’ is deprecated: since 7.56.0. Use curl_mime_free() [-Werror=deprecated-declarations]
302 | curl_formfree(m_post);
| ~~~~~~~~~~~~~^~~~~~~~
/usr/include/curl/curl.h:2606:1: note: declared here
2606 | curl_formfree(struct curl_httppost *form);
| ^~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [AVSCommon/CMakeFiles/AVSCommon.dir/build.make:734: AVSCommon/CMakeFiles/AVSCommon.dir/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:11124: AVSCommon/CMakeFiles/AVSCommon.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:18943: SampleApplications/ConsoleSampleApplication/src/CMakeFiles/SampleApp.dir/rule] Error 2
make: *** [Makefile:5093: SampleApp] Error 2
basically the project is using deprecated API's . While trying to upgrade it to use the new API i am encountering a weird behaviour where the execution of that line fails and the curl error message that i am receiving is Unsupported protocol
auto result = curl_easy_setopt(handle, option, value);
Please note that value of option and value are CURLOPT_HTTP_VERSION and CURL_HTTP_VERSION_2_0
but if i add the following curl code above the above mentioned code snippet as shown below than everything starts to work magically
FILE *filep = fopen("~/dump.txt", "wb");
if(handle) {
curl_easy_setopt(handle, CURLOPT_STDERR, filep);
}
auto result = curl_easy_setopt(handle, option, value);
it seems like curl_easy_setopt(handle, CURLOPT_STDERR, filep);
must happen before curl_easy_setopt(handle, option, value)otherwise i get the unsupported protocol error. Can someone more experienced than me knows why that is happening or what i might be missing here.
Please note that initially i thought that the program is succeeding maybe due to some timing issue therefore i also tried putting some delay above auto result = curl_easy_setopt(handle, option, value); but still saw the same error message.

Related

I tried installing Qt4.8.1 on CentOS8 by building from source code but I get the following error:

../3rdparty/libpng/pngerror.c:324:48: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
for (; i<(sizeof msg)-1 && parm != '\0' && parm < pend; ++i)
^~~~
In file included from ../3rdparty/libpng/privatepng.cpp:8:
../3rdparty/libpng/pngrtran.c: In function ‘void PrivatePng::png_set_crc_action(PrivatePng::png_structp, int, int)’:
../3rdparty/libpng/pngrtran.c:52:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
png_warning(png_ptr,
~~~~~~~~~~~^~~~~~~~~
"Can't discard critical data on CRC error");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../3rdparty/libpng/pngrtran.c:54:7: note: here
case PNG_CRC_ERROR_QUIT: /* Error/quit */
^~~~
In file included from ../3rdparty/libpng/privatepng.cpp:13:
../3rdparty/libpng/pngwrite.c: In function ‘void PrivatePng::png_set_filter(PrivatePng::png_structp, int, int)’:
../3rdparty/libpng/pngwrite.c:1033:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../3rdparty/libpng/pngwrite.c:1035:10: note: here
case PNG_FILTER_VALUE_NONE:
^~~~
make[1]: *** [Makefile:75547: .obj/release-shared/privatepng.o] Error 1
make[1]: Leaving directory '/home/ows/Downloads/qt-everywhere-opensource-src-4.8.1/src/gui'
make: *** [Makefile:386: sub-gui-make_default-ordered] Error 2
Is qt4.8 supported on CentOS8?

file_get_html() not working for the only webpage

I want to call a simple DOM file
I tested with another links and it works, but with this url it's not working.
My code is:
$bnadatos = file_get_html("http://www.rofex.com.ar/cem/FyO.aspx");
foreach($bnadatos->find('[#id="ctl00_ContentPlaceHolder1_gvFyO"]') as $i){
echo "datos:";
echo $i->innertext;
}
Response is a blank page.
What's wrong?
i solved with
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$response = file_get_html("https://www.rofex.com.ar/cem/FyO.aspx", false, stream_context_create($arrContextOptions));
foreach($response->find('[#id="ctl00_gvwDDF"]/tbody/tr[2]/td[2]') as $i){
echo $i->innertext;
}
thank you #maio290 for light my road
This is just a guess, but do you have your error reporting on?
Out of the box, this is not working with the simple-html-dom library:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/www/html/dom.php on line 83
Warning: file_get_contents(): Failed to enable crypto in /var/www/html/dom.php on line 83
Warning: file_get_contents(http://www.rofex.com.ar/cem/FyO.aspx): failed to open stream: operation failed in /var/www/html/dom.php on line 83
Fatal error: Call to a member function find() on boolean in /var/www/html/test.php on line 11
A fix for this can be found here - with that in place, I still get a blank page, which is due to a wrong answer (301 Moved Permanently) - for this to fix, you need to modify
'follow_location' => false
to
'follow_location' => true
so, now we get the proper site content - you can modify the selector to $html->find('#ctl00_ContentPlaceHolder1_gvFyO'); this will find all element which id=ctl00_ContentPlaceHolder1_gvFyO - see the documentation as reference.

Error when building nginx docker

I am trying to build a docker from a fork and I am getting the following error when performing docker build ./:
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
On install we run
apt-get -y install libpcre3-dev zlib1g-dev libssl-dev openssl build-essential wget
I can't find this error on google. The full error for reference as I can't find out the exact error reference I need to research:
src/event/ngx_event_openssl.c: In function 'ngx_ssl_init':
src/event/ngx_event_openssl.c:112:5: error: 'OPENSSL_config' is deprecated [-Werror=deprecated-declarations]
OPENSSL_config(NULL);
^~~~~~~~~~~~~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/conf.h:92:1: note: declared here
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_rsa512_key_callback':
src/event/ngx_event_openssl.c:753:9: error: 'RSA_generate_key' is deprecated [-Werror=deprecated-declarations]
key = RSA_generate_key(512, RSA_F4, NULL, NULL);
^~~
In file included from /usr/include/openssl/rsa.h:13:0,
from /usr/include/openssl/x509.h:31,
from /usr/include/openssl/ssl.h:50,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rsa.h:193:1: note: declared here
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_dhparam':
src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_handshake':
src/event/ngx_event_openssl.c:1164:31: error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
if (c->ssl->connection->s3) {
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_connection_error':
src/event/ngx_event_openssl.c:1913:21: error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c:1913:21: note: each undeclared identifier is reported only once for each function it appears in
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_cache':
src/event/ngx_event_openssl.c:2107:43: error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type [-Werror=incompatible-pointer-types]
SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:15:0,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/ssl.h:637:6: note: expected 'SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int, int *)}' but argument is of type 'SSL_SESSION * (*)(SSL *, u_char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int, int *)}'
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_id_context':
src/event/ngx_event_openssl.c:2129:27: error: storage size of 'md' isn't known
EVP_MD_CTX md;
^~
src/event/ngx_event_openssl.c:2195:5: error: implicit declaration of function 'EVP_MD_CTX_cleanup' [-Werror=implicit-function-declaration]
EVP_MD_CTX_cleanup(&md);
^~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_ticket_key_callback':
src/event/ngx_event_openssl.c:2864:9: error: 'RAND_pseudo_bytes' is deprecated [-Werror=deprecated-declarations]
RAND_pseudo_bytes(iv, 16);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/engine.h:19:0,
from src/event/ngx_event_openssl.h:22,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
This is the docker fork I am running https://github.com/meteorhacks/mup-frontend-server
You are getting various errors and warnings here, but they aren't really about Docker or OpenSSL. If we strip away the extraneous information, here are the problems you are encountering.
error: 'OPENSSL_config' is deprecated
error: 'RSA_generate_key' is deprecated
error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type
error: storage size of 'md' isn't known
error: implicit declaration of function 'EVP_MD_CTX_cleanup'
error: 'RAND_pseudo_bytes' is deprecated
The core of the problem here is probably that you are using a legacy version of Nginx in this project. From the GitHub repository you pointed to, in install-nginx.sh:
NGINX_VERSION=1.8.0
The current mainline version of Nginx is 1.13.2. I haven't combed through the changelogs for Nginx, but based on the errors you are receiving, it seems likely that between the 1.8 releases and the current ones, OpenSSL has deprecated various functions that Nginx 1.8 relied on. Most likely this can be solved by moving to a recent release of Nginx.
As of this writing, 1.13.2 is the current mainline, and 1.12.0 is the current stable. One of those may work better. Whether you can simply drop this in, I can't say. You may have to change something in the build scripts or the nginx config for a more recent version to work properly.
you are getting this error because your nginx version don't support SSL 1.1.0. Either upgrade NGINX version or use SSL 1.0.2.

Compiling Qt 5.3.0 for static linking under windows

I am trying to compile Qt for static linking following this tutorial: http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW
But i receive tons of warnings and a few errors.
For example this one:
C:/Developement/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lqjp2
collect2.exe: error: ld returned 1 exit status
Makefile.Release:79: recipe for target '..\..\bin\dumpdoc.exe' failed
mingw32-make[4]: *** [..\..\bin\dumpdoc.exe] Error 1
mingw32-make[4]: Target 'first' not remade because of errors.
mingw32-make[4]: Leaving directory 'C:/Developement/Qt/Static/src/qt-everywhere-opensource-src-5.3.0/qtactiveqt/tools/dumpdoc'
Makefile:34: recipe for target 'release' failed
mingw32-make[3]: *** [release] Error 2
mingw32-make[3]: Target 'first' not remade because of errors.
for this, i set the environement variable to my path:
Name: LIBRARY_PATH
Value: C:\Developement\Qt\5.3\mingw482_32\bin
... but dunno yet if its gonna workin'
Beside this, i put the following paths to the PATH environement variable:
C:\Developement\Qt\5.3\mingw482_32\bin;
C:\Developement\Qt\Tools\mingw482_32\bin;
I am receiving tons of these kind of warning:
In file included from
C:\Developement\Qt\Static\src\qt-everywhere-opensource-src-5.3.0\qtbase\src\3rdparty\libjpeg/jpeglib.h:25:0,
from ......\3rdparty\jasper\src\libjasper\jpg\jpg_jpeglib.h:74,
from ......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:75:
C:\Developement\Qt\Static\src\qt-everywhere-opensource-src-5.3.0\qtbase\src\3rdparty\libjpeg/jconfig.h:55:0:
warning: "HAVE_STDDEF_H" redefined [enabled by default] #define
HAVE_STDDEF_H ^ In file included from
......\3rdparty\jasper\src\libjasper\include/jasper/jas_tvp.h:75:0,
from ......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:70:
......\3rdparty\jasper\src\libjasper\include/jasper/jas_config.h:65:0:
note: this is the location of the previous definition #define
HAVE_STDDEF_H 1 ^ In file included from
C:\Developement\Qt\Static\src\qt-everywhere-opensource-src-5.3.0\qtbase\src\3rdparty\libjpeg/jpeglib.h:25:0,
from ......\3rdparty\jasper\src\libjasper\jpg\jpg_jpeglib.h:74,
from ......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:75:
C:\Developement\Qt\Static\src\qt-everywhere-opensource-src-5.3.0\qtbase\src\3rdparty\libjpeg/jconfig.h:59:0:
warning: "HAVE_STDLIB_H" redefined [enabled by default] #define
HAVE_STDLIB_H ^
In file included from ......\3rdparty\jasper\src\libjasper\include/jasper/jas_tvp.h:75:0,
from ......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:70:
......\3rdparty\jasper\src\libjasper\include/jasper/jas_config.h:71:0:
note: this is the location of the previous definition
#define HAVE_STDLIB_H 1
^
......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c: In function 'jpg_decode':
......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:134:49: warning: parameter 'optstr' set but not used
[-Wunused-but-set-parameter]
jas_image_t *jpg_decode(jas_stream_t *in, char *optstr)
^
......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c: In function 'jpg_start_output':
......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:298:47: warning: parameter 'cinfo' set but not used
[-Wunused-but-set-parameter]
static void jpg_start_output(j_decompress_ptr cinfo, jpg_dest_t *dinfo)
^
......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c: In function 'jpg_finish_output':
......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:335:48: warning: parameter 'cinfo' set but not used
[-Wunused-but-set-parameter]
static void jpg_finish_output(j_decompress_ptr cinfo, jpg_dest_t *dinfo)
^ ......\3rdparty\jasper\src\libjasper\jpg\jpg_dec.c:335:67: warning:
parameter 'dinfo' set but not used [-Wunused-but-set-parameter]
static void jpg_finish_output(j_decompress_ptr cinfo, jpg_dest_t *dinfo)
^
Wasn't i prepared enough to compile Qt?
What do i need to do in order to be able to compile Qt without getting errors everytime thrown out?
How long would it take until its compiled.

"File can not be opened" compiler error in MPLABX /MPLAB IDE

I'm a newbie trying to lean PIC, I downloaded MPLAB and MPLAB X IDE. I have done this around 100 times and looked over web enough before asking this question, but my code does not compile and it always fails.
Here is what I did:
Created a new project using the project wizard,
Edited the code,
Copied the 16F871.H library header in both folder (I created the project in) and added it to the header files in MPLAB IDE.
Here's my code:
// IFIN.C Tests an input
#include " 16F877A.h "
void main()
{
int x; // Declare variable
output_D(0); // Clear all outputs
while(1) //
{
x = input(PIN_C0); // Get input state
if(x = = 1)
output_high(PIN_D0); // Change output
}
}
But on compiling the code, I'm getting the following error:
Executing:
"C:\Program Files\PICC\Ccsc.exe" +FM "NEW.c" #__DEBUG=1 +ICD +DF +LN
+T +A +M +Z +Y=9 +EA #__16F877A=TRUE
*** Error 18 "NEW.c" Line 2(10,23): File can not be opened
Not in project "C:\Users\jatin\Desktop\DHAKKAN PIC\ 16F877A.h "
Not in "C:\Program Files\PICC\devices\ 16F877A.h "
Not in "C:\Program Files\PICC\drivers\ 16F877A.h "
*** Error 128 "NEW.c" Line 2(10,17): A #DEVICE required before this line
*** Error 12 "NEW.c" Line 6(9,10): Undefined identifier -- output_D
*** Error 12 "NEW.c" Line 9(10,11): Undefined identifier -- input
*** Error 51 "NEW.c" Line 10(8,9): A numeric expression must appear here
5 Errors, 0 Warnings. Build Failed. Halting build on first failure as requested.
BUILD FAILED: Mon Jul 08 15:09:17 2013
I would be grateful if you could help me.
The error with respect to the header file not being found is that you have extra space in the header name. In other words, this:
#include " 16F877A.h "
should be:
#include "16F877A.h"
The other errors are probably a result of this and would go away once the header is properly included.
Note that the compiler literally takes the string inside "" or <> as file name for the header file and doesn't trim whitespaces for you.

Resources