Skip to content

Commit

Permalink
Fixing the issue with handshake_fail when the test would crash occasi…
Browse files Browse the repository at this point in the history
…onally.
  • Loading branch information
Ognjen Sobajic committed Oct 11, 2013
1 parent d2c6892 commit 96489f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Release/include/cpprest/http_linux_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ class connection
void handle_chunked_body(const boost::system::error_code& ec, int toWrite);
void dispatch_request_to_listener();
void request_data_avail(size_t size);
void do_response(bool bad_reqiest=false);
void do_response(bool bad_request=false);
template <typename ReadHandler>
void async_read_until_buffersize(size_t size, ReadHandler handler);
void async_process_response(http_response response);
void cancel_sending_response_with_error(http_response response, std::exception_ptr);
void cancel_sending_response_with_error(http_response response, std::exception_ptr);
void handle_headers_written(http_response response, const boost::system::error_code& ec);
void handle_write_large_response(http_response response, const boost::system::error_code& ec);
void handle_write_chunked_response(http_response response, const boost::system::error_code& ec);
Expand Down
23 changes: 11 additions & 12 deletions Release/src/http/listener/http_linux_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ void connection::handle_http_line(const boost::system::error_code& ec)
else if (boost::iequals(http_verb, http::methods::CONNECT)) http_verb = http::methods::CONNECT;
else if (boost::iequals(http_verb, http::methods::OPTIONS)) http_verb = http::methods::OPTIONS;

// Check to see if there is not allowed character on the input

// Check to see if there is not allowed character on the input
if (!web::http::details::validate_method(http_verb))
{
m_request.reply(status_codes::BadRequest);
m_close = true;
do_response(true);
finish_request_response();
return;
}

Expand Down Expand Up @@ -443,15 +442,15 @@ void connection::do_response(bool bad_request)
}
// before sending response, the full incoming message need to be processed.
if (bad_request)
{
async_process_response(response);
}
else
{
m_request.content_ready().then([=](pplx::task<http::http_request>) {
async_process_response(response);
});
}
{
async_process_response(response);
}
else
{
m_request.content_ready().then([=](pplx::task<http::http_request>) {
async_process_response(response);
});
}
});
}

Expand Down

0 comments on commit 96489f2

Please sign in to comment.