hisona / https_client Goto Github PK
View Code? Open in Web Editor NEWHTTP/HTTPS REST Client C Library
License: Apache License 2.0
HTTP/HTTPS REST Client C Library
License: Apache License 2.0
Sometimes,https post method return An error:"NET - The connection to the given server / port failed", the server and port is ok, What could be the reason?
to be deleted!
Hi
ok library perfect. su osx system
Compile for Esp-open-rtos problem
error: #error "This module only works on Unix and Windows, see MBEDTLS_TIMING_C in config.h"
#error "This module only works on Unix and Windows, see MBEDTLS_TIMING_C in config.h"
Compiling: main.c ....
gcc -c -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" -O2 -I../mbedtls-2.2.1/include -o main.o main.c
Compiling: https.c ....
gcc -c -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" -O2 -I../mbedtls-2.2.1/include -o https.o https.c
https.c:14:25: 错误:mbedtls/net.h:没有那个文件或目录
https.c:15:29: 错误:mbedtls/entropy.h:没有那个文件或目录
https.c:16:30: 错误:mbedtls/ctr_drbg.h:没有那个文件或目录
https.c:17:27: 错误:mbedtls/error.h:没有那个文件或目录
https.c:18:27: 错误:mbedtls/certs.h:没有那个文件或目录
https.c:47: 错误:expected specifier-qualifier-list before ‘mbedtls_net_context’
https.c: 在函数‘https_init’中:
https.c:461: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:462: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:463: 错误:‘HTTP_INFO’没有名为‘cacert’的成员
https.c:464: 错误:‘HTTP_INFO’没有名为‘ctr_drbg’的成员
https.c:467: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c: 在函数‘https_close’中:
https.c:481: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:484: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:488: 错误:‘HTTP_INFO’没有名为‘cacert’的成员
https.c:489: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:490: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:491: 错误:‘HTTP_INFO’没有名为‘ctr_drbg’的成员
https.c:492: 错误:‘HTTP_INFO’没有名为‘entropy’的成员
https.c: 在文件层:
https.c:504: 错误:expected ‘)’ before ‘*’ token
https.c: 在函数‘https_connect’中:
https.c:620: 错误:‘HTTP_INFO’没有名为‘entropy’的成员
https.c:622: 错误:‘HTTP_INFO’没有名为‘ctr_drbg’的成员
https.c:622: 错误:‘mbedtls_entropy_func’未声明(在此函数内第一次使用)
https.c:622: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
https.c:622: 错误:所在的函数内也只报告一次。)
https.c:622: 错误:‘HTTP_INFO’没有名为‘entropy’的成员
https.c:628: 错误:‘HTTP_INFO’没有名为‘cacert’的成员
https.c:628: 错误:‘mbedtls_test_cas_pem’未声明(在此函数内第一次使用)
https.c:629: 错误:‘mbedtls_test_cas_pem_len’未声明(在此函数内第一次使用)
https.c:635: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:636: 错误:‘MBEDTLS_SSL_IS_CLIENT’未声明(在此函数内第一次使用)
https.c:637: 错误:‘MBEDTLS_SSL_TRANSPORT_STREAM’未声明(在此函数内第一次使用)
https.c:638: 错误:‘MBEDTLS_SSL_PRESET_DEFAULT’未声明(在此函数内第一次使用)
https.c:646: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:646: 错误:‘MBEDTLS_SSL_VERIFY_OPTIONAL’未声明(在此函数内第一次使用)
https.c:647: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:647: 错误:‘HTTP_INFO’没有名为‘cacert’的成员
https.c:648: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:648: 错误:‘mbedtls_ctr_drbg_random’未声明(在此函数内第一次使用)
https.c:648: 错误:‘HTTP_INFO’没有名为‘ctr_drbg’的成员
https.c:649: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:651: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:651: 错误:‘HTTP_INFO’没有名为‘conf’的成员
https.c:657: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:664: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:664: 错误:‘MBEDTLS_NET_PROTO_TCP’未声明(在此函数内第一次使用)
https.c:672: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:672: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:672: 错误:‘mbedtls_net_send’未声明(在此函数内第一次使用)
https.c:672: 错误:‘mbedtls_net_recv’未声明(在此函数内第一次使用)
https.c:672: 错误:‘mbedtls_net_recv_timeout’未声明(在此函数内第一次使用)
https.c:674: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:676: 错误:‘MBEDTLS_ERR_SSL_WANT_READ’未声明(在此函数内第一次使用)
https.c:676: 错误:‘MBEDTLS_ERR_SSL_WANT_WRITE’未声明(在此函数内第一次使用)
https.c: 在函数‘https_write’中:
https.c:694: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:696: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:698: 错误:‘MBEDTLS_ERR_SSL_WANT_WRITE’未声明(在此函数内第一次使用)
https.c: 在函数‘https_read’中:
https.c:714: 错误:‘HTTP_INFO’没有名为‘ssl’的成员
https.c:718: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c: 在函数‘http_get’中:
https.c:759: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:777: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:834: 错误:‘MBEDTLS_ERR_SSL_WANT_READ’未声明(在此函数内第一次使用)
https.c: 在函数‘http_post’中:
https.c:898: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:901: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:918: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:982: 错误:‘MBEDTLS_ERR_SSL_WANT_READ’未声明(在此函数内第一次使用)
https.c: 在函数‘http_open_chunked’中:
https.c:1052: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:1055: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c:1071: 错误:‘HTTP_INFO’没有名为‘ssl_fd’的成员
https.c: 在函数‘http_read_chunked’中:
https.c:1195: 错误:‘MBEDTLS_ERR_SSL_WANT_READ’未声明(在此函数内第一次使用)
make: *** [https.o] 错误 1
I compile main using:
gcc -o main -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" -O2 -I/usr/include/libnl3/netlink/ -Imbedtls/include main.c ApiService.c libmemd.a mbedtls/library/libmbedx509.a mbedtls/library/libmbedtls.a mbedtls/library/libmbedcrypto.a -lm -lncurses
ApiService.c:17:8: warning: implicit declaration of function ‘http_open_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_open_chunked(&hi2, url) == 0)
^~~~~~~~~~~~~~~~~
http_read_chunked
ApiService.c:21:12: warning: implicit declaration of function ‘http_write_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_write_chunked(&hi2, data, size) != size)
^~~~~~~~~~~~~~~~~~
http_read_chunked
ApiService.c: In function ‘getTask’:
ApiService.c:106:5: warning: format not a string literal and no format arguments [-Wformat-security]
sprintf(data, cJSON_Print(task));
^~~~~~~
https.c: In function ‘mbedtls_net_connect_timeout’:
https.c:496:18: error: ‘errno’ undeclared (first use in this function); did you mean ‘h_errno’?
else if( errno == EINPROGRESS )
^~~~~
h_errno
https.c:496:18: note: each undeclared identifier is reported only once for each function it appears in
https.c:496:27: error: ‘EINPROGRESS’ undeclared (first use in this function)
else if( errno == EINPROGRESS )
^~~~~~~~~~~
https.c:515:33: error: ‘EINTR’ undeclared (first use in this function); did you mean ‘NLE_INTR’?
if(errno == EINTR) continue;
^~~~~
NLE_INTR
Makefile:16: recipe for target 'compile' failed
when I trying to compile test file demo main file (Test a https post with the chunked-encoding data) with: gcc -o main -Imbedtls/include -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" main.c -O2 mbedtls/library/libmbedx509.a mbedtls/library/libmbedtls.a mbedtls/library/libmbedcrypto.a
I got:
main.c: In function ‘main’:
main.c:133:8: warning: implicit declaration of function ‘http_open_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_open_chunked(&hi2, url) == 0)
^~~~~~~~~~~~~~~~~
http_read_chunked
main.c:137:12: warning: implicit declaration of function ‘http_write_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_write_chunked(&hi2, data, size) != size)
^~~~~~~~~~~~~~~~~~
http_read_chunked
/tmp/cc7m6wMn.o: In function main': main.c:(.text.startup+0x3b): undefined reference to http_init'
main.c:(.text.startup+0x48): undefined reference to http_init' main.c:(.text.startup+0x59): undefined reference to http_open_chunked'
main.c:(.text.startup+0x9e): undefined reference to http_write_chunked' main.c:(.text.startup+0xd3): undefined reference to http_write_chunked'
main.c:(.text.startup+0x120): undefined reference to http_write_chunked' main.c:(.text.startup+0x139): undefined reference to http_strerror'
main.c:(.text.startup+0x157): undefined reference to http_close' main.c:(.text.startup+0x15f): undefined reference to http_close'
main.c:(.text.startup+0x19c): undefined reference to `http_read_chunked'
collect2: error: ld returned 1 exit status
I haven't got compile, but I saw another issue similar and got it!
I'm sorry for the mistake
hi->body_size = size
this size is 4096... not all???
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.