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 dependency graph for http_basic.c:
Functions | |
int | http_request_d (su_home_t *home, http_header_t *h, char *s, int slen) |
Parse request line of a HTTP message. | |
int | http_request_e (char b[], int 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, int 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. | |
int | http_status_d (su_home_t *home, http_header_t *h, char *s, int slen) |
Parse status line. | |
int | http_status_dup_xtra (http_header_t const *h, int 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, int 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. | |
int | http_host_d (su_home_t *home, http_header_t *h, char *s, int slen) |
Parse Host header. | |
int | http_host_e (char b[], int 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. | |
int | http_if_range_d (su_home_t *home, http_header_t *h, char *s, int slen) |
Parse If-Range header. | |
int | http_if_range_e (char b[], int bsiz, http_header_t const *h, int flags) |
Print If-Range header. | |
int | http_location_d (su_home_t *home, msg_header_t *h, char *s, int slen) |
Decode (parse) a Location header. | |
int | http_location_e (char b[], int bsiz, msg_header_t const *h, int flags) |
Encode (print) a Location header. | |
int | http_location_dup_xtra (msg_header_t const *h, int 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, int xtra) |
Duplicate a Location header field. | |
int | http_range_d (su_home_t *home, msg_header_t *h, char *s, int slen) |
Decode (parse) a Range header. | |
int | http_range_e (char b[], int bsiz, msg_header_t const *h, int flags) |
Encode (print) a Range header. | |
int | http_range_dup_xtra (msg_header_t const *h, int 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, int xtra) |
Duplicate a Range header field. | |
char * | http_te_dup_one (msg_header_t *dst, msg_header_t const *src, char *b, int xtra) |
Duplicate one http_te_t object. |
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>.
int http_request_d | ( | su_home_t * | home, | |
http_header_t * | h, | |||
char * | s, | |||
int | slen | |||
) |
Parse request line of a HTTP message.
The function http_request_d()
parses the request line from a a HTTP message.
int http_request_e | ( | char | b[], | |
int | 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.