Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Simple HTTPS client example?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-04 (17:27)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] Simple HTTPS client example?
Am Dienstag, den 04.09.2007, 09:18 -0700 schrieb Dave Benjamin:
> Gerd Stolpmann wrote:
> > Am Montag, den 03.09.2007, 21:32 -0700 schrieb Dave Benjamin:
> >> Has anyone written any code to use Ocamlnet to retrieve a URL using 
> >> HTTPS? I'm looking at Uq_ssl and Http_client, but can't seem to find a 
> >> way to fit them together.
> > 
> > There is no easy way to do so.
> Well, is there a difficult way to do so? Any idea what that way might be? =)

Yes. Change Http_client so it can make use of Uq_ssl. This is, however,
not so easy.

> Otherwise, it seems like it ought to be possible at least to use a proxy 
> like squid to relay the request. However, even with proxy enabled, I get 

A proxy doesn't work here, because encryption is end-to-end. What you
need is a tunnel endpoint like stunnel. I think that a few changes of
Http_client are still necessary since there is currently no way to
inject an already connected socket into it.

> this error:
> 	Exception: Failure "Http_client: bad URL".
> whenever there is an "https" as the protocol. It looks like subclassing 
> the call class and overriding set_request_uri to accept HTTPS URLs would 
> at least make that error go away, but then something additional would 
> need to be done to keep track of the protocol when it's time to send it 
> to the proxy...

I guess this is the simplest part of the change.

Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
Phone: +49-6151-153855                  Fax: +49-6151-997714