rsstats 0.0.1
Redis Enterprise Statistic collector
libhttp.c File Reference

HTTP parsing and building library. More...

#include "libhttp.h"
#include "sclist.h"
#include "base64.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
Include dependency graph for libhttp.c:

Go to the source code of this file.

Classes

struct  HTTP_s
 
struct  HTTPHeader_s
 

Typedefs

typedef struct HTTP_s HTTP_t
 
typedef struct HTTPHeader_s HTTPHeader_t
 

Functions

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)
 
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_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)
 

Detailed Description

HTTP parsing and building library.

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

Definition in file libhttp.c.

Typedef Documentation

◆ HTTP_t

typedef struct HTTP_s HTTP_t

◆ HTTPHeader_t

typedef struct HTTPHeader_s HTTPHeader_t

Function Documentation

◆ HTTP_addbasicauth()

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

Definition at line 235 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 208 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 377 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_buildrequest()

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

Definition at line 416 of file libhttp.c.

◆ HTTP_del()

void HTTP_del ( HTTP_t http)

Definition at line 157 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 304 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 275 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_getbody()

char * HTTP_getbody ( HTTP_t http)

Definition at line 200 of file libhttp.c.

◆ HTTP_new()

HTTP_t * HTTP_new ( )

Definition at line 133 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 287 of file libhttp.c.

Here is the call graph for this function:

◆ HTTP_remheader()

HTTP_t * HTTP_remheader ( HTTP_t http,
HTTPHeader_t header 
)
Todo:
: make sclist_remrecord return a status (found/notfound) and use it
Bug:
Header deleted if not found in this HTTP, but it obviously belongs to another HTTP, will be freed, but not removed from his header list SIGSEGV11 to expect at some point

Definition at line 335 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 182 of file libhttp.c.

◆ HTTPHeader_getname()

char * HTTPHeader_getname ( HTTPHeader_t header)

Definition at line 65 of file libhttp.c.

Here is the caller graph for this function:

◆ HTTPHeader_getvalue()

char * HTTPHeader_getvalue ( HTTPHeader_t header)

Definition at line 90 of file libhttp.c.

◆ HTTPHeader_setname()

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

Definition at line 43 of file libhttp.c.

◆ HTTPHeader_setvalue()

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

Definition at line 73 of file libhttp.c.