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

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) ...@@ -357,6 +357,7 @@ int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len)
if (uri != NULL && strlen(uri) > 0) { if (uri != NULL && strlen(uri) > 0) {
char *query; char *query;
if((query = strchr(uri, '?')) != NULL) { if((query = strchr(uri, '?')) != NULL) {
httpp_setvar(parser, HTTPP_VAR_RAWURI, uri);
*query = 0; *query = 0;
query++; query++;
parse_query(parser, query); parse_query(parser, query);
...@@ -424,7 +425,7 @@ int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len) ...@@ -424,7 +425,7 @@ int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len)
return 1; 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; http_var_t *var;
...@@ -445,7 +446,7 @@ void httpp_setvar(http_parser_t *parser, char *name, char *value) ...@@ -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 var;
http_var_t *found; http_var_t *found;
...@@ -455,7 +456,7 @@ char *httpp_getvar(http_parser_t *parser, char *name) ...@@ -455,7 +456,7 @@ char *httpp_getvar(http_parser_t *parser, char *name)
return NULL; return NULL;
fp = &found; fp = &found;
var.name = name; var.name = (char*)name;
var.value = NULL; var.value = NULL;
if (avl_get_by_key(parser->vars, &var, fp) == 0) if (avl_get_by_key(parser->vars, &var, fp) == 0)
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define HTTPP_VAR_PROTOCOL "__protocol" #define HTTPP_VAR_PROTOCOL "__protocol"
#define HTTPP_VAR_VERSION "__version" #define HTTPP_VAR_VERSION "__version"
#define HTTPP_VAR_URI "__uri" #define HTTPP_VAR_URI "__uri"
#define HTTPP_VAR_RAWURI "__rawuri"
#define HTTPP_VAR_REQ_TYPE "__req_type" #define HTTPP_VAR_REQ_TYPE "__req_type"
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage" #define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
#define HTTPP_VAR_ERROR_CODE "__errorcode" #define HTTPP_VAR_ERROR_CODE "__errorcode"
...@@ -60,8 +61,8 @@ void httpp_initialize(http_parser_t *parser, http_varlist_t *defaults); ...@@ -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(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_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); 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); void httpp_setvar(http_parser_t *parser, const char *name, const char *value);
char *httpp_getvar(http_parser_t *parser, char *name); char *httpp_getvar(http_parser_t *parser, const char *name);
void httpp_set_query_param(http_parser_t *parser, char *name, char *value); void httpp_set_query_param(http_parser_t *parser, char *name, char *value);
char *httpp_get_query_param(http_parser_t *parser, char *name); char *httpp_get_query_param(http_parser_t *parser, char *name);
void httpp_destroy(http_parser_t *parser); 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