[svn-commits] bkruse: branch 1.6.0 r133804 - /branches/1.6.0/main/http.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 25 14:34:17 CDT 2008


Author: bkruse
Date: Fri Jul 25 14:34:17 2008
New Revision: 133804

URL: http://svn.digium.com/view/asterisk?view=rev&rev=133804
Log:
Include the http_decode function from trunk
to replace the + with a space.

Modified:
    branches/1.6.0/main/http.c

Modified: branches/1.6.0/main/http.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/http.c?view=diff&rev=133804&r1=133803&r2=133804
==============================================================================
--- branches/1.6.0/main/http.c (original)
+++ branches/1.6.0/main/http.c Fri Jul 25 14:34:17 2008
@@ -571,6 +571,23 @@
 }
 #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 @@
 		while ((val = strsep(&params, "&"))) {
 			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 @@
 	else
 		vars = *cookies;
 	*cookies = NULL;
-	ast_uri_decode(uri);
+	http_decode(uri);
 
 	AST_RWLIST_RDLOCK(&uri_redirects);
 	AST_RWLIST_TRAVERSE(&uri_redirects, redirect, entry) {




More information about the svn-commits mailing list