From: Dan Winship Date: Fri, 5 Dec 2008 03:57:05 +0000 (+0000) Subject: Correctly handle forms that have URI-encoded parameter names. #563302, X-Git-Tag: LIBSOUP_2_25_4~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c03509c52fbb665a655c2cd5f0f971e12e8ee456;p=platform%2Fupstream%2Flibsoup.git Correctly handle forms that have URI-encoded parameter names. #563302, * libsoup/soup-form.c (soup_form_decode): Correctly handle forms that have URI-encoded parameter names. #563302, Evan Nemerson. * tests/forms-test.c: test that svn path=/trunk/; revision=1220 --- diff --git a/ChangeLog b/ChangeLog index 5625efd..760be25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-12-04 Dan Winship + + * libsoup/soup-form.c (soup_form_decode): Correctly handle forms + that have URI-encoded parameter names. #563302, Evan Nemerson. + + * tests/forms-test.c: test that + 2008-12-03 Dan Winship * libsoup/soup-proxy-resolver-gconf.c (finalize): disconnect from diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c index 3ef9da6..1bcc603 100644 --- a/libsoup/soup-form.c +++ b/libsoup/soup-form.c @@ -90,15 +90,15 @@ soup_form_decode (const char *encoded_form) for (i = 0; pairs[i]; i++) { name = pairs[i]; eq = strchr (name, '='); - if (!form_decode (name)) { - g_free (name); - continue; - } if (eq) { *eq = '\0'; value = eq + 1; } else value = NULL; + if (!form_decode (name) || (value && !form_decode (value))) { + g_free (name); + continue; + } g_hash_table_insert (form_data_set, name, value); } diff --git a/tests/forms-test.c b/tests/forms-test.c index e1184bf..b7ae814 100644 --- a/tests/forms-test.c +++ b/tests/forms-test.c @@ -72,7 +72,7 @@ do_hello_test (int n, gboolean extra, const char *uri) g_ptr_array_add (args, title_arg); } if (tests[n].name) { - name_arg = soup_form_encode ("name", tests[n].name, NULL); + name_arg = soup_form_encode ("n@me", tests[n].name, NULL); g_ptr_array_add (args, "-d"); g_ptr_array_add (args, name_arg); } @@ -238,7 +238,7 @@ hello_callback (SoupServer *server, SoupMessage *msg, if (query) { title = g_hash_table_lookup (query, "title"); - name = g_hash_table_lookup (query, "name"); + name = g_hash_table_lookup (query, "n@me"); fmt = g_hash_table_lookup (query, "fmt"); } else title = name = fmt = NULL; @@ -254,7 +254,7 @@ hello_callback (SoupServer *server, SoupMessage *msg, } g_string_append (buf, "
" "

Title:

" - "

Name:

" + "

Name:

" "

" "

" "
\r\n");