summaryrefslogtreecommitdiff
path: root/main/http.c
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-10-18 05:27:22 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-10-18 05:27:22 +0000
commitfbe6c86b0b587effff9e51b2f4a6c0ebddd03548 (patch)
tree055c6a89ceef2839393693b833707e8f42520c9d /main/http.c
parentd1058df18f15dffc0c1dfdb70ffd531e586c5d28 (diff)
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
Diffstat (limited to 'main/http.c')
-rw-r--r--main/http.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/main/http.c b/main/http.c
index d5d33f88b..5da224e35 100644
--- a/main/http.c
+++ b/main/http.c
@@ -99,6 +99,17 @@ static char *ftype2mtype(const char *ftype, char *wkspace, int wkspacelen)
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)
{
char result[4096];
@@ -298,7 +309,7 @@ static char *handle_uri(struct sockaddr_in *sin, char *uri, int *status, char **
while ((val = strsep(&params, "&"))) {
var = strsep(&val, "=");
if (val)
- ast_uri_decode(val);
+ uri_decode(val);
else
val = "";
ast_uri_decode(var);