HTTP/HTTPS REST Client C Library

Overview

https_client

HTTP/HTTPS REST Client C Library

This library is a tiny https client library. it use only small memory(default read buffer size(H_READ_SIZE) is 2048). This library can be easily applied in your embedded system because written only in C language.

It use the mbedTLS ssl/tls library(https://tls.mbed.org/). You must include the mbedTLS library.

Supporting specifications are as follows.

  • Support the HTTPS 1.1 Keep-Alive connection.
  • Support the chunked-encoding.
  • Support the HTTP GET and POST method.

Enjoy.

Issues
  • Can't make~

    Can't make~

    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

    opened by smarttang 4
  • NET - The connection to the given server / port failed

    NET - The connection to the given server / port failed

    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?

    opened by weijing2 0
  • problem compile for esp-open rtos

    problem compile for esp-open rtos

    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"

    opened by oremic 2
  • Can't make: implicit declaration of function ‘http_write_chunked’

    Can't make: implicit declaration of function ‘http_write_chunked’

    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

    opened by drozdzamadeusz 0
Owner
HISONA
HISONA
C++ client for making HTTP/REST requests

REST client for C++ About This is a simple REST client for C++. It wraps libcurl for HTTP requests. Usage restclient-cpp provides two ways of interact

Daniel Schauenberg 1.4k Jun 21, 2022
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

xcyl 25 Jun 21, 2022
C++ library for creating an embedded Rest HTTP server (and more)

The libhttpserver reference manual Tl;dr libhttpserver is a C++ library for building high performance RESTful web servers. libhttpserver is built upon

Sebastiano Merlino 660 Jun 20, 2022
A C++ header-only HTTP/HTTPS server and client library

cpp-httplib A C++11 single-file header-only cross platform HTTP/HTTPS library. It's extremely easy to setup. Just include the httplib.h file in your c

null 7.2k Jun 24, 2022
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

Ivan Shynkarenka 848 Jun 26, 2022
Tiny cross-platform HTTP / HTTPS client library in C.

naett /nɛt:/ Tiny HTTP client library in C. Wraps native HTTP client functionality on macOS, Windows, Linux, iOS and Android in a single, simple non-b

Erik Agsjö 13 Jun 21, 2022
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Ole Christian Eidheim 2.3k Jun 22, 2022
H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server

H2O - an optimized HTTP server with support for HTTP/1.x, HTTP/2 and HTTP/3 (experimental) Copyright (c) 2014-2019 DeNA Co., Ltd., Kazuho Oku, Tatsuhi

H2O 10k Jun 25, 2022
Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Felix Queißner 536 Jun 24, 2022
Modern C++ REST Client library

Introduction to the restc-cpp C++ library The magic that takes the pain out of accessing JSON API's from C++ What it does: It formulates a HTTP reques

Jarle Aase 473 Jun 20, 2022
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 6.9k Jun 22, 2022
BingBing 53 Jun 10, 2022
tiny HTTP parser written in C (used in HTTP::Parser::XS et al.)

PicoHTTPParser Copyright (c) 2009-2014 Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase, Shigeo Mitsunari PicoHTTPParser is a tiny, primitive, fast HTTP r

H2O 1.5k Jun 22, 2022
A collection of C++ HTTP libraries including an easy to use HTTP server.

Proxygen: Facebook's C++ HTTP Libraries This project comprises the core C++ HTTP abstractions used at Facebook. Internally, it is used as the basis fo

Facebook 7.5k Jun 25, 2022
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.1k Jun 22, 2022
Gromox - Groupware server backend with MAPI/HTTP, RPC/HTTP, IMAP, POP3 and PHP-MAPI support for grommunio

Gromox is the central groupware server component of grommunio. It is capable of serving as a replacement for Microsoft Exchange and compatibles. Conne

grommunio 119 Jun 27, 2022
websocket and http client and server library, coming with ws, a command line swiss army knife utility

Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use an

Machine Zone, Inc. 320 Jun 22, 2022
A cross-platform HTTP client library with a focus on usability and speed

EasyHttp A cross-platform HTTP client library with a focus on usability and speed. Under its hood, EasyHttp uses POCO C++ Libraries and derives many o

Sony 141 Jun 17, 2022
Neon - neon - an HTTP/1.1 and WebDAV client library with a C API

neon neon is an HTTP and WebDAV client library, with a C language API. Mailing list: [email protected] || Web site: https://notroj.github.io/n

Joe Orton 67 Jun 22, 2022