Skip to content

OUIsolutions/BearHttpsClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WARNING: THIS IS ALPHA SOFTWARE. USE AT YOUR OWN RISK. NO WARRANTY IS PROVIDED AND BUGS ARE EXPECTED.

BearHttpsClient

BearHttpsClient is a simple and easy to use single-file HTTPS Client Library for C/C++ for Windows and Linux that uses BearSSL as its SSL/TLS backend. BearHttpsClient is projected to be a full out-of-the-box solution providing:

  • HTTP Requisitions
  • HTTPS Requisitions
  • Single-file include or multiple-files header option
  • File Upload
  • File Download
  • JSON Body Parsing
  • Streaming Body Reading

Releases

item What Is
BearSSLSingleUnit.zip Full Folder Mode
BearSSLSingleUnitOne.c Single File Version
BearHttpsClient.h Declaration
BearHttpsClient.c Definition

Simple Example

The simplest example of using BearHttpsClient -- with the single file include BearSSLSingleUnitOne.c -- is this example that fetches a page from example.com and prints it to the console.

#include "BearHttpsClientOne.c"

BearHttpsNamespace bear ;
int main(){
    bear = newBearHttpsNamespace();

    BearHttpsRequest *request = bear.request.newBearHttpsRequest("https://example.com");
    BearHttpsResponse *response = bear.request.fetch(request);
    if(bear.response.error(response)){
        printf("Error: %s\n",bear.response.get_error_msg(response));
        bear.request.free(request);
        bear.response.free(response);
        return 1;
    }
    const char *body = bear.response.read_body_str(response);
    if(bear.response.error(response)){
        printf("Error: %s\n",bear.response.get_error_msg(response));
        bear.request.free(request);
        bear.response.free(response);
        return 1;
    }
    printf("Body: %s\n",body);
    bear.request.free(request);
    bear.response.free(response);
    return 0;
}

Documentation

Item What It Is
Build Build and Install
Request Usage Request Usage such as setting headers or uploading content
Response Usage Response Headers and Body Read
Network Lib network Configuration
Memory Memory Usage and Limits
Ownership Ownership Mode
Dependencies Dependencies

Build Toolchain