The HTTP request processing code was expecting that the http response state would be `deferred` after a call to an HTTP handler that deferred the response. If, in addition to deferring, you also sent the response the HTTP state advanced past `deferred` to `response_written`. This doesn't easily show up in unit tests because the bug requires that the async write still be in flight and the connection still be open when the HTTP handler returns. An asynchronous network transport (like Asio) combined with a sufficiently large message that Asio yields control back to WebSocket++ before the response is fully written will trigger a second write on the same connection while the first is in flight. This is not allowed per the Asio spec and results in undefined behavior. The HTTP request processing code now checks if the http state is init, i.e. not deferred and no response has been started rather than just if it was deferred.
WebSocket++ (0.7.x-dev)
WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol. It allows integrating WebSocket client and server functionality into C++ programs. It uses interchangeable network transport modules including one based on raw char buffers, one based on C++ iostreams, and one based on Asio (either via Boost or standalone). End users can write additional transport policies to support other networking or event libraries as needed.
Major Features
- Full support for RFC6455
- Partial support for Hixie 76 / Hybi 00, 07-17 draft specs (server only)
- Message/event based interface
- Supports secure WebSockets (TLS), IPv6, and explicit proxies.
- Flexible dependency management (C++11 Standard Library or Boost)
- Interchangeable network transport modules (raw, iostream, Asio, or custom)
- Portable/cross platform (Posix/Windows, 32/64bit, Intel/ARM/PPC)
- Thread-safe
Get Involved
Project Website http://www.zaphoyd.com/websocketpp/
User Manual http://www.zaphoyd.com/websocketpp/manual/
GitHub Repository https://github.com/zaphoyd/websocketpp/
GitHub pull requests should be submitted to the develop branch.
Announcements Mailing List http://groups.google.com/group/websocketpp-announcements/
IRC Channel #websocketpp (freenode)
Discussion / Development / Support Mailing List / Forum http://groups.google.com/group/websocketpp/
Author
Peter Thorson - websocketpp@zaphoyd.com
