glitchedhttps
Classes | Functions
glitchedhttps_header.h File Reference

HTTP request (or response) header (for example: type="Authorization" ; value="Basic YWxhZGRpbjpvcGVuc2VzYW1l"). More...

#include "glitchedhttps_api.h"
#include <stddef.h>
Include dependency graph for glitchedhttps_header.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  glitchedhttps_header
 HTTP request (or response) header (for example: type="Authorization" ; value="Basic YWxhZGRpbjpvcGVuc2VzYW1l"). More...
 

Functions

GLITCHEDHTTPS_API struct glitchedhttps_headerglitchedhttps_header_init (const char *type, size_t type_length, const char *value, size_t value_length)
 
GLITCHEDHTTPS_API void glitchedhttps_header_free (struct glitchedhttps_header *header)
 

Detailed Description

HTTP request (or response) header (for example: type="Authorization" ; value="Basic YWxhZGRpbjpvcGVuc2VzYW1l").

Function Documentation

◆ glitchedhttps_header_free()

GLITCHEDHTTPS_API void glitchedhttps_header_free ( struct glitchedhttps_header header)

Frees a glitchedhttps_header instance as well as its two heap-allocated strings inside.

Parameters
headerThe glitchedhttps_header to deallocate.

◆ glitchedhttps_header_init()

GLITCHEDHTTPS_API struct glitchedhttps_header * glitchedhttps_header_init ( const char *  type,
size_t  type_length,
const char *  value,
size_t  value_length 
)

Creates and initializes a glitchedhttps_header instance and returns its pointer.

Note
Allocation is done for you: once you're done using this MAKE SURE to call glitchedhttps_header_free() on it to prevent memory leaks!
Parameters
typeThe header type name (e.g. "Authorization", "Accept", etc...). Must be a NUL-terminated string!
type_lengthThe length of the header type string.
valueThe header value (NUL-terminated string).
value_lengthThe length of the header value string.
Returns
The freshly allocated and initialized glitchedhttps_header instance (a pointer to it). If init failed, NULL is returned!