Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3b28e1e

Browse files
committed
Fixed http::async_connection::write_first_line()
Use persistent buffer for boost::asio::async_write
1 parent5253bac commit3b28e1e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎boost/network/protocol/http/server/async_connection.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ namespace boost { namespace network { namespace http {
289289
Handler & handler;
290290
utils::thread_pool & thread_pool_;
291291
volatilebool headers_already_sent, first_line_already_sent, headers_in_progress, first_line_in_progress;
292-
asio::streambuf headers_buffer;
292+
asio::streambuf headers_buffer, first_line_buffer;
293293

294294
boost::recursive_mutex headers_mutex;
295295
buffer_type read_buffer_;
@@ -525,19 +525,18 @@ namespace boost { namespace network { namespace http {
525525
if (first_line_in_progress)return;
526526
first_line_in_progress =true;
527527

528-
std::vector<asio::const_buffer> buffers;
529528
typedef constants<Tag> consts;
530-
typename ostringstream<Tag>::type first_line_stream;
531-
first_line_stream
529+
first_line_buffer.consume(first_line_buffer.size());
530+
std::ostreamfirst_line_stream(&first_line_buffer);
531+
first_line_stream
532532
<<consts::http_slash() <<1<<consts::dot() <<1 <<consts::space()
533533
<< status <<consts::space() <<status_message(status)
534534
<<consts::crlf()
535+
<< std::flush
535536
;
536-
std::string first_line = first_line_stream.str();
537-
buffers.push_back(asio::buffer(first_line));
538537
asio::async_write(
539538
socket()
540-
,buffers
539+
,first_line_buffer
541540
, callback);
542541
}
543542

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp