Curl wrapper

Jonas Drewsen jdrewsen at nospam.com
Tue May 17 00:29:25 PDT 2011


On 17/05/11 02.43, dsimcha wrote:
> == Quote from jdrewsen (jdrewsen at nospam.com)'s article
>> Hi,
>>      I've been working on a wrapper for the etc.c.curl module. It is now
>> pretty stable and I would very much like some feedback on the API.
>> http://freeze.steamwinter.com/D/web/phobos/etc_curl.html
>> BTW I use template mixins which doesn't seem to get included in the
>> generated docs. Is there any way I can make this work?
>> /Jonas
>
> This looks very good and I'd definitely be in favor of including it in the next
> release.  However, there are a few small issues:
>
> 1.  In the docs for Http, I don't think you need to say "Do not use the same
> instance in two threads simultaneously."  I think this is pretty much common
> sense.  Same with the Ftp class.

I included it because the libcurl handle used in a HTTP instance is not 
thread safe itself.

What if I instantiated a shared instance of this class. Wouldn't that 
make the comment relevant in that access to the internal libcurl handle 
is not protected by mutexes?

> 2.  A short overview of the asynch stuff at the top of the file would be nice.
> I'm a little confused about what it's for and when to use it instead of the
> regular synchronous functions.  Does this allow you to process the beginning of a
> request while the end is still being received?

Exactly. I'll add the missing overview.

> 3.  I don't think you need to say how all the convenience functions are
> implemented, i.e. "Internally this is implemented using an instance of the Http
> class."  This is both likely to be assumed and an irrelevant implementation detail.

You're right.

> Overall, nice work.

Thank you for the feedback!


More information about the Digitalmars-d mailing list