|
glitchedhttps
|
Simple, lightweight and straight-forward way of doing HTTP(S) requests in C with the help of ARM's open-source MbedTLS library. More...
#include "glitchedhttps_api.h"#include "glitchedhttps_request.h"#include "glitchedhttps_response.h"#include "glitchedhttps_exitcodes.h"
Go to the source code of this file.
Macros | |
| #define | GLITCHEDHTTPS_VERSION 100 |
| #define | GLITCHEDHTTPS_VERSION_STR "1.0.0" |
| #define | GLITCHEDHTTPS_STACK_BUFFERSIZE 8192 |
Functions | |
| GLITCHEDHTTPS_API int | glitchedhttps_init () |
| GLITCHEDHTTPS_API void | glitchedhttps_free () |
| GLITCHEDHTTPS_API int | glitchedhttps_submit (const struct glitchedhttps_request *request, struct glitchedhttps_response **out) |
Simple, lightweight and straight-forward way of doing HTTP(S) requests in C with the help of ARM's open-source MbedTLS library.
| #define GLITCHEDHTTPS_STACK_BUFFERSIZE 8192 |
The maximum size in bytes that a temporary buffer may allocate on the stack before requiring a malloc
| #define GLITCHEDHTTPS_VERSION 100 |
Current version of the used GlitchedHTTPS library.
| #define GLITCHEDHTTPS_VERSION_STR "1.0.0" |
Current version of the used GlitchedHTTPS library (nicely-formatted string).
| GLITCHEDHTTPS_API void glitchedhttps_free | ( | ) |
Releases the library's resources.
GlitchedHTTPS will NOT check this for you: make sure to only call this when you're truly done making calls to glitchedhttps_submit() !
| GLITCHEDHTTPS_API int glitchedhttps_init | ( | ) |
Initializes the library's resources, allocating everything needed for making HTTPS requests that requires some warmup (e.g. parsing the x509 CA root certificates into a mbedtls_x509_crt context only needs to be done once).
Don't forget to glitchedhttps_free() again once you're done using glitchedhttps!
0 on success; mbedtls error code on failure. | GLITCHEDHTTPS_API int glitchedhttps_submit | ( | const struct glitchedhttps_request * | request, |
| struct glitchedhttps_response ** | out | ||
| ) |
Submits a given HTTP request and writes the server response into the provided output glitchedhttps_response instance.
This allocates memory, so don't forget to glitchedhttps_response_free() the output glitchedhttps_response instance after usage!!
| request | The glitchedhttps_request instance containing the request parameters and data (e.g. url, body, etc...). |
| out | The output glitchedhttps_response into which to write the response's data and headers. Must be a pointer to a glitchedhttps_response pointer: will be malloc'ed! Make sure it's fresh!! |
GLITCHEDHTTPS_SUCCESS (zero) if the request was submitted successfully; GLITCHEDHTTPS_{ERROR_ID} if the request couldn't even be submitted (e.g. invalid URL/server not found/no internet/whatever..). Check out the glitchedhttps_exitcodes.h header file to find out more about the glitchedhttps error codes!