Simple HTTP support

Jonas Drewsen jdrewsen at nospam.com
Sat Feb 26 14:42:33 PST 2011


On 25/02/11 20.31, Andrei Alexandrescu wrote:
> On 2/25/11 1:16 PM, Johannes Pfau wrote:
>> Andrei Alexandrescu wrote:
>>> On 2/25/11 8:48 AM, Jonas Drewsen wrote:
>>>> Hi,
>>>>
>>>> My first post here so I don't know if this is the right place.
>>>>
>>>> I like how phobos is coming along but really miss a HTTP client and I
>>>> think it should be a part of the standard library.
>>>>
>>>> Is anyone working on this currently?
>>>>
>>>> Any thoughts/heads-up if I decide to go ahead an implement it myself
>>>> e.g. regarding ranges and other stuff?
>>>>
>>>> Is it at all possible to get such thing accepted in phobos if someone
>>>> implemented it (and the quality is good enough)?
>>>>
>>>> Thanks
>>>> Jonas
>>>
>>> Here's what I think would be great to do:
>>>
>>> 1. A declarations module for libcurl. We'd put that in etc. You
>>> wouldn't even need to go through the review process, the need and the
>>> benefits are obvious. Nobody has had a chance to do that yet.
>>
>> I remember there was some discussion about that some time ago. Graham
>> Fawcett has a declarations module here:
>> https://github.com/gmfawcett/d-play-libcurl/blob/master/fawcett/curl.d .
>> It's not complete (only wraps the simple curl api), but it's a start.
>> I think he was even willing to contribute it to phobos, but I'm not
>> sure.
>
> Graham?

I've contacted him via github and asked it he is willing contribute it 
to phobos. It probably needs to be finished and polished but I think it 
is a good start.

>> I've been working on a webclient like api now and then, but I haven't
>> got the time right now to continue it and the code currently is a mess.
>> The biggest problem I faced is curls 'push interface', you receive all
>> data in a callback. Webclients in other languages offer a 'pull' /
>> stream like api and i couldn't find a good way to support that with
>> curl.
>
> You can do both with curl IIRC, it's a bit more work - you need is do
> the work in a separate hidden thread and use synchronization or message
> passing with client's thread.

It would also be nice with a async support using futures/deferreds. In 
most cases I think it is easier to debug single threaded async IO than 
using threads.

/Jonas



More information about the Digitalmars-d mailing list