From: oliver@first.in-berlin.de
To: caml-list@inria.fr
Subject: Re: [Caml-list] Ocamlnet and sending Referrer
Date: Thu, 23 Dec 2010 14:52:28 +0100 [thread overview]
Message-ID: <20101223135228.GA3651@siouxsie> (raw)
In-Reply-To: <1293061753.22147.517.camel@thinkpad>
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
next prev parent reply other threads:[~2010-12-23 13:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-22 19:39 oliver
2010-12-22 23:20 ` oliver
2010-12-22 23:49 ` Gerd Stolpmann
2010-12-23 13:52 ` oliver [this message]
2010-12-23 19:45 ` oliver
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=20101223135228.GA3651@siouxsie \
--to=oliver@first.in-berlin.de \
--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