[svn-commits] rizzo: trunk r45474 - /trunk/main/http.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Oct 17 22:27:23 MST 2006


Author: rizzo
Date: Wed Oct 18 00:27:22 2006
New Revision: 45474

URL: http://svn.digium.com/view/asterisk?rev=45474&view=rev
Log:
introduce uri_decode() so that '+' are translated into ' '
(e.g. browsers do this when they encode input strings from a form).


Modified:
    trunk/main/http.c

Modified: trunk/main/http.c
URL: http://svn.digium.com/view/asterisk/trunk/main/http.c?rev=45474&r1=45473&r2=45474&view=diff
==============================================================================
--- trunk/main/http.c (original)
+++ trunk/main/http.c Wed Oct 18 00:27:22 2006
@@ -99,6 +99,17 @@
 	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 @@
 		while ((val = strsep(&params, "&"))) {
 			var = strsep(&val, "=");
 			if (val)
-				ast_uri_decode(val);
+				uri_decode(val);
 			else 
 				val = "";
 			ast_uri_decode(var);



More information about the svn-commits mailing list