On Sunday, 18 October 2015 at 20:12:42 UTC, sigod wrote:
On Sunday, 18 October 2015 at 20:05:24 UTC, holo wrote:
@sigod

Actually im working on ec2 requests. Thank you for help, it is working right now. I don't know why i was trying "+=" before instead of "~=". Is it good solution to make it such way?

Not really as it will trigger allocation on every call. Better use [`Appender`][0].

[0]: http://dlang.org/phobos/std_array.html#.Appender

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.

Reply via email to