Curl, how to recieve data.

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 18 12:19:03 PDT 2015


On Sunday, 18 October 2015 at 18:04:53 UTC, holo wrote:
> I'm trying to receive data from curl request my sample code 
> looks like that:
>
> ...
>             auto client = HTTP(endpoint ~ "?" ~ 
> canonicalQueryString);
>             client.method = HTTP.Method.get;
>             client.addRequestHeader("x-amz-date", xamztime);
>             client.addRequestHeader("Authorization", 
> authorizationHeader);
>             client.onReceive = (ubyte[] data)
>             {
>                 recievedData = data;
>                 return data.length;
>             };
>             client.perform();
>
>             return new Result(recievedData);
> ...
>
>             ubyte[] receivedData;
>
> ...
>
> but im getting only last (like from "tail" command in unix 
> systems) part of data which im expecting.
>
> How to receive and save whole data which came as feedback for 
> request? Or is there some other way to access it after usage of 
> client.perform method?

You also may try to look at 
http://vibed.org/api/vibe.http.client/requestHTTP
curl maybe a little bit hard in use.


More information about the Digitalmars-d-learn mailing list