#include "config.h"
#include <sofia-sip/su_alloc.h>
#include "sofia-sip/http_parser.h"
#include <sofia-sip/msg_parser.h>
#include <sofia-sip/http_header.h>
#include <sofia-sip/http_status.h>
#include <sofia-sip/msg_mclass.h>
#include <sofia-sip/su_tagarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
Include dependency graph for http_parser.c:
Defines | |
#define | CRLF_TEST(s) |
Calculate length of line ending (0, 1 or 2). | |
Functions | |
msg_mclass_t * | http_default_mclass (void) |
HTTP parser description. | |
int | http_extract_body (msg_t *msg, http_t *http, char b[], int bsiz, int eos) |
Extract HTTP message body. | |
int | http_version_d (char **ss, char const **ver) |
Parse HTTP version. | |
int | http_version_xtra (char const *version) |
Calculate extra space required by version string. | |
void | http_version_dup (char **pp, char const **dd, char const *s) |
Duplicate a transport string. | |
char const * | http_method_name (http_method_t method, char const *name) |
Return string corresponding to the method. | |
http_method_t | http_method_d (char **ss, char const **nname) |
Parse a HTTP method name. | |
http_method_t | http_method_code (char const *name) |
Return enum corresponding to the method name. | |
int | http_query_parse (char *query,...) |
Parse query part in HTTP URL. | |
Variables | |
char const | http_version_1_1 [] |
HTTP version 1.1. | |
char const | http_version_1_0 [] |
HTTP version 1.0. | |
char const | http_version_0_9 [] |
HTTP version 0.9 is an empty string. |
Extract HTTP message body.
-1 | error | |
0 | cannot proceed | |
other | number of bytes extracted |
http_method_t http_method_d | ( | char ** | ss, | |
char const ** | nname | |||
) |
Parse a HTTP method name.
The function http_method_d()
parses a HTTP method, and returns a code corresponding to the method. It stores the address of the first non-LWS character after method name in *ss
.
ss | pointer to pointer to string to be parsed | |
nname | pointer to value-result parameter formethod name |
http_method_d
returns the method code if method was identified, 0 (http_method_unknown
) if method is not known, or -1
(http_method_invalid
) if an error occurred.NULL
, http_method_d() stores a pointer to the method name to it.
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.
int http_version_d | ( | char ** | ss, | |
char const ** | ver | |||
) |
Parse HTTP version.
The function http_version_d() parses a HTTP method.
0 | when successful, | |
-1 | upon an error. |