GNOME Bugzilla – Bug 576760
soup_message_headers_get_content_type returns bad headers
Last modified: 2009-04-19 14:42:19 UTC
When the server sends multiple Content Type headers, the soup_message_headers_get_content_type function will return a comma-separated string with values from all the instances. For instance, a response of: HTTP/1.1 200 OK Connection: close Date: Sun, 22 Mar 2009 14:16:51 GMT Server: Microsoft-IIS/6.0 Content-type: text/html Page-Completion-Status: Normal Expires: -1 Content-Type: text/html Page-Completion-Status: Normal Set-Cookie: CFID=45627684; path=/; Set-Cookie: CFTOKEN=52268372; path=/; Set-Cookie: LOG_CLIENT_ID=35258851; expires=Sun, 27-Sep-2037 00:00:00 GMT; path=/; Will give us "text/html, text/html", when it should return only "text/html".
Created attachment 131524 [details] [review] patch adding new API and fixing the bug OK, this fixes things by splitting soup_message_headers_get() into soup_message_headers_get_one() (which returns the first value) and soup_message_headers_get_list() (which returns all values, exactly like soup_message_headers_get()). This lets callers indicate whether the header is a list-valued header (in which case you want libsoup to do the concatenating) or a non-list-valued header (in which case you don't). Then the Content-Type code is made to use soup_message_headers_get_one() and it all works. Once I branch for 2.26, I'll mark soup_message_headers_get() deprecated in trunk.
committed. leaving this bug open to remind me to mark soup_message_headers_get() deprecated in 2.27
(In reply to comment #2) > leaving this bug open to remind me to mark > soup_message_headers_get() deprecated in 2.27 done