GNOME Bugzilla – Bug 686766
"Content-Length: 0" due to empty "Content-Type"
Last modified: 2013-11-17 14:24:46 UTC
Hello, I'm webkit developer in South Korea. In case, Content-Type has "" which value is empty string, not NULL. libsoup set "Content-Length: 0" forcely. I think that below change is proper to handle Content-Type. soup-message.c (any version is same) void soup_message_set_request (SoupMessage *msg, const char *content_type, SoupMemoryUse req_use, const char *req_body, gsize req_length) { g_return_if_fail (SOUP_IS_MESSAGE (msg)); g_return_if_fail (content_type != NULL || req_length == 0); -- if (content_type) { ++ if (content_type && *content_type != 0) { soup_message_headers_replace (msg->request_headers, "Content-Type", content_type); soup_message_body_append (msg->request_body, req_use, req_body, req_length); } else { soup_message_headers_remove (msg->request_headers, "Content-Type"); soup_message_body_truncate (msg->request_body); } } On libsoup port of webkit, this problem is reproduced when <object> include a server flash resource with parameter. GET /static_v8/flash/playerlist-nct_121010.swf HTTP/1.1 Host: stc.nct.nixcdn.com User-Agent: Mozilla/5.0 (SMART-TV; X11; Linux i686) AppleWebKit/534.7 (KHTML, like Gecko) Version/5.0 Safari/534.7 Content-Type: <----- mime-type is not defined from HTML content Accept: */* Accept-Encoding: gzip Content-Length: 0 <---- Content-Length is set forcely
Have you checked that making this change doesn't break any WebKit LayoutTests? I know there a various other subtleties involving exactly when Content-Type and Content-Length are set... If it doesn't break anything else, I'm OK with making this change.
DongHyun, Song, ping
I'm sorry, I forgot this issue. There are no break to test WebKit RenderTests. We already did render test with modifited libsoup. Its result is OK. (I'm in Samusng VD division, developing SmartTV Browser)
I'm sorry, I forgot this issue. There are no break to test WebKit RenderTests. We already did render test with modifited libsoup. Its result is OK. (I'm in Samusung VD division, developing SmartTV Browser)
Hm... where is soup_message_set_request() being called from? I don't see any calls to it in the WebKit source tree. I'm thinking now that, if anything, soup_message_set_request() should g_return_if_fail() in this case; setting Content-Type to "" is just wrong, and if there is some code within WebKit that is trying to do this, then WebKit should fix it itself (ie, check if the content type is "", and change it to NULL if so).
I've pushed a patch to master that makes soup_message_set_request() warn if it passed an invalid content_type. You should be checking that before calling the function.