After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 576760 - soup_message_headers_get_content_type returns bad headers
soup_message_headers_get_content_type returns bad headers
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: HTTP Transport
2.25.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2009-03-25 20:12 UTC by Gustavo Noronha (kov)
Modified: 2009-04-19 14:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch adding new API and fixing the bug (27.46 KB, patch)
2009-03-27 21:24 UTC, Dan Winship
committed Details | Review

Description Gustavo Noronha (kov) 2009-03-25 20:12:04 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".
Comment 1 Dan Winship 2009-03-27 21:24:41 UTC
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.
Comment 2 Dan Winship 2009-04-03 00:27:14 UTC
committed. leaving this bug open to remind me to mark soup_message_headers_get() deprecated in 2.27
Comment 3 Dan Winship 2009-04-19 14:42:19 UTC
(In reply to comment #2)
> leaving this bug open to remind me to mark
> soup_message_headers_get() deprecated in 2.27

done