Curl, how to recieve data.

sigod via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 18 14:11:56 PDT 2015


On Sunday, 18 October 2015 at 21:01:05 UTC, holo wrote:
> On Sunday, 18 October 2015 at 20:12:42 UTC, sigod wrote:
>> [...]
>
> I changed it to such code:
>
> ...
>             auto client = HTTP(endpoint ~ "?" ~ 
> canonicalQueryString);
>             client.method = HTTP.Method.get;
>             client.addRequestHeader("x-amz-date", xamztime);
>             client.addRequestHeader("Authorization", 
> authorizationHeader);
>             client.onReceive = (ubyte[] 
> data){receivedData.put(data); return data.length;};
>             client.perform();
>
>             return new Result(receivedData.data);
> ...
>      auto receivedData = appender!string();
> ...
>
> and it is really much more faster than it was - hope it is what 
> you had on your mind.

Yes, this is exactly what I meant.


More information about the Digitalmars-d-learn mailing list