diff options
author | bkruse <bkruse@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-25 19:34:17 +0000 |
---|---|---|
committer | bkruse <bkruse@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-25 19:34:17 +0000 |
commit | ea50f406d299890033f2ccb109a70ac859dff876 (patch) | |
tree | 51afcff3e240c3ca68bcabdb2f55b09bdf3206c6 /main/http.c | |
parent | e73a2b8e743b6bb0a53965cadf68c04e52f924e7 (diff) |
Include the http_decode function from trunk
to replace the + with a space.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@133804 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/http.c')
-rw-r--r-- | main/http.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/main/http.c b/main/http.c index 7c1010f88..5ba869886 100644 --- a/main/http.c +++ b/main/http.c @@ -571,6 +571,23 @@ static struct ast_str *handle_post(struct ast_tcptls_session_instance *ser, char } #endif /* ENABLE_UPLOADS */ +/* + * Decode special characters in http uri. + * We have ast_uri_decode to handle %XX sequences, but spaces + * are encoded as a '+' so we need to replace them beforehand. + */ +static void http_decode(char *s) +{ + char *t; + + for (t = s; *t; t++) { + if (*t == '+') + *t = ' '; + } + + ast_uri_decode(s); +} + static struct ast_str *handle_uri(struct ast_tcptls_session_instance *ser, char *uri, int *status, char **title, int *contentlength, struct ast_variable **cookies, unsigned int *static_content) @@ -591,10 +608,10 @@ static struct ast_str *handle_uri(struct ast_tcptls_session_instance *ser, char while ((val = strsep(¶ms, "&"))) { var = strsep(&val, "="); if (val) - ast_uri_decode(val); + http_decode(val); else val = ""; - ast_uri_decode(var); + http_decode(var); if ((v = ast_variable_new(var, val, ""))) { if (vars) prev->next = v; @@ -614,7 +631,7 @@ static struct ast_str *handle_uri(struct ast_tcptls_session_instance *ser, char else vars = *cookies; *cookies = NULL; - ast_uri_decode(uri); + http_decode(uri); AST_RWLIST_RDLOCK(&uri_redirects); AST_RWLIST_TRAVERSE(&uri_redirects, redirect, entry) { |