Browse thread
netclient: cookie names with + (or spaces)
- Hendrik Tews
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Hendrik Tews <tews@c...> |
| Subject: | netclient: cookie names with + (or spaces) |
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