Re: library(http/http_client) with https URLs
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 07/18/2013 07:32 AM, Michael Hendricks wrote:
> Is it possible to use http_get/3 and http_post/4 with https URLs? I've
> used them successfully with http URLs, but attempts with https produce
> results like these:
>
> 1 ?- use_module(library(http/http_client)).
> true.
> 2 ?- use_module(library(http/http_ssl_plugin)).
> true.
> 3 ?- http_get('https://encrypted.google.com', Reply, []).
> false.
> 4 ?- http_get('https://encrypted.google.com:443', Reply, []).
> ERROR: Unknown error term: syntax(http_reply_header,end_of_file)
>
> I'm able to make GET requests using http_open/3 but would really like to
> use http_client's pleasant interface.
>
> I thought I'd seen discussion about this on the mailing list before, but
> can't seem to find it now. This is SWI-Prolog version 6.3.19 on OS X 10.8.4
I consider http_get/3 a bit of a wrong interface design. The http_open/3
interface is generally more versatile and easier to use (IMO). The SSL
plugin was never used by http_get/3. It shouldn't be too hard to do so,
so if you prefer that interface I'd recommend a bit of hacking and
submitting a patch.
As a long term development, I'd like to extend http_open/3 with keep-alive
support using the `range stream' of the HTTP package as a means to deal with
the content-length. Ideally, one could then layer the http_get/3 and
http_post/4 interfaces on top of the http_open/3 one.
None of this is really hard. Its not on my shortlist either, so if you want
to see this happen ... I think you know the answer.
Cheers --- Jan