Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@cs.ru.nl>
To: caml-list@inria.fr
Subject: netclient: cookie names with + (or spaces)
Date: Thu, 24 Jan 2008 17:23:24 +0100	[thread overview]
Message-ID: <18328.47996.575042.540380@tandem.cs.ru.nl> (raw)

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


                 reply	other threads:[~2008-01-24 16:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18328.47996.575042.540380@tandem.cs.ru.nl \
    --to=tews@cs.ru.nl \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox