tjbush / mochiweb

Automatically exported from code.google.com/p/mochiweb
Other
0 stars 0 forks source link

Suggestion for mochiweb_cookies:cookie #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. mochiweb_cookies:cookie("sessionid", "123345", [{path, "/"}]).

What is the expected output? What do you see instead?

Expected: {"Set-Cookie", "session_id=123345; Path=/"}
Instead: {"Set-Cookie", "session_id=\"123345\"; Path=\"/\""}
Consequence: The browser does not send the cookie correctly

What version of the product are you using? On what operating system?

I am using the current Subversion trunk

Please provide any additional information below.

I have attached a suggestion (I did not make a subversion patch file out of it, 
but just attached 
the replacement cookie()) for a modification to the cookie() function, 
containing the following 
changes:

- split function into base_cookie(), cookie_expires(), cookie_secure(), 
cookie_domain() and 
cookie_path()
- does not use quote() function

With these changes, the cookie handling seems to work in my environment.

Regards,

Wei-ju Wu

Original issue reported on code.google.com by we...@web.de on 2 Jan 2008 at 8:25

Attachments:

GoogleCodeExporter commented 8 years ago
I should add that this was experienced in Safari, as mochiweb_cookies:cookie() 
follows RFC2109, while the 
former implements the original Netscape scheme. It seems that the Mozilla 
browsers can deal with both, as can 
Internet Explorer and Opera. Konqueror can deal with unquoted cookie values 
(which I would expect, since Safari 
and Konqueror are related), I haven't tried the quoted values here.

Original comment by we...@web.de on 3 Jan 2008 at 7:00

GoogleCodeExporter commented 8 years ago
mochiweb_cookies:cookie("sessionid", "123345", [{path, "/"}]).
{"Set-Cookie","sessionid=123345; Version=1; Path=/"}

Original comment by bob.ippo...@gmail.com on 7 Jan 2008 at 12:11