Curl wrapper round two

Johannes Pfau spam at example.com
Sun Jun 19 02:08:30 PDT 2011


jdrewsen wrote:
>Hi,
>
>    I've finally got through all the very constructive comments from
> the 
>last review of the curl wrapper and performed the needed changes.
>
>Here is the github branch:
>https://github.com/jcd/phobos/tree/curl-wrapper
>
>And the generated docs:
>http://freeze.steamwinter.com/D/web/phobos/etc_curl.html
>
>I do have some problems getting ddoc to show the documentation of 
>mixins. So in order to view the doc for byLine/byChunk methods you
>have to look at the source.

That's bad because lots of useful stuff hides in the protocol mixin.
The url property for example is essential for keep-alive requests, but
it doesn't show up in the documentation :-(

Also, a keep alive example would be great:
--------------------------------------------
auto client = Http("http://api.vevo.com/mobile/v2/authentication.json");
client.addHeader("User-Agent", "Android API Connector");
client.addHeader("Connection", "Keep-Alive");
client.method = Http.Method.post;
client.onReceive = (ubyte[] data) { write(cast(char[])data); return
data.length; };
client.postData = "p=android&v=1.05";
client.perform();

//2nd request
client.url = "http://api.vevo.com/mobile/v1/featured/carousel.json";
client.method = Http.Method.get;
client.perform();
--------------------------------------------
Maybe something like this. (+points if the code uses existing
websites)

BTW: The curl verbose output is great. I guess it won't
be activated in phobos by default, but is it possible to activate it
manually? If so, this very useful feature should be documented.

-- 
Johannes Pfau



More information about the Digitalmars-d mailing list