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

Commit4303c44

Browse files
committed
Merge pull request#418 from leecoder/0.11-devel
Fixing for abnormal response
2 parents3bc6f9d +ea81be2 commit4303c44

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

‎boost/network/protocol/http/parser/incremental.hpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ namespace boost { namespace network { namespace http {
228228
if (*current ==':') {
229229
state_ = http_header_colon;
230230
++current;
231+
}elseif (*current =='\r') {
232+
state_ = http_header_line_cr;
233+
++current;
234+
}elseif (*current =='\n') {
235+
state_ = http_header_line_done;
236+
++current;
231237
}elseif (algorithm::is_alnum()(*current) ||algorithm::is_space()(*current) ||algorithm::is_punct()(*current)) {
232238
++current;
233239
}else {

‎libs/network/test/http/response_incremental_parser_test.cpp‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,5 +348,30 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, eol_ty
348348
valid_headers);
349349
BOOST_CHECK_EQUAL(parsed_ok,true);
350350
BOOST_CHECK(parsed1 != parsed2);
351+
352+
p.reset(response_parser_type::http_status_message_done);
353+
valid_headers ="Content-Type: text/html;" + eol::literal +"charset=utf-8" + eol::literal + eol::literal;
354+
fusion::tie(parsed_ok, result_range) = p.parse_until(
355+
response_parser_type::http_header_line_done,
356+
valid_headers);
357+
BOOST_CHECK_EQUAL(parsed_ok,true);
358+
parsed1 =std::string(boost::begin(result_range),boost::end(result_range));
359+
std::cout <<"PARSED:" << parsed1 <<" state=" << p.state() << std::endl;
360+
p.reset(response_parser_type::http_status_message_done);
361+
end = valid_headers.end();
362+
valid_headers.assign(boost::end(result_range), end);
363+
fusion::tie(parsed_ok, result_range) = p.parse_until(
364+
response_parser_type::http_header_line_done,
365+
valid_headers);
366+
BOOST_CHECK_EQUAL(parsed_ok,true);
367+
parsed2 =std::string(boost::begin(result_range),boost::end(result_range));
368+
std::cout <<"PARSED:" << parsed2 <<" state=" << p.state() << std::endl;
369+
valid_headers.assign(boost::end(result_range), end);
370+
p.reset(response_parser_type::http_status_message_done);
371+
fusion::tie(parsed_ok, result_range) = p.parse_until(
372+
response_parser_type::http_headers_done,
373+
valid_headers);
374+
BOOST_CHECK_EQUAL(parsed_ok,true);
375+
BOOST_CHECK(parsed1 != parsed2);
351376
}
352377

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp