The file http_basic.c contains implementation of header classes for basic HTTP headers, like request and status lines, payload, Call-ID, CSeq, Contact, Content-Length, Date, Expires, From, Route, Record-Route, To, and Via.
#include "config.h"
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/http_parser.h>
#include <sofia-sip/http_header.h>
#include <sofia-sip/http_status.h>
#include <sofia-sip/msg_mime_protos.h>
#include <sofia-sip/msg_date.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <limits.h>
Include dependency graph for http_basic.c:
Functions | |
issize_t | http_request_d (su_home_t *home, http_header_t *h, char *s, isize_t slen) |
Parse request line of a HTTP message. | |
issize_t | http_request_e (char b[], isize_t bsiz, http_header_t const *h, int flags) |
Encode a HTTP request line. | |
char * | http_request_dup_one (http_header_t *dst, http_header_t const *src, char *b, isize_t xtra) |
Duplicate one request header. | |
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. | |
issize_t | http_status_d (su_home_t *home, http_header_t *h, char *s, isize_t slen) |
Parse status line. | |
isize_t | http_status_dup_xtra (http_header_t const *h, isize_t offset) |
Extra size of a http_status_t object. | |
char * | http_status_dup_one (http_header_t *dst, http_header_t const *src, char *b, isize_t xtra) |
Duplicate one status header. | |
http_status_t * | http_status_create (su_home_t *home, unsigned status, char const *phrase, char const *version) |
Create a status line object. | |
http_date_t * | http_date_create (su_home_t *home, http_time_t date) |
Create an Date header object. | |
issize_t | http_host_d (su_home_t *home, http_header_t *h, char *s, isize_t slen) |
Parse Host header. | |
issize_t | http_host_e (char b[], isize_t bsiz, http_header_t const *h, int flags) |
Print Host header. | |
http_host_t * | http_host_create (su_home_t *home, char const *host, char const *port) |
Create an Host header object. | |
issize_t | http_if_range_d (su_home_t *home, http_header_t *h, char *s, isize_t slen) |
Parse If-Range header. | |
issize_t | http_if_range_e (char b[], isize_t bsiz, http_header_t const *h, int flags) |
Print If-Range header. | |
issize_t | http_location_d (su_home_t *home, msg_header_t *h, char *s, isize_t slen) |
Decode (parse) a Location header. | |
issize_t | http_location_e (char b[], isize_t bsiz, msg_header_t const *h, int flags) |
Encode (print) a Location header. | |
isize_t | http_location_dup_xtra (msg_header_t const *h, isize_t offset) |
Calculate extra storage used by Location header field. | |
char * | http_location_dup_one (msg_header_t *dst, msg_header_t const *src, char *b, isize_t xtra) |
Duplicate a Location header field. | |
issize_t | http_range_d (su_home_t *home, msg_header_t *h, char *s, isize_t slen) |
Decode (parse) a Range header. | |
issize_t | http_range_e (char b[], isize_t bsiz, msg_header_t const *h, int flags) |
Encode (print) a Range header. | |
isize_t | http_range_dup_xtra (msg_header_t const *h, isize_t offset) |
Calculate extra storage used by Range header field. | |
char * | http_range_dup_one (msg_header_t *dst, msg_header_t const *src, char *b, isize_t xtra) |
Duplicate a Range header field. | |
char * | http_te_dup_one (msg_header_t *dst, msg_header_t const *src, char *b, isize_t xtra) |
Duplicate one http_te_t object. | |
Variables | |
msg_hclass_t | http_request_class [] |
Header class for HTTP request line. | |
msg_hclass_t | http_status_class [] |
Header class for HTTP status line. | |
msg_hclass_t | http_accept_ranges_class [] |
Header class for HTTP Accept-Ranges header. | |
msg_hclass_t | http_age_class [] |
Header class for HTTP Age header. | |
msg_hclass_t | http_allow_class [] |
Header class for HTTP Allow header. | |
msg_hclass_t | http_authentication_info_class [] |
Header class for HTTP Authentication-Info header. | |
msg_hclass_t | http_authorization_class [] |
Header class for HTTP Authorization header. | |
msg_hclass_t | http_cache_control_class [] |
Header class for HTTP Cache-Control header. | |
msg_hclass_t | http_connection_class [] |
Header class for HTTP Connection header. | |
msg_hclass_t | http_content_range_class [] |
Header class for HTTP Content-Range header. | |
msg_hclass_t | http_date_class [] |
Header class for HTTP Date header. | |
msg_hclass_t | http_etag_class [] |
Header class for HTTP ETag header. | |
msg_hclass_t | http_expect_class [] |
Header class for HTTP Expect header. | |
msg_hclass_t | http_expires_class [] |
Header class for HTTP Expires header. | |
msg_hclass_t | http_from_class [] |
Header class for HTTP From header. | |
msg_hclass_t | http_host_class [] |
Header class for HTTP Host header. | |
msg_hclass_t | http_if_match_class [] |
Header class for HTTP If-Match header. | |
msg_hclass_t | http_if_modified_since_class [] |
Header class for HTTP If-Modified-Since header. | |
msg_hclass_t | http_if_none_match_class [] |
Header class for HTTP If-None-Match header. | |
msg_hclass_t | http_if_range_class [] |
Header class for HTTP If-Range header. | |
msg_hclass_t | http_if_unmodified_since_class [] |
Header class for HTTP If-Unmodified-Since header. | |
msg_hclass_t | http_last_modified_class [] |
Header class for HTTP Last-Modified header. | |
msg_hclass_t | http_location_class [] |
Header class for HTTP Location header. | |
msg_hclass_t | http_max_forwards_class [] |
Header class for HTTP Max-Forwards header. | |
msg_hclass_t | http_pragma_class [] |
Header class for HTTP Pragma header. | |
msg_hclass_t | http_proxy_authenticate_class [] |
Header class for HTTP Proxy-Authenticate header. | |
msg_hclass_t | http_proxy_authorization_class [] |
Header class for HTTP Proxy-Authorization header. | |
msg_hclass_t | http_range_class [] |
Header class for HTTP Range header. | |
msg_hclass_t | http_referer_class [] |
Header class for HTTP Referer header. | |
msg_hclass_t | http_retry_after_class [] |
Header class for HTTP Retry-After header. | |
msg_hclass_t | http_server_class [] |
Header class for HTTP Server header. | |
msg_hclass_t | http_te_class [] |
Header class for HTTP TE header. | |
msg_hclass_t | http_trailer_class [] |
Header class for HTTP Trailer header. | |
msg_hclass_t | http_transfer_encoding_class [] |
Header class for HTTP Transfer-Encoding header. | |
msg_hclass_t | http_upgrade_class [] |
Header class for HTTP Upgrade header. | |
msg_hclass_t | http_user_agent_class [] |
Header class for HTTP User-Agent header. | |
msg_hclass_t | http_vary_class [] |
Header class for HTTP Vary header. | |
msg_hclass_t | http_via_class [] |
Header class for HTTP Via header. | |
msg_hclass_t | http_warning_class [] |
Header class for HTTP Warning header. | |
msg_hclass_t | http_www_authenticate_class [] |
Header class for HTTP WWW-Authenticate header. |
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>.
issize_t http_request_d | ( | su_home_t * | home, | |
http_header_t * | h, | |||
char * | s, | |||
isize_t | slen | |||
) |
Parse request line of a HTTP message.
The function http_request_d()
parses the request line from a a HTTP message.
issize_t http_request_e | ( | char | b[], | |
isize_t | bsiz, | |||
http_header_t const * | h, | |||
int | flags | |||
) |
Encode a HTTP request line.
The function http_request_e()
prints a HTTP request line.
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.