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 603496 - SoupCookieJar stores empty cookies
SoupCookieJar stores empty cookies
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
unspecified
Other All
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2009-12-01 16:16 UTC by José Millán Soto
Modified: 2009-12-17 12:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to make SoupCookieJar not to store empty cookies (1.23 KB, patch)
2009-12-01 16:16 UTC, José Millán Soto
none Details | Review

Description José Millán Soto 2009-12-01 16:16:05 UTC
Created attachment 148832 [details] [review]
Patch to make SoupCookieJar not to store empty cookies

Currently, SoupCookieJar is storing cookies which have no name and no value.
This is making WebKitGTK+ fail one of the WebKit layout tests (http/test/misc/empty-cookie.html).
This patch makes SoupCookieJar not to store empty cookies.
Comment 1 Dan Winship 2009-12-01 17:17:21 UTC
hm... mozilla explicitly allows this: see https://bugzilla.mozilla.org/show_bug.cgi?id=169091#c16

what does safari do in that case? does it allow the first cookie assignment but not the second?
Comment 2 Dan Winship 2009-12-01 17:22:46 UTC
http://tools.ietf.org/html/draft-abarth-cookie-05 supports the moz/IE behavior:

   3.  If the name-value-pair string contains a U+3D ("=") character:

          the (possibly empty) name string is the characters up to, but
          not including, the first U+3D ("=") character, and the
          (possibly empty) value string is the characters after the
          first U+3D ("=") character.

       Otherwise:

          the name string is empty, and the value string is the entire
          name-value-pair string.

It would be interesting to find out why WebKit has the test it currently has.
Comment 3 José Millán Soto 2009-12-02 15:19:39 UTC
I've tested the behaviour of various browsers when receiving a nameless cookie, and it's as follow:

  - Firefox & Konqueror:
    It handles the nameless cookie, however, if it has no name and "" as value, it doesn't appear in document.cookie
    document.cookie="" sets nameless cookie to "" value
  - Chromium:
    Handles nameless cookie, but document.cookie="" does nothing (the previous nameless cookie is not overwritten)
  - Internet Explorer:
    Handles nameless cookie, nameless cookie with "" as value is still shown in document.cookie
  - arora(QtWebKit):
    Ignores nameless cookie
  - Safari & Opera
    document.cookie = "" and document.cookie = "=value" do nothing, document.cookie = "value" create a new cookie with value as name and "" as value

This patch handles a nameless cookie if a value is especified (either by "value" or "=value"), but removes the cookie if value is "" (either by "" or "=")
Comment 4 Dan Winship 2009-12-17 12:55:22 UTC
Just checked in a bunch of fixes to cookie handling, which should fix this.