void ConnectionAdapter::onSocketRecv(const MutableBuffer& buf, const net::Address& /* peerAddr */) { TraceS(this) << "On socket recv: " << buf.size() << endl; // TraceS(this) << "On socket recv: " << buf.str() << endl; if (_parser.complete()) { // Buggy HTTP servers might send late data or multiple responses, // in which case the parser state might already be HPE_OK. // In this case we discard the late message and log the error here, // rather than complicate the app with this error handling logic. // This issue was noted using Webrick with Ruby 1.9. WarnS(this) << "Dropping late HTTP response: " << buf.str() << endl; return; } // Parse incoming HTTP messages _parser.parse(bufferCast<const char*>(buf), buf.size()); }