From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id D44FFBC69 for ; Fri, 28 Sep 2007 11:49:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAOxq/EaDrhCRh2dsb2JhbACOLwEBAQgKJw X-IronPort-AV: E=Sophos;i="4.21,209,1188770400"; d="scan'208";a="3365707" Received: from smeltpunt.science.ru.nl ([131.174.16.145]) by mail3-smtp-sop.national.inria.fr with ESMTP; 28 Sep 2007 11:49:54 +0200 Received: from tandem.cs.ru.nl (tandem.cs.ru.nl [131.174.142.18]) by smeltpunt.science.ru.nl (8.13.7/5.21) with ESMTP id l8S9nrvY001251 for ; Fri, 28 Sep 2007 11:49:53 +0200 (MEST) Received: from tews by tandem.cs.ru.nl with local (Exim 4.63) (envelope-from ) id 1IbCTo-0006a5-W2 for caml-list@yquem.inria.fr; Fri, 28 Sep 2007 11:49:52 +0200 From: Hendrik Tews To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] cookies in netclient References: <18127.20625.317597.197268@tandem.cs.ru.nl> <1188253645.7533.15.camel@localhost.localdomain> <1188310360.7533.51.camel@localhost.localdomain> Date: Fri, 28 Sep 2007 11:49:52 +0200 In-Reply-To: <1188310360.7533.51.camel@localhost.localdomain> (Gerd Stolpmann's message of "Tue, 28 Aug 2007 16:12:40 +0200") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.56 on 131.174.16.145 X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 netclient:01 gerd:01 stolpmann:01 netencoding:01 ocamlnet:01 hendrik:01 cookie:98 cookie:98 1.0:98 caml-list:01 writes:01 modifying:02 Gerd Stolpmann 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