From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id oBNDqZej005869 for ; Thu, 23 Dec 2010 14:52:35 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvQBAEfjEk3AbSoIe2dsb2JhbACDZJIrjhkWARYiBCCwPZBjDYETgzZ0BA X-IronPort-AV: E=Sophos;i="4.60,219,1291590000"; d="scan'208";a="83402355" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Dec 2010 14:52:29 +0100 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from first (e178024157.adsl.alicedsl.de [85.178.24.157]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id oBNDqSC5002324 for ; Thu, 23 Dec 2010 14:52:28 +0100 Received: by first (Postfix, from userid 1000) id 546C0441596; Thu, 23 Dec 2010 14:52:28 +0100 (CET) Date: Thu, 23 Dec 2010 14:52:28 +0100 From: oliver@first.in-berlin.de To: caml-list@inria.fr Message-ID: <20101223135228.GA3651@siouxsie> References: <20101222193907.GA8091@siouxsie> <1293061753.22147.517.camel@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1293061753.22147.517.camel@thinkpad> User-Agent: Mutt/1.5.20 (2009-06-14) X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 Subject: Re: [Caml-list] Ocamlnet and sending Referrer On Thu, Dec 23, 2010 at 12:49:13AM +0100, Gerd Stolpmann wrote: > Am Mittwoch, den 22.12.2010, 20:39 +0100 schrieb > oliver@first.in-berlin.de: > > Hi, > > > > > > for a simple script I used > > Http_client.Convenience from ocamlnet. > > > > This module is really convenient and I enjoyed to have it > > for some simple get-calls. I'm quite happy with this. > > > > But now I need to send a Referrer, and this seems not to work > > with this module. > > > > What module must be used for sending a Referrer? > > And... just in case I may later will need Cookies also... > > ...what module can handle this? > > > > Can this all be done with ocamlnet-stuff? > > If there are more than one possibility, which module > > would you recommend me (and why)? > > The convenience module does not permit it to set additional headers. Use > the pipeline API: > > open Http_client > > let call = new get "http://host/path" ;; > (call # request_header `Base) # update_field "Referer" (* sic! *) "..."; > > let p = new pipeline ;; > p # add call ;; > p # run();; > if call # status = `Successful then > let response = call # response_body # value in > ... > else (* error case *) Hmhhh strange, I get syntax errors with the following: =========================================================== module Networking = struct open Pcre open Http_client let call = new get "http://www.ocaml.org" in (call # request_header `Base) # update_field "Referer" "foobar"; let p = new pipeline in p # add call; p # run() (* if call # status = `Successful then let response = call # response_body # value in ... else (* error case *) ... *) end =========================================================== The syntax error is found between the URL and the "in". Can you take away the tomatoes from my tired eyes? ;) Ciao, Oliver