HTTP library prototypes. More...
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_tag.h>
#include <sofia-sip/http.h>
#include <sofia-sip/msg_header.h>
#include <sofia-sip/http_protos.h>
Go to the source code of this file.
Defines | |
#define | HTTP_HEADER_H |
Defined when <sofia-sip/http_header.h> has been included. | |
#define | HTTP_HEADER_INIT(h, http_class, size) |
Initialize a HTTP header structure. | |
Functions | |
msg_mclass_t const * | http_default_mclass (void) |
HTTP parser description. | |
int | http_request_complete (msg_t *msg) |
Complete a HTTP request. | |
int | http_message_complete (msg_t *msg, http_t *http) |
Complete a HTTP message. | |
int | http_add_dup (msg_t *, http_t *, http_header_t const *) |
Add a duplicate of header object to a HTTP message. | |
int | http_add_make (msg_t *msg, http_t *http, msg_hclass_t *hc, char const *s) |
Add a header to the HTTP message. | |
int | http_add_format (msg_t *msg, http_t *http, msg_hclass_t *hc, char const *fmt,...) |
Add a header to the HTTP message. | |
int | http_add_tl (msg_t *msg, http_t *http, tag_type_t tag, tag_value_t value,...) |
Add tagged headers to the HTTP message. | |
int | http_strip_hostport (url_t *url) |
Remove schema, host, and port from URL. | |
int | http_complete_response (msg_t *msg, int status, char const *phrase, http_t const *request) |
Add required headers to the response message. | |
char const * | http_method_name (http_method_t method, char const *name) |
Return string corresponding to the method. | |
http_method_t | http_method_code (char const *name) |
Return enum corresponding to the method name. | |
http_request_t * | http_request_create (su_home_t *home, http_method_t method, const char *name, url_string_t const *url, char const *version) |
Create a request line object. | |
http_status_t * | http_status_create (su_home_t *home, unsigned status, char const *phrase, char const *version) |
Create a status line object. | |
http_host_t * | http_host_create (su_home_t *home, char const *host, char const *port) |
Create an Host header object. | |
http_date_t * | http_date_create (su_home_t *home, http_time_t t) |
Create an Date header object. | |
http_expires_t * | http_expires_create (su_home_t *home, http_time_t delta) |
Create an Expires header object. | |
int | http_url_cmp (url_t const *a, url_t const *b) |
Compare two HTTP URLs. | |
issize_t | http_query_parse (char *query,...) |
Parse query part in HTTP URL. | |
http_t * | http_object (msg_t *msg) |
Get HTTP structure from msg. | |
int | http_header_insert (msg_t *msg, http_t *http, http_header_t *h) |
Insert a (list of) header(s) to the header structure and fragment chain. | |
int | http_header_remove (msg_t *msg, http_t *http, http_header_t *h) |
Remove a header from a HTTP message. | |
char const * | http_header_name (http_header_t const *h, int compact) |
Return name of the header. | |
void * | http_header_data (http_header_t *h) |
Return data after header structure. | |
Variables | |
char const | http_version_0_9 [] |
HTTP 0.9. | |
char const | http_version_1_0 [] |
HTTP 1.0. | |
char const | http_version_1_1 [] |
HTTP 1.1 version. |
HTTP library prototypes.
#define HTTP_HEADER_H |
Defined when <sofia-sip/http_header.h> has been included.
#define HTTP_HEADER_INIT | ( | h, | ||
http_class, | ||||
size | ||||
) |
Initialize a HTTP header structure.
int http_add_dup | ( | msg_t * | msg, | |
http_t * | http, | |||
http_header_t const * | o | |||
) |
Add a duplicate of header object to a HTTP message.
int http_add_format | ( | msg_t * | msg, | |
http_t * | http, | |||
msg_hclass_t * | hc, | |||
char const * | fmt, | |||
... | ||||
) |
Add a header to the HTTP message.
int http_add_make | ( | msg_t * | msg, | |
http_t * | http, | |||
msg_hclass_t * | hc, | |||
char const * | s | |||
) |
Add a header to the HTTP message.
int http_add_tl | ( | msg_t * | msg, | |
http_t * | http, | |||
tag_type_t | tag, | |||
tag_value_t | value, | |||
... | ||||
) |
Add tagged headers to the HTTP message.
Add tagged headers to the HTTP message.
Return the number of headers added to the HTTP message.
msg_mclass_t const* http_default_mclass | ( | void | ) |
HTTP parser description.
http_expires_t* http_expires_create | ( | su_home_t * | home, | |
http_time_t | delta | |||
) |
Create an Expires header object.
void* http_header_data | ( | http_header_t * | h | ) | [inline] |
Return data after header structure.
int http_header_insert | ( | msg_t * | msg, | |
http_t * | http, | |||
http_header_t * | h | |||
) | [inline] |
Insert a (list of) header(s) to the header structure and fragment chain.
The function http_header_insert()
inserts header or list of headers into a HTTP message. It also inserts them into the the message fragment chain, if it exists.
When inserting headers into the fragment chain, a request (or status) is inserted first and replaces the existing request (or status). The Via headers are inserted after the request or status, and rest of the headers after request, status, or Via headers.
If the header is a singleton, existing headers with the same class are removed.
msg | message owning the fragment chain | |
http | HTTP message structure to which header is added | |
h | list of header(s) to be added |
char const* http_header_name | ( | http_header_t const * | h, | |
int | compact | |||
) | [inline] |
Return name of the header.
int http_header_remove | ( | msg_t * | msg, | |
http_t * | http, | |||
http_header_t * | h | |||
) | [inline] |
Remove a header from a HTTP message.
http_host_t* http_host_create | ( | su_home_t * | home, | |
char const * | host, | |||
char const * | port | |||
) |
Create an Host header object.
char const* http_method_name | ( | http_method_t | method, | |
char const * | name | |||
) |
Return string corresponding to the method.
issize_t http_query_parse | ( | char * | query, | |
... | ||||
) |
Parse query part in HTTP URL.
Parse query part in HTTP URL.
The function http_query_parse() searches for the given keys in HTTP query. For each key, a query element (in the form name=value) is searched from the query string. If a query element has a beginning matching with the key, a copy of the rest of the element is returned in corresponding return_value argument.
int http_request_complete | ( | msg_t * | msg | ) |
Complete a HTTP request.
http_request_t* http_request_create | ( | su_home_t * | home, | |
http_method_t | method, | |||
char const * | name, | |||
url_string_t const * | url, | |||
char const * | version | |||
) |
Create a request line object.
Note that version string is not copied; it MUST remain constant during lifetime of the http_request_t
object. You can use constants http_version_1_1 or http_version_1_0 declared in <sofia-sip/http_header.h>.
http_status_t* http_status_create | ( | su_home_t * | home, | |
unsigned | status, | |||
char const * | phrase, | |||
char const * | version | |||
) |
Create a status line object.
Note that version is not copied; it MUST remain constant during lifetime of the http_status_t
object.
char const http_version_1_1[] |
HTTP 1.1 version.