Commit 7446328d authored by Karl Heyes's avatar Karl Heyes

store the original full uri if there are query parameters. small cleanup to

prototype definitions

svn path=/icecast/trunk/httpp/; revision=9453
parent 88bfe6ba
......@@ -357,6 +357,7 @@ int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len)
if (uri != NULL && strlen(uri) > 0) {
char *query;
if((query = strchr(uri, '?')) != NULL) {
httpp_setvar(parser, HTTPP_VAR_RAWURI, uri);
*query = 0;
query++;
parse_query(parser, query);
......@@ -424,7 +425,7 @@ int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len)
return 1;
}
void httpp_setvar(http_parser_t *parser, char *name, char *value)
void httpp_setvar(http_parser_t *parser, const char *name, const char *value)
{
http_var_t *var;
......@@ -445,7 +446,7 @@ void httpp_setvar(http_parser_t *parser, char *name, char *value)
}
}
char *httpp_getvar(http_parser_t *parser, char *name)
char *httpp_getvar(http_parser_t *parser, const char *name)
{
http_var_t var;
http_var_t *found;
......@@ -455,7 +456,7 @@ char *httpp_getvar(http_parser_t *parser, char *name)
return NULL;
fp = &found;
var.name = name;
var.name = (char*)name;
var.value = NULL;
if (avl_get_by_key(parser->vars, &var, fp) == 0)
......
......@@ -14,6 +14,7 @@
#define HTTPP_VAR_PROTOCOL "__protocol"
#define HTTPP_VAR_VERSION "__version"
#define HTTPP_VAR_URI "__uri"
#define HTTPP_VAR_RAWURI "__rawuri"
#define HTTPP_VAR_REQ_TYPE "__req_type"
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
#define HTTPP_VAR_ERROR_CODE "__errorcode"
......@@ -60,8 +61,8 @@ void httpp_initialize(http_parser_t *parser, http_varlist_t *defaults);
int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len);
int httpp_parse_icy(http_parser_t *parser, char *http_data, unsigned long len);
int httpp_parse_response(http_parser_t *parser, char *http_data, unsigned long len, char *uri);
void httpp_setvar(http_parser_t *parser, char *name, char *value);
char *httpp_getvar(http_parser_t *parser, char *name);
void httpp_setvar(http_parser_t *parser, const char *name, const char *value);
char *httpp_getvar(http_parser_t *parser, const char *name);
void httpp_set_query_param(http_parser_t *parser, char *name, char *value);
char *httpp_get_query_param(http_parser_t *parser, char *name);
void httpp_destroy(http_parser_t *parser);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment