From: Hendrik Tews <tews@cs.ru.nl>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] cookies in netclient
Date: Fri, 28 Sep 2007 11:49:52 +0200 [thread overview]
Message-ID: <wwuir5vunjz.fsf@tandem.cs.ru.nl> (raw)
In-Reply-To: <1188310360.7533.51.camel@localhost.localdomain> (Gerd Stolpmann's message of "Tue, 28 Aug 2007 16:12:40 +0200")
Gerd Stolpmann <info@gerd-stolpmann.de> writes:
> Unfortunately, get_set_cookie is missing (I have an implementation if
> you really need it).
>
> This one would retrieve the cookies as an Nethttp.cookie list? I
> don't know yet if I need it.
yes. You find it if you need it:
https://godirepo.camlcity.org/wwwsvn/trunk/code/get-set-cookie.ml?rev=1145&root=lib-ocamlnet2&view=auto
In my opinion it would be more convenient to have something of
type
#Nethttp.http_header_ro -> Nethttp.cookie list
eg
let get_set_cookies mh =
List.map get_set_cookie (mh#multiple_field "set-cookie")
Further I propose to add a function to set cookies that accepts a
cookie list, like
let set_cookies mh l =
Nethttp.Header.set_cookie mh
(List.map (fun c -> (c.Nethttp.cookie_name, c.Nethttp.cookie_value)) l)
The docs for http_call#request_header says
The user should set the following headers:
* Content-length: Set this to the length of the request body
if known. (The client falls back to HTTP 1.0 if not set!)
Do I have to care about this when using
Nethttp.Header.set_cookie?
>From what I read in the docs, it was not clear to me if
#request_header returns a copy of the header. I.e. do I have to
#set_request_header after modifying the header? (It works
without, so I guess #request_header does not copy.)
Yet another question: The docs for Netmime.mime_body_ro#value
says it will return the decoded body. But in which encoding? For
instance, if I want to extract pieces of an html page, what
should I pass as in_enc:Netconversion.encoding to
Netencoding.Html.decode? (At the moment decode_to_latin1 works
fine with me, but that's probably not the right way.)
Ocamlnet works now fine for me: Thanks for this great package!
Bye,
Hendrik
next prev parent reply other threads:[~2007-09-28 9:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-24 21:41 Hendrik Tews
2007-08-27 22:27 ` [Caml-list] " Gerd Stolpmann
2007-08-28 12:48 ` Hendrik Tews
2007-08-28 14:12 ` Gerd Stolpmann
2007-09-28 9:49 ` Hendrik Tews [this message]
2007-09-30 16:45 ` Gerd Stolpmann
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=wwuir5vunjz.fsf@tandem.cs.ru.nl \
--to=tews@cs.ru.nl \
--cc=caml-list@yquem.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