Am 26.06.2013 13:58, schrieb Colin Grogan:> Hi,

Im getting this error on the second request being sent by a single HTTPClient.

My code is as follows:

HTTPClient client = connectHTTP(server, "80", false);

auto res1 = client.request(
    (scope req){
        req.method=HTTPMethod.POST;
        req.requestURL = "loginform?username="~name~"&password=passw0rd";
    }
);
(...)

The issue caused by not reading the response body of res1 before using the same HTTP connection to make the second request. A call to res1.dropBody() should fix that. I would, however, recommend to use the other overload of request, which takes two callbacks instead of cone. It automatically drops the body if it wasn't fully read before returning.

You can also simplify the code by using requestHTTP instead of manually creating a HTTPClient. That will also avoid such interleaved requests by returning a new connection if all existing ones are still in use.