Only fetch form values when the message is accumulative

This commit is contained in:
Enrico Tröger 2009-10-12 18:16:52 +02:00 committed by Christian Dywan
parent 195b763b53
commit 2fc3116f77

View file

@ -137,15 +137,20 @@ formhistory_session_request_queued_cb (SoupSession* session,
SoupMessage* msg) SoupMessage* msg)
{ {
gchar* method = katze_object_get_string (msg, "method"); gchar* method = katze_object_get_string (msg, "method");
if (method[0] == 'P' && method[1] == 'O' && method[2] == 'S') if (method && !strncmp (method, "POST", 4))
{ {
SoupMessageHeaders* hdrs = msg->request_headers; /* SoupMessageHeaders* hdrs = msg->request_headers;
/* FIXME: Need a permanent storage implementation */ const gchar* referer; */
const char* referer = soup_message_headers_get_one (hdrs, "Referer");
SoupMessageBody* body = msg->request_body; SoupMessageBody* body = msg->request_body;
soup_buffer_free (soup_message_body_flatten (body)); if (soup_message_body_get_accumulate (body))
{
SoupBuffer* buffer = soup_message_body_flatten (body);
GHashTable* keys = soup_form_decode (body->data); GHashTable* keys = soup_form_decode (body->data);
formhistory_update_main_hash (keys); formhistory_update_main_hash (keys);
soup_buffer_free (buffer);
}
/* FIXME: Need a permanent storage implementation */
/* referer = soup_message_headers_get_one (hdrs, "Referer"); */
} }
g_free (method); g_free (method);
} }