#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_tag.h>
#include <sofia-sip/msg_header.h>
#include <sofia-sip/http_protos.h>
#include <sofia-sip/http.h>
Include dependency graph for http_header.h:
Go to the source code of this file.
Defines | |
#define | HTTP_HEADER_INIT(h, http_class, size) |
Initialize a HTTP header structure. | |
Functions | |
SOFIAPUBFUN msg_mclass_t * | http_default_mclass (void) |
HTTP parser description. | |
SOFIAPUBFUN int | http_request_complete (msg_t *msg) |
Complete a HTTP request. | |
SOFIAPUBFUN int | http_message_complete (msg_t *msg, http_t *http) |
Complete a HTTP message. | |
SOFIAPUBFUN int | http_add_dup (msg_t *, http_t *, http_header_t const *) |
Add a duplicate of header object to a HTTP message. | |
SOFIAPUBFUN int | http_add_make (msg_t *msg, http_t *http, msg_hclass_t *hc, char const *s) |
Add a header to the HTTP message. | |
SOFIAPUBFUN int | http_add_format (msg_t *msg, http_t *http, msg_hclass_t *hc, char const *fmt,...) |
Add a header to the HTTP message. | |
SOFIAPUBFUN 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. | |
SOFIAPUBFUN int | http_strip_hostport (url_t *url) |
Remove schema, host, and port from URL. | |
SOFIAPUBFUN int | http_complete_response (msg_t *msg, int status, char const *phrase, http_t const *request) |
Add required headers to the response message. | |
SOFIAPUBFUN char const * | http_method_name (http_method_t method, char const *name) |
Return string corresponding to the method. | |
SOFIAPUBFUN http_method_t | http_method_code (char const *name) |
Return enum corresponding to the method name. | |
SOFIAPUBFUN 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. | |
SOFIAPUBFUN http_status_t * | http_status_create (su_home_t *home, unsigned status, char const *phrase, char const *version) |
Create a status line object. | |
SOFIAPUBFUN http_host_t * | http_host_create (su_home_t *home, char const *host, char const *port) |
Create an Host header object. | |
SOFIAPUBFUN http_date_t * | http_date_create (su_home_t *home, http_time_t t) |
Create an Date header object. | |
SOFIAPUBFUN http_expires_t * | http_expires_create (su_home_t *home, http_time_t delta) |
Create an Expires header object. | |
SOFIAPUBFUN int | http_url_cmp (url_t const *a, url_t const *b) |
Compare two HTTP URLs. | |
SOFIAPUBFUN int | 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 | |
SOFIAPUBVAR char const | http_version_0_9 [] |
HTTP 0.9. | |
SOFIAPUBVAR char const | http_version_1_0 [] |
HTTP 1.0. | |
SOFIAPUBVAR char const | http_version_1_1 [] |
HTTP 1.1 version. |
SOFIAPUBFUN 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.
Return the number of headers added to the HTTP message.
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 |
SOFIAPUBFUN int http_query_parse | ( | char * | query, | |
... | ||||
) |
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.
SOFIAPUBFUN 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 <http_header.h>.
SOFIAPUBFUN 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.