rsstats 0.0.1
Redis Enterprise Statistic collector
libhttp.h File Reference

HTTP parsing and building library. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum HTTPVersion_e HTTPVersion_t
 
typedef enum HTTPMethod_e HTTPMethod_t
 
typedef enum HTTPStatus_e HTTPStatus_t
 
typedef struct HTTPHeader_s HTTPHeader_t
 
typedef struct HTTP_s HTTP_t
 

Enumerations

enum  HTTPVersion_e {
  HTTPVERSION_HTTP09 , HTTPVERSION_HTTP10 , HTTPVERSION_HTTP11 , HTTPVERSION_HTTP11b ,
  HTTPVERSION_HTTP2 , HTTPVERSION_HTTP3 , HTTPVERSION_INVALID
}
 
enum  HTTPMethod_e {
  HTTPMETHOD_GET , HTTPMETHOD_HEAD , HTTPMETHOD_POST , HTTPMETHOD_PUT ,
  HTTPMETHOD_DELETE , HTTPMETHOD_CONNECT , HTTPMETHOD_OPTIONS , HTTPMETHOD_TRACE ,
  HTTPMETHOD_PATCH , HTTPMETHOD_INVALID
}
 
enum  HTTPStatus_e { OK_200 , MISSING_404 }
 

Functions

HTTP_tHTTP_new ()
 
void HTTP_del (HTTP_t *http)
 
HTTP_tHTTP_setbody (HTTP_t *http, const char *body)
 
char * HTTP_getbody (HTTP_t *http)
 
HTTPHeader_tHTTP_addheader (HTTP_t *http, const char *name, const char *value)
 
HTTPHeader_tHTTP_addbasicauth (HTTP_t *http, const char *login, const char *pass)
 
HTTPHeader_tHTTPHeader_setname (HTTPHeader_t *header, const char *name)
 
char * HTTPHeader_getname (HTTPHeader_t *header)
 
HTTPHeader_tHTTPHeader_setvalue (HTTPHeader_t *header, const char *value)
 
char * HTTPHeader_getvalue (HTTPHeader_t *header)
 
HTTPHeader_tHTTP_firstheader (const HTTP_t *http)
 
HTTPHeader_tHTTP_nextheader (const HTTPHeader_t *header)
 
HTTPHeader_tHTTP_findheader (const HTTPHeader_t *start, const char *name)
 
HTTP_tHTTP_remheader (HTTP_t *http, HTTPHeader_t *header)
 
char * HTTP_buildheaders (const HTTP_t *http)
 
char * HTTP_buildrequest (const HTTPMethod_t method, const char *uri, const HTTPVersion_t version)
 
void HTTP_parserequest (const char *request, HTTP_t **http, HTTPMethod_t method, char *uri, HTTPVersion_t version)
 
char * HTTP_buildreply (const HTTP_t *http, const HTTPVersion_t, const HTTPStatus_t)
 
void HTTP_parsereply (const char *reply, HTTP_t **http, HTTPVersion_t *, HTTPStatus_t *)
 

Detailed Description

HTTP parsing and building library.

<+DETAILED+>

Author
François Cerbelle (Fanfan), franc.nosp@m.ois@.nosp@m.cerbe.nosp@m.lle..nosp@m.net

Definition in file libhttp.h.

Typedef Documentation

◆ HTTP_t

typedef struct HTTP_s HTTP_t

Definition at line 54 of file libhttp.h.

◆ HTTPHeader_t

typedef struct HTTPHeader_s HTTPHeader_t

Definition at line 52 of file libhttp.h.

◆ HTTPMethod_t

typedef enum HTTPMethod_e HTTPMethod_t

◆ HTTPStatus_t

typedef enum HTTPStatus_e HTTPStatus_t

◆ HTTPVersion_t

Enumeration Type Documentation

◆ HTTPMethod_e

Enumerator
HTTPMETHOD_GET 
HTTPMETHOD_HEAD 
HTTPMETHOD_POST 
HTTPMETHOD_PUT 
HTTPMETHOD_DELETE 
HTTPMETHOD_CONNECT 
HTTPMETHOD_OPTIONS 
HTTPMETHOD_TRACE 
HTTPMETHOD_PATCH 
HTTPMETHOD_INVALID 

Definition at line 34 of file libhttp.h.

◆ HTTPStatus_e

Enumerator
OK_200 
MISSING_404 

Definition at line 47 of file libhttp.h.

◆ HTTPVersion_e

Enumerator
HTTPVERSION_HTTP09 
HTTPVERSION_HTTP10 
HTTPVERSION_HTTP11 
HTTPVERSION_HTTP11b 
HTTPVERSION_HTTP2 
HTTPVERSION_HTTP3 
HTTPVERSION_INVALID 

Definition at line 24 of file libhttp.h.

Function Documentation

◆ HTTP_addbasicauth()

HTTPHeader_t * HTTP_addbasicauth ( HTTP_t http,
const char *  login,
const char *  pass 
)

Definition at line 175 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_addheader()

HTTPHeader_t * HTTP_addheader ( HTTP_t http,
const char *  name,
const char *  value 
)

Definition at line 153 of file libhttp.c.

Here is the caller graph for this function:

◆ HTTP_buildheaders()

char * HTTP_buildheaders ( const HTTP_t http)
Todo:
: OOM tests

Definition at line 363 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_buildreply()

char * HTTP_buildreply ( const HTTP_t http,
const  HTTPVersion_t,
const  HTTPStatus_t 
)

◆ HTTP_buildrequest()

char * HTTP_buildrequest ( const HTTPMethod_t  method,
const char *  uri,
const HTTPVersion_t  version 
)

Definition at line 401 of file libhttp.c.

◆ HTTP_del()

void HTTP_del ( HTTP_t http)

Definition at line 323 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_findheader()

HTTPHeader_t * HTTP_findheader ( const HTTPHeader_t start,
const char *  name 
)

Definition at line 244 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_firstheader()

HTTPHeader_t * HTTP_firstheader ( const HTTP_t http)

Definition at line 215 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_getbody()

char * HTTP_getbody ( HTTP_t http)

Definition at line 145 of file libhttp.c.

◆ HTTP_new()

HTTP_t * HTTP_new ( )

Definition at line 299 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_nextheader()

HTTPHeader_t * HTTP_nextheader ( const HTTPHeader_t header)

Definition at line 227 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_parsereply()

void HTTP_parsereply ( const char *  reply,
HTTP_t **  http,
HTTPVersion_t ,
HTTPStatus_t  
)

◆ HTTP_parserequest()

void HTTP_parserequest ( const char *  request,
HTTP_t **  http,
HTTPMethod_t  method,
char *  uri,
HTTPVersion_t  version 
)

◆ HTTP_remheader()

HTTP_t * HTTP_remheader ( HTTP_t http,
HTTPHeader_t header 
)
Todo:
: make sclist_remrecord return a status (found/notfound) and use it

Definition at line 275 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_setbody()

HTTP_t * HTTP_setbody ( HTTP_t http,
const char *  body 
)

Definition at line 127 of file libhttp.c.

◆ HTTPHeader_getname()

char * HTTPHeader_getname ( HTTPHeader_t header)

Definition at line 50 of file libhttp.c.

Here is the caller graph for this function:

◆ HTTPHeader_getvalue()

char * HTTPHeader_getvalue ( HTTPHeader_t header)

Definition at line 74 of file libhttp.c.

◆ HTTPHeader_setname()

HTTPHeader_t * HTTPHeader_setname ( HTTPHeader_t header,
const char *  name 
)

Definition at line 34 of file libhttp.c.

◆ HTTPHeader_setvalue()

HTTPHeader_t * HTTPHeader_setvalue ( HTTPHeader_t header,
const char *  value 
)

Definition at line 58 of file libhttp.c.