Christian Grothoff hace 12 años
padre
commit
14ca1719e9
Se han modificado 3 ficheros con 18 adiciones y 5 borrados
  1. 11 0
      ChangeLog
  2. 2 0
      src/microhttpd/connection.c
  3. 5 5
      src/testcurl/test_process_arguments.c

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+Thu Apr 10 09:39:38 CEST 2014
+	Removed unescaping for URI path (#3371) as '+' should not
+	be converted to space in accordance with
+	http://www.w3.org/TR/html401/appendix/notes.html#ampersands-in-uris
+	and http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
+	Note that we now also no longer convert '#38;' to '&'; if needed,
+	the application needs to apply unescaping to the path of the URI
+	itself (before, MHD unescaped '#38;' but not '&', so this
+	inconsistency was now resolved by simply not unescaping anything
+	before the first '&'). -CG
+
 Tue Apr 08 15:35:44 CET 2014
 	Added support for W32 native threads.
 	Added --with-threads=LIB configure parameter. -EG

+ 2 - 0
src/microhttpd/connection.c

@@ -1361,9 +1361,11 @@ parse_initial_message_line (struct MHD_Connection *connection,
       args++;
       parse_arguments (MHD_GET_ARGUMENT_KIND, connection, args);
     }
+#if 0
   connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
 					 connection,
 					 uri);
+#endif
   connection->url = uri;
   if (NULL == http_version)
     connection->version = "";

+ 5 - 5
src/testcurl/test_process_arguments.c

@@ -93,12 +93,12 @@ ahc_echo (void *cls,
                                      MHD_GET_ARGUMENT_KIND, "space");
   if ((hdr == NULL) || (0 != strcmp (hdr, "\240bar")))
     abort ();
-  if (3 != MHD_get_connection_values (connection, 
+  if (3 != MHD_get_connection_values (connection,
 				      MHD_GET_ARGUMENT_KIND,
 				      NULL, NULL))
     abort ();
   response = MHD_create_response_from_buffer (strlen (url),
-					      (void *) url, 
+					      (void *) url,
 					      MHD_RESPMEM_MUST_COPY);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
@@ -136,7 +136,7 @@ testExternalGet ()
     return 256;
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL,
-                    "http://127.0.0.1:21080/hello_world?k=v+x&hash=%23foo&space=%A0bar");
+                    "http://127.0.0.1:21080/hello+world?k=v+x&hash=%23foo&space=%A0bar");
   curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
   curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
   curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
@@ -224,9 +224,9 @@ testExternalGet ()
       curl_multi_cleanup (multi);
     }
   MHD_stop_daemon (d);
-  if (cbc.pos != strlen ("/hello_world"))
+  if (cbc.pos != strlen ("/hello+world"))
     return 8192;
-  if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
+  if (0 != strncmp ("/hello+world", cbc.buf, strlen ("/hello+world")))
     return 16384;
   return 0;
 }