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

Commit5ac2d4d

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

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
@@ -291,7 +291,7 @@ namespace boost { namespace network { namespace http {
291291
Handler & handler;
292292
utils::thread_pool & thread_pool_;
293293
volatilebool headers_already_sent, first_line_already_sent, headers_in_progress, first_line_in_progress;
294-
asio::streambuf headers_buffer;
294+
asio::streambuf headers_buffer, first_line_buffer;
295295

296296
boost::recursive_mutex headers_mutex;
297297
buffer_type read_buffer_;
@@ -503,19 +503,18 @@ namespace boost { namespace network { namespace http {
503503
if (first_line_in_progress)return;
504504
first_line_in_progress =true;
505505

506-
std::vector<asio::const_buffer> buffers;
507506
typedef constants<Tag> consts;
508-
typename ostringstream<Tag>::type first_line_stream;
509-
first_line_stream
507+
first_line_buffer.consume(first_line_buffer.size());
508+
std::ostreamfirst_line_stream(&first_line_buffer);
509+
first_line_stream
510510
<<consts::http_slash() <<1<<consts::dot() <<1 <<consts::space()
511511
<< status <<consts::space() <<status_message(status)
512512
<<consts::crlf()
513+
<< std::flush
513514
;
514-
std::string first_line = first_line_stream.str();
515-
buffers.push_back(asio::buffer(first_line));
516515
asio::async_write(
517516
socket()
518-
,buffers
517+
,first_line_buffer
519518
, callback);
520519
}
521520

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp