ipkn/crow — pull request #23 by acron0 (2014-09-13 18:21:31+00:00)
Title: Fixed a bug in which response objects believed they were completed when they weren't.

I noticed, when doing quick requests to the same endpoint, that the body was only delivered *every other* request. I verified this by first tracking the request in the browser network tools, then by adding size checking to the response object. I narrowed it down to a condition that was being skipped here:

https://github.com/ipkn/crow/blob/master/include/http_connection.h#L204

I have tracked this down to a logic error in which the response `clear()` is called by the `complete_request_handler_` callback, only to have the `completed_` boolean set back to `true` once the callback returns.

The fix moves the assignment to before the completion callback. The problem is no longer observable, but the flow is still questionable, where the boolean is assigned and then immediately cleared.