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

Commit0e91891

Browse files
committed
fix content_length parse error
1 parentbcdca47 commit0e91891

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎boost/network/protocol/http/client/connection/async_protocol_handler.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,15 @@ struct http_async_protocol_handler {
270270
}
271271
trim(header_pair.second);
272272
headers.insert(header_pair);
273-
if (boost::iequals(header_pair.first,"Content-Length")) {
274-
is_content_length =true;
275-
content_length =std::stoi(header_pair.second);
273+
if (!is_content_length &&
274+
boost::iequals(header_pair.first,"Content-Length")) {
275+
try {
276+
content_length =std::stoll(header_pair.second);
277+
is_content_length =true;
278+
}
279+
catch (std::exception&) {
280+
//is_content_length = false;
281+
}
276282
}
277283
}
278284
// determine if the body parser will need to handle chunked encoding
@@ -410,7 +416,7 @@ struct http_async_protocol_handler {
410416
bool is_chunk_encoding;
411417
bool is_chunk_end;
412418
bool is_content_length;
413-
std::size_t content_length;
419+
longlong content_length;
414420
};
415421

416422
}// namespace impl

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp