* [Caml-list] Ocamlnet and sending Referrer
@ 2010-12-22 19:39 oliver
2010-12-22 23:20 ` oliver
2010-12-22 23:49 ` Gerd Stolpmann
0 siblings, 2 replies; 5+ messages in thread
From: oliver @ 2010-12-22 19:39 UTC (permalink / raw)
To: caml-list
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)?
Ciao,
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Ocamlnet and sending Referrer
2010-12-22 19:39 [Caml-list] Ocamlnet and sending Referrer oliver
@ 2010-12-22 23:20 ` oliver
2010-12-22 23:49 ` Gerd Stolpmann
1 sibling, 0 replies; 5+ messages in thread
From: oliver @ 2010-12-22 23:20 UTC (permalink / raw)
To: caml-list
Is there a tutorial on Nethttp and such stuff?
This would help.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Ocamlnet and sending Referrer
2010-12-22 19:39 [Caml-list] Ocamlnet and sending Referrer oliver
2010-12-22 23:20 ` oliver
@ 2010-12-22 23:49 ` Gerd Stolpmann
2010-12-23 13:52 ` oliver
1 sibling, 1 reply; 5+ messages in thread
From: Gerd Stolpmann @ 2010-12-22 23:49 UTC (permalink / raw)
To: oliver; +Cc: caml-list
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 *)
...
Gerd
>
> Ciao,
> Oliver
> -----
> Caml-list mailing list.
> Subscription management: https://sympa-roc.inria.fr/wws/info/caml-list
> Archives: https://sympa-roc.inria.fr/wws/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>
--
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany
gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de
Phone: +49-6151-153855 Fax: +49-6151-997714
------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Ocamlnet and sending Referrer
2010-12-22 23:49 ` Gerd Stolpmann
@ 2010-12-23 13:52 ` oliver
2010-12-23 19:45 ` oliver
0 siblings, 1 reply; 5+ messages in thread
From: oliver @ 2010-12-23 13:52 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Ocamlnet and sending Referrer
2010-12-23 13:52 ` oliver
@ 2010-12-23 19:45 ` oliver
0 siblings, 0 replies; 5+ messages in thread
From: oliver @ 2010-12-23 19:45 UTC (permalink / raw)
To: caml-list
On Thu, Dec 23, 2010 at 02:52:28PM +0100, oliver@first.in-berlin.de wrote:
[...]
>
> Hmhhh
>
> strange, I get syntax errors with the following:
It's not strange.
Strange is that I didn't saw the problem ;)
>
> ===========================================================
> 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";
[...]
Inside that module call it at toplevel, and therefore the "in" is nonsense
of course, or I had to encapsulate that stuff inside a function.
So, thanks Gerd for hinting me to the Pipeline-stuff,
and sorry for the traffic.
Ciao,
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-12-23 19:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22 19:39 [Caml-list] Ocamlnet and sending Referrer oliver
2010-12-22 23:20 ` oliver
2010-12-22 23:49 ` Gerd Stolpmann
2010-12-23 13:52 ` oliver
2010-12-23 19:45 ` oliver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox