Closed
Bug 370639
Opened 18 years ago
Closed 9 years ago
Using comma (",") delimiter instead ";" (semi-colon) in Cookie header by default is not useful
Categories
(Core :: Networking: HTTP, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: forgc, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 XPCOMViewer/0.9.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
I am writing extention for new e-mail messages notification with multi-account support. And i need to harvest all cookies for each account and save them in array - it's not difficult (Using httpChannel.getResponseHeader("Set-Cookie").split("\n");), but when i checking each account i need to dinamicly change cookie header. i use following code:
for (var name in this._cookieData)
httpChannel.setRequestHeader("Cookie", this._cookieData[name], true);
But this code make following:
Cookie: name1=value1, name2=value2,... nameN=valueN
instead:
Cookie: name1=value1; name2=value2;... nameN=valueN
source of it i found in following core code:
http://lxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp#48
83 // Delimit each value from the others using a comma (per HTTP spec)
84 entry->value.AppendLiteral(", ");
I found RFC:
HTTP State Management Mechanism - Proposed Standard RFC 2109
This document specifies a way to create a stateful session with HTTP requests and responses. It describes two new headers, Cookie and Set-Cookie, which carry state information between participating origin servers and user agents. The method described here differs from Netscape's Cookie proposal, but it can interoperate with HTTP/1.0 user agents that use Netscape's method. (See the HISTORICAL section.)
http://www.w3.org/Protocols/rfc2109/rfc2109
and what i see:
Note: For backward compatibility, the separator in the Cookie header
is semi-colon (;) everywhere. A server should also accept comma (,)
as the separator between cookie-values for future compatibility.
Server SHOULD, but 99% of servers backend software use the following (or similar) code to split Cookie header:
var cookieHeader = .....
var cookiesArray = cookieHeader..split(";")
And as a result for me, servers got cookie header with comma delimiter without error, but software cannot work with cookies. Some mail services set session ID in url, but several (for example: mail.yandex.ru - one of bigger mail service in Russia will mot work without cookies - Why? "That the question, but not to me" (c) W. Shakespeare).
So i see two way: change from:
84 entry->value.AppendLiteral(", ");
to:
84 entry->value.AppendLiteral("; ");
Or (and i think it better than first way) make opportunity for developers ti choise beetwen comma and semi-colon:
httpChannel.setRequestHeader("Cookie", this._cookieData[name], true, DELIMITER_TYPE);
const DELIMITER_TYPE_SEMI_COLON = 1 (if type blank = semi-colon is default value)
const DELIMITER_TYPE_COMMA = 2
For this moment i make trick for fix this bug:
var compl_cookies = "";
for (var name in this._cookieData)
compl_cookies = compl_cookies + this._cookieData[name] + "; ";
httpChannel.setRequestHeader("Cookie", compl_cookies, true);
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → WONTFIX
Updated•9 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago → 9 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•