Curl wrapper round two

jdrewsen jdrewsen at nospam.com
Tue Jun 21 13:11:42 PDT 2011


Den 21-06-2011 02:52, Jose Armando Garcia skrev:
> On Mon, Jun 20, 2011 at 8:33 PM, jdrewsen<jdrewsen at nospam.com>  wrote:
>> Den 18-06-2011 22:36, jdrewsen skrev:
>>>
>>> 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've made the changes as suggested from your comments and pushed to the
>> github branch above.
>>
>> Changes:
>>
>> * Change and delete individual headers when using static convenience methods
>> * Make keep-alive work when using static convenience methods
>> * Add as extra modifiable parameters on follow requests (keep-alive):
>> headers, method, url, postData
>> * Add verbose property to Protocol
>> * No dummy bool in constructors
>>
>> Comments are welcome
>>
>> /Jonas
>>
>
> Hi Jonas,
>
> Was reading your implementation but I had to context switch. Only go
> to line 145 :(. I see that you are refcounting by sharing a uint* but
> what about all the other private fields? What happens if you pass the
> Curl object around functions and those values are modified?
>
> Thanks,
> -Jose

The refcounting is actually just needed to keep the "handle" alive under 
construction of the Curl object using "Curl()". I'm using "Curl()" by 
defining opCall on Curl in order not to have a struct constructor with a 
dummy parameter (structs cannot have a default constructor defined).

After that the Curl instance will always be assigned to a member 
variable of Http/Ftp classes. Instances of Http/Ftp are not to be copied 
because they are used for RAII.

I hope this makes sense.

Maybe I should look for another solution for this since it might be too 
difficult to figure out for the uninitiated.

/Jonas


More information about the Digitalmars-d mailing list