summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2010-01-23 16:05:07 -0500
committerDan Winship <danw@gnome.org>2010-01-23 16:06:43 -0500
commita65f7b08956a2825b96df8da57ebb64a7925a159 (patch)
tree67b387d906e20c285b649d3564c8c85fa9676fec
parent51cb7ab4b60fe05a90b5537aad3a657788818c14 (diff)
downloadlibsoup-a65f7b08956a2825b96df8da57ebb64a7925a159.tar.gz
soup-form.c: change some code to make clang happy and to be more obvious
based on a suggestion from kov in https://bugzilla.gnome.org/show_bug.cgi?id=605543
-rw-r--r--libsoup/soup-form.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c
index 7263890a..278d8455 100644
--- a/libsoup/soup-form.c
+++ b/libsoup/soup-form.c
@@ -361,22 +361,21 @@ soup_form_request_for_data (const char *method, const char *uri_string,
if (!strcmp (method, "GET")) {
g_free (uri->query);
uri->query = form_data;
- form_data = NULL;
- }
- msg = soup_message_new_from_uri (method, uri);
+ msg = soup_message_new_from_uri (method, uri);
+ } else if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
+ msg = soup_message_new_from_uri (method, uri);
- if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
soup_message_set_request (
msg, SOUP_FORM_MIME_TYPE_URLENCODED,
SOUP_MEMORY_TAKE,
form_data, strlen (form_data));
- form_data = NULL;
- }
-
- if (form_data) {
+ } else {
g_warning ("invalid method passed to soup_form_request_new");
g_free (form_data);
+
+ /* Don't crash */
+ msg = soup_message_new_from_uri (method, uri);
}
return msg;