Skip to content
Snippets Groups Projects
Commit fbe6c86b authored by Luigi Rizzo's avatar Luigi Rizzo
Browse files

introduce uri_decode() so that '+' are translated into ' '

(e.g. browsers do this when they encode input strings from a form).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent d1058df1
Branches
Tags
No related merge requests found
...@@ -99,6 +99,17 @@ static char *ftype2mtype(const char *ftype, char *wkspace, int wkspacelen) ...@@ -99,6 +99,17 @@ static char *ftype2mtype(const char *ftype, char *wkspace, int wkspacelen)
return wkspace; return wkspace;
} }
/* like ast_uri_decode, but replace '+' with ' ' */
static char *uri_decode(char *buf)
{
char *c;
ast_uri_decode(buf);
for (c = buf; *c; c++) {
if (*c == '+')
*c = ' ';
}
return buf;
}
static char *static_callback(struct sockaddr_in *req, const char *uri, struct ast_variable *vars, int *status, char **title, int *contentlength) static char *static_callback(struct sockaddr_in *req, const char *uri, struct ast_variable *vars, int *status, char **title, int *contentlength)
{ {
char result[4096]; char result[4096];
...@@ -298,7 +309,7 @@ static char *handle_uri(struct sockaddr_in *sin, char *uri, int *status, char ** ...@@ -298,7 +309,7 @@ static char *handle_uri(struct sockaddr_in *sin, char *uri, int *status, char **
while ((val = strsep(&params, "&"))) { while ((val = strsep(&params, "&"))) {
var = strsep(&val, "="); var = strsep(&val, "=");
if (val) if (val)
ast_uri_decode(val); uri_decode(val);
else else
val = ""; val = "";
ast_uri_decode(var); ast_uri_decode(var);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment