* netclient: cookie names with + (or spaces)
@ 2008-01-24 16:23 Hendrik Tews
0 siblings, 0 replies; only message in thread
From: Hendrik Tews @ 2008-01-24 16:23 UTC (permalink / raw)
To: caml-list
Hi,
mailman seems to give out cookies with names that contain ``+''.
When I do curl -c ... or look into firefox I see
``robin-cvs-commits+admin'' as cookie name. It might also be that
curl and firefox are buggy and the name is really
``robin-cvs-commits admin''.
There are several fixes needed in netclient to work with such
cookies.
First One has to add ``+'' in the name regexp for get_set_cookie
(see https://godirepo.camlcity.org/wwwsvn/trunk/code/get-set-cookie.ml?rev=1145&root=lib-ocamlnet2&view=auto
which I got in
http://caml.inria.fr/pub/ml-archives/caml-list/2007/08/59604682c9ef4918bb532a576e7db86c.en.html) :
let nv_re = Pcre.regexp "^([-a-zA-Z0-9_.+]+)(=(.*))?$"
This way I get robin-cvs-commits+admin as cookie name, but when I
set it Nethttp.Header.set_cookie the ``+'' is encoded and the
cookie is not recognized by mailman.
I worked around this rather clumsy:
(if c.Nethttp.cookie_name = "robin-cvs-commits+admin" then
"robin-cvs-commits admin"
else
c.Nethttp.cookie_name)
Another possibility is to change in get_set_cookie
{ Nethttp.cookie_name = Netencoding.Url.decode ~plus:false n;
to
{ Nethttp.cookie_name = Netencoding.Url.decode ~plus:true n;
this way I get of course ``robin-cvs-commits admin'' as cookie
name.
I believe get_set_cookie should be in sync with set_cookie.
Therefore, which one is wrong? Must/are cookie names be URL-encoded
in the header?
Bye,
Hendrik
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-24 16:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-24 16:23 netclient: cookie names with + (or spaces) Hendrik Tews
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox