Data Structures | Functions
http_request.h File Reference

HTTP request. More...

Data Structures

struct  vtm_http_req
 

Functions

VTM_API const char * vtm_http_req_get_host (struct vtm_http_req *req)
 
VTM_API const char * vtm_http_req_get_header_str (struct vtm_http_req *req, const char *name)
 
VTM_API const char * vtm_http_req_get_query_str (struct vtm_http_req *req, const char *name)
 
VTM_API int vtm_http_req_get_remote_info (struct vtm_http_req *req, char *buf, size_t len, unsigned int *port)
 

Function Documentation

VTM_API const char* vtm_http_req_get_host ( struct vtm_http_req req)

Convenience method for retrieving the host header.

Parameters
reqthe request
Returns
the host header value
NULL if host header was not present
VTM_API const char* vtm_http_req_get_header_str ( struct vtm_http_req req,
const char *  name 
)

Convenience method for retrieving a header value as string.

Parameters
reqthe request
namethe name of the header
Returns
the header value
NULL if the header field was not present
VTM_API const char* vtm_http_req_get_query_str ( struct vtm_http_req req,
const char *  name 
)

Convenience method for retrieving a URL parameter value as string.

Parameters
reqthe request
namethe name of the parameter
Returns
the parameter value
NULL if the parameter was not set
VTM_API int vtm_http_req_get_remote_info ( struct vtm_http_req req,
char *  buf,
size_t  len,
unsigned int *  port 
)

Retrieves the source ip address and used port of a request.

Parameters
reqthe request whose source address should be retrieved
[out]bufthe buffer where the ip address string representation is stored
lenthe length of the buffer in bytes
[out]portthe used port number
Returns
VTM_OK if the address was successfully retrieved
VTM_ERROR if an error occured