c-icap-doc
0.1
|
Macros, functions and structures used for manipulating the encupsulated HTTP objects (HTTP requests or HTTP responses). More...
Functions | |
ci_headers_list_t * | ci_http_response_headers (ci_request_t *req) |
Returns the HTTP response headers. More... | |
ci_headers_list_t * | ci_http_request_headers (ci_request_t *req) |
Returns the HTTP request headers. More... | |
const char * | ci_http_response_add_header (ci_request_t *req, const char *header) |
Add a custom header to the HTTP response headers. More... | |
const char * | ci_http_request_add_header (ci_request_t *req, const char *header) |
Add a custom header to the HTTP request headers. More... | |
int | ci_http_response_remove_header (ci_request_t *req, const char *header) |
Remove a header from the HTTP response headers. More... | |
int | ci_http_request_remove_header (ci_request_t *req, const char *header) |
Remove a header from the HTTP request headers. More... | |
const char * | ci_http_response_get_header (ci_request_t *req, const char *head_name) |
Get the value of the requested header from the HTTP response headers. More... | |
const char * | ci_http_request_get_header (ci_request_t *req, const char *head_name) |
Get the value of the requested header from the HTTP request headers. More... | |
int | ci_http_response_reset_headers (ci_request_t *req) |
Completelly erase and initialize the HTTP response headers. More... | |
int | ci_http_request_reset_headers (ci_request_t *req) |
Completelly erase and initialize the HTTP request headers. More... | |
int | ci_http_response_create (ci_request_t *req, int has_reshdr, int has_body) |
Creates a new HTTP response. More... | |
int | ci_http_request_create (ci_request_t *req, int has_body) |
Creates a new HTTP request. More... | |
ci_off_t | ci_http_content_length (ci_request_t *req) |
Returns the value of the Content-Length header of the HTTP response or HTTP request for a response modification or request modification ICAP requests respectively. More... | |
const char * | ci_http_request (ci_request_t *req) |
Returns the request line (e.g "GET /index.html HTTP 1.0") from http request headers. More... | |
int | ci_http_request_url (ci_request_t *req, char *buf, int buf_size) |
Returns the URL (e.g "http://www.chtsanti.net") from http request. More... | |
const ci_ip_t * | ci_http_client_ip (ci_request_t *req) |
Return the http client ip address if this information is available. More... | |
Macros, functions and structures used for manipulating the encupsulated HTTP objects (HTTP requests or HTTP responses).
const ci_ip_t* ci_http_client_ip | ( | ci_request_t * | req | ) |
Return the http client ip address if this information is available.
req | is a pointer to the current ICAP request object. |
ci_off_t ci_http_content_length | ( | ci_request_t * | req | ) |
Returns the value of the Content-Length header of the HTTP response or HTTP request for a response modification or request modification ICAP requests respectively.
If the header Content-Length is not included in HTTP response It can be used with both request and response modification ICAP requests.
req | is a pointer to the current ICAP request object. |
const char* ci_http_request | ( | ci_request_t * | req | ) |
Returns the request line (e.g "GET /index.html HTTP 1.0") from http request headers.
It can be used with both request and response modification ICAP requests.
req | is a pointer to the current ICAP request object. |
const char* ci_http_request_add_header | ( | ci_request_t * | req, |
const char * | header | ||
) |
Add a custom header to the HTTP request headers.
This function can used to add custom headers to the HTTP request and can be used only for request modification ICAP requests
req | is a pointer to the current ICAP request object. |
header | is a string contains the header in the form "Header: value" |
int ci_http_request_create | ( | ci_request_t * | req, |
int | has_body | ||
) |
Creates a new HTTP request.
This function is usefull to develop icap clients
req | is a pointer to the current ICAP request object. |
has_body | if it is non zero the HTTP request contains HTTP body data |
const char* ci_http_request_get_header | ( | ci_request_t * | req, |
const char * | head_name | ||
) |
Get the value of the requested header from the HTTP request headers.
This function can used to get the value of a header from the HTTP request headers. It can be used on both request and response modification ICAP requests.
req | is a pointer to the current ICAP request object. |
head_name | is a string contains the header name |
ci_headers_list_t* ci_http_request_headers | ( | ci_request_t * | req | ) |
Returns the HTTP request headers.
This function can used for an responce or request modification ICAP request to get the HTTP request headers
req | is a pointer to the current ICAP request object. |
int ci_http_request_remove_header | ( | ci_request_t * | req, |
const char * | header | ||
) |
Remove a header from the HTTP request headers.
This function can used to remove a header from the HTTP request and can be used only for request modification ICAP requests
req | is a pointer to the current ICAP request object. |
header | is a string contains the header name |
int ci_http_request_reset_headers | ( | ci_request_t * | req | ) |
Completelly erase and initialize the HTTP request headers.
This function is usefull when an HTTP request required should replaced by an other.After this function called, the HTTP request should filled with new HTTP headers, before send back to the ICAP client. An example use is to implement an HTTP redirector. It can be used with request modification ICAP requests.
req | is a pointer to the current ICAP request object. |
int ci_http_request_url | ( | ci_request_t * | req, |
char * | buf, | ||
int | buf_size | ||
) |
Returns the URL (e.g "http://www.chtsanti.net") from http request.
It can be used with both request and response modification ICAP requests.
req | is a pointer to the current ICAP request object. |
buf | a buffer to store the url |
buf_size | the "buf" buffer size |
const char* ci_http_response_add_header | ( | ci_request_t * | req, |
const char * | header | ||
) |
Add a custom header to the HTTP response headers.
This function can used to add custom headers to the HTTP response and can be used only for response modification ICAP requests
req | is a pointer to the current ICAP request object. |
header | is a string contains the header in the form "Header: value" |
int ci_http_response_create | ( | ci_request_t * | req, |
int | has_reshdr, | ||
int | has_body | ||
) |
Creates a new HTTP response.
This function is usefull when the service wants to respond with a self created message to a response or request modification ICAP request. It can be used with both request and response modification ICAP requests.
req | is a pointer to the current ICAP request object. |
has_reshdr | if it is non zero the HTTP response contrains HTTP headers (a non HTTP 0.9 response) |
has_body | if it is non zero the HTTP response contains HTTP body data |
const char* ci_http_response_get_header | ( | ci_request_t * | req, |
const char * | head_name | ||
) |
Get the value of the requested header from the HTTP response headers.
This function can used to get the value of a header from the HTTP response headers. It can be used only for response modification ICAP requests
req | is a pointer to the current ICAP request object. |
head_name | is a string contains the header name |
ci_headers_list_t* ci_http_response_headers | ( | ci_request_t * | req | ) |
Returns the HTTP response headers.
This function is only valid for an ICAP responce modification request. If the ICAP request is not responce modification ICAP request or there are not response headers (HTTP 0.9) the function returns NULL.
req | A pointer to the current ICAP request object. |
int ci_http_response_remove_header | ( | ci_request_t * | req, |
const char * | header | ||
) |
Remove a header from the HTTP response headers.
This function can used to remove a header from the HTTP response and can be used only for response modification ICAP requests
req | is a pointer to the current ICAP request object. |
header | is a string contains the header name |
int ci_http_response_reset_headers | ( | ci_request_t * | req | ) |
Completelly erase and initialize the HTTP response headers.
This function is usefull when the full rewrite of the HTTP response is required. After this function called, the HTTP response should be filled with new HTTP headers, before send back to the ICAP client. An example of usage of this function is in antivirus service when a virus detected in HTTP response, so the service blocks the response and sends a new HTTP object (a new html page, with HTTP headers) informing the user about the virus. It can be used with response modification ICAP requests.
req | is a pointer to the current ICAP request object. |