Skip to content

Conversation

@deanberris
Copy link
Member

This changes the example file server to use the read handler for
POST/PUT requests. This currently assumes that there's a content-length
header (not much error handling is happening here, but it's meant as a
proof of concept anyway).

Using this code path in an example should be good enough for the moment
until we have better tests and a better API for this functionality.

This changes the example file server to use the read handler for
POST/PUT requests. This currently assumes that there's a content-length
header (not much error handling is happening here, but it's meant as a
proof of concept anyway).

Using this code path in an example should be good enough for the moment
until we have better tests and a better API for this functionality.
@deanberris
Copy link
Member Author

References #635 -- looking for reviewers and people to try it out.

@glynos glynos merged commit ec08b28 into cpp-netlib:0.12-release Apr 19, 2016
return;
}

auto self = this->shared_from_this();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need self here anymore, since it is not used in the lambda (can also be removed from the capture section of the lambda).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this "self" variable makes sure that the object is alive -- it ensures that there's a shared reference in the callback that depends on the state of the connection. It's a trick that's tied to how asynchronous programming is really hard to debug. 😀

@deanberris deanberris deleted the topic/fix-async-server branch April 20, 2016 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants