keybase
[m6w6/m6w6.github.io] / _posts / 2007-02-08-http-curl-and-stuff.md
1 ---
2 title: HTTP, CURL and stuff
3 author: m6w6
4 tags:
5 - PHP
6 ---
7
8 News, news, yawn.
9
10 Daniel Stenberg, head of the [cURL](http://curl.haxx.se) project,
11 [accepted](http://permalink.gmane.org/gmane.comp.web.curl.library/13439) a
12 patch for sub second time out support within libcurl. That means that you can
13 use float values as time outs with a millisecond resolution, as soon as you
14 use libcurl >= v7.16.2, that is, a minimum supported time out of 0.001 seconds
15 (which is **not** reasonable, just in case you wonder). On a side note, you
16 should build libcurl with [c-ares](http://daniel.haxx.se/projects/c-ares/) to
17 get working sub second DNS lookup time out support, AFAICT.
18
19 Clay Loveless, usually [killing people softly with his random strings](http://killersoft.com/randomstrings/),
20 [mashing up APIs](http://mashery.com) or [providing compatibility libraries](http://code.google.com/p/phttp/),
21 kindly asked me, if there were persistent connection support in
22 [pecl/http](http://pecl.php.net/package/pecl_http).
23
24 > _Is there an option in pecl_http that I'm overlooking that would be the
25 equivalent of STREAM_CLIENT_PERSISTENT?_
26
27 I was already about to answer that libcurl already does that all for us,
28 realizing that we destroy the used CURL handles at the end of each PHP request
29 at the latest, thus killing any alive connections. This happened about two
30 weeks ago, and pecl/http 1.5, of which RC1 had just been released, will
31 support per process persistent CURL handles. It can be enabled at compile time
32 only, as it's a quite intrusive feature. Yet I'm still unsure about the
33 implementation of this feature and it might change in the future to become a
34 bit more user-friendly.
35
36 To use it, there's nothing else to be done than tossing --enable-http-
37 persistent-handles at configure.
38