mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-03 04:16:43 +00:00
Include the http_decode function from trunk
to replace the + with a space. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@133804 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
23
main/http.c
23
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) {
|
||||
|
||||
Reference in New Issue
Block a user