Skip to content

Commit 96489f2

Browse files
author
Ognjen Sobajic
committed
Fixing the issue with handshake_fail when the test would crash occasionally.
1 parent d2c6892 commit 96489f2

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

Release/include/cpprest/http_linux_server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ class connection
9696
void handle_chunked_body(const boost::system::error_code& ec, int toWrite);
9797
void dispatch_request_to_listener();
9898
void request_data_avail(size_t size);
99-
void do_response(bool bad_reqiest=false);
99+
void do_response(bool bad_request=false);
100100
template <typename ReadHandler>
101101
void async_read_until_buffersize(size_t size, ReadHandler handler);
102102
void async_process_response(http_response response);
103-
void cancel_sending_response_with_error(http_response response, std::exception_ptr);
103+
void cancel_sending_response_with_error(http_response response, std::exception_ptr);
104104
void handle_headers_written(http_response response, const boost::system::error_code& ec);
105105
void handle_write_large_response(http_response response, const boost::system::error_code& ec);
106106
void handle_write_chunked_response(http_response response, const boost::system::error_code& ec);

Release/src/http/listener/http_linux_server.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,12 @@ void connection::handle_http_line(const boost::system::error_code& ec)
140140
else if (boost::iequals(http_verb, http::methods::CONNECT)) http_verb = http::methods::CONNECT;
141141
else if (boost::iequals(http_verb, http::methods::OPTIONS)) http_verb = http::methods::OPTIONS;
142142

143-
// Check to see if there is not allowed character on the input
144-
143+
// Check to see if there is not allowed character on the input
145144
if (!web::http::details::validate_method(http_verb))
146145
{
147146
m_request.reply(status_codes::BadRequest);
147+
m_close = true;
148148
do_response(true);
149-
finish_request_response();
150149
return;
151150
}
152151

@@ -443,15 +442,15 @@ void connection::do_response(bool bad_request)
443442
}
444443
// before sending response, the full incoming message need to be processed.
445444
if (bad_request)
446-
{
447-
async_process_response(response);
448-
}
449-
else
450-
{
451-
m_request.content_ready().then([=](pplx::task<http::http_request>) {
452-
async_process_response(response);
453-
});
454-
}
445+
{
446+
async_process_response(response);
447+
}
448+
else
449+
{
450+
m_request.content_ready().then([=](pplx::task<http::http_request>) {
451+
async_process_response(response);
452+
});
453+
}
455454
});
456455
}
457456

0 commit comments

Comments
 (0)