src/http.c File Reference
HTTP utility functions.
More...
Detailed Description
HTTP utility functions.
- Date:
- 23 Feb 2010
- Author:
- Zachary Sims <zacs7@users.sourceforge.net>
Module prefix: http_
$Id$
- Todo:
- More consistant naming for returning/looking up enum values.
Function Documentation
Create a response string based on the given code and HTTP version.
- Returns:
- a string that should be freed with http_response_free(). On error, NULL is returned.
- Todo:
- Use connection value
char* http_decode_uri |
( |
const char * |
uri |
) |
|
char* http_encode_uri |
( |
const char * |
uri |
) |
|
void http_free |
( |
const char * |
item |
) |
|
void http_free_response |
( |
char * |
response |
) |
|
const char* http_get_code_description |
( |
const int |
code |
) |
|
Returns the description of a HTTP code.
All errors are kept in an internal static constant array.
- Parameters:
-
- Returns:
- The code description. On error, NULL is returned if the code cannot be found.
Returns the string value of a HTTP content type.
- Parameters:
-
- Returns:
- a string value of the type.
char* http_html_escape |
( |
const char * |
html |
) |
|
http_method_e http_lookup_method |
( |
const char * |
method, |
|
|
const size_t |
n | |
|
) |
| | |
Looks up a method enumeration from a method string.
Even though the HTTP spec says case sensitive, ignore that ;).
- Parameters:
-
| method | The method. |
| n | The length of the method. |
- Todo:
- the n parameter isn't really required.
- Returns:
- a http_method_tag return value.
Looks up a HTTP version from a HTTP version string.
Even though the HTTP spec says case sensitive, ignore that ;).
- Parameters:
-
| version | The version string. Assumed to contain a valid version. |
- Returns:
- a http_version_tag return value. On error, HTTP_VERSION_UNKNOWN is returned.
Returns a valid HTTP version string from the enumeration.
- Parameters:
-
| version | The enumerated HTTP version. |
- Returns:
- a HTTP version string. On error, NULL is returned.