caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Török Edwin" <edwintorok@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] https... which lib?
Date: Sun, 26 Dec 2010 11:07:05 +0200	[thread overview]
Message-ID: <4D1705B9.3060609@gmail.com> (raw)
In-Reply-To: <20101225231025.GA17456@siouxsie>

On 2010-12-26 01:10, oliver@first.in-berlin.de wrote:
> Hi,
> 
> some more questions...
> 
> On Sat, Dec 25, 2010 at 10:26:08PM +0200, Török Edwin wrote:
>> On 2010-12-25 22:21, oliver@first.in-berlin.de wrote:
>>> On Sat, Dec 25, 2010 at 07:30:21PM +0100, oliver@first.in-berlin.de wrote:
>>>> On Sat, Dec 25, 2010 at 10:07:16AM +0200, Török Edwin wrote:
>>>>> On 2010-12-25 02:44, oliver@first.in-berlin.de wrote:
>>>>>> Hi,
>>>>>>
>>>>>> AFAIK I can't use ocamlnet for https-files?!
>>>>>>
>>>>>> Which lib do I need for that?
>>>>>
>>>>> I used libcurl-ocaml for https recently.
>>>> [...]
>>>>
>>>> http://curl.haxx.se/libcurl/ocaml/
>>>>
>>>> Has a simple easy-to-start example...
>>>> ... and https works out of the box.
>>> [...]
>>>
>>> But documentation lacks....
>>>
>>> The functions seem not to have the same names as the C-counterparts...
>>>
>>> What function do I need for not getting the webpage printed to stdout,
>>> but into a string?
>>
> [...]
> 
> 
>>     connection#set_timeout Config.timeout;
>>     connection#set_followlocation true;
>>     connection#set_connecttimeout Config.connect_timeout;
> [...]
> 
> 
> The   method  set_timeout           and

See CURLOPT_TIMEOUT, I think it is timeout for entire transfer,
including DNS lookup.

> the   method  set_connecttimeout,

CURLOPT_CONNECTTIMEOUT, timeout for connect().

> what are they for and which value do they use?
> 
> I would assume to set one timeout, not two.
> 
> Is it in milli-seconds?

No, it is in seconds. See CURLOPT_TIMEOUT, if you want miliseconds use
CURLOPT_TIMEOUT_MS.

BTW I remember some curl versions having trouble with multiple threads
and timeouts, not sure if that is still the case but it is something to
keep in mind if your OCaml app is multithreaded.

> 
> 
> btw: I didn't found the docs for the OCaml-bindings of above mentioned methods.
> 
> Also in the curl-lib-binding it's mentioned that only the "easy-interface" is bound,
> but the OCaml-bindings offer much more functions than those some of the easy-interface
> (http://curl.haxx.se/libcurl/c/libcurl-easy.html => 26 functions, the mli contains a lot more) .
> So, somehow at some place the docs seem to be outdated (?).
> If you have a link to a more up-to-date documentatiopn, if this exists,
> could you sent me a link to that?!

All I have are the ocamldoc-generated ones, which don't say what each
method does, but it is not hard to guess.
For example: 'val set_timeout : t -> int -> unit' is just a convenience
function for 'setopt h CURLOPT_TIMEOUT(..)', that is curl_easy_setopt(..
CURLOPT_TIMEOUT ...). So read the docs for CURLOPT_TIMEOUT.

Similarly each function also has an OO equivalent.

> 
> Ciao,
>    Oliver
> 
> P.S.: Does the   method  set_followlocation
>       set, if that curllib-connection is follwoing a redirect?

Yes, it doesn't do that by default.

Best regards,
--Edwin

  reply	other threads:[~2010-12-26  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-25  0:44 oliver
2010-12-25  8:07 ` Török Edwin
2010-12-25 16:45   ` oliver
2010-12-25 18:30   ` oliver
2010-12-25 20:21     ` oliver
2010-12-25 20:26       ` Török Edwin
2010-12-25 20:46         ` oliver
2010-12-25 23:10         ` oliver
2010-12-26  9:07           ` Török Edwin [this message]
2010-12-25 23:38         ` oliver
2010-12-25 23:58           ` 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=4D1705B9.3060609@gmail.com \
    --to=edwintorok@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).