11
11
12
12
#include < iterator>
13
13
#include < cstdint>
14
- #include < iostream>
15
14
#include < boost/algorithm/string/trim.hpp>
16
15
#include < boost/asio/steady_timer.hpp>
17
16
#include < boost/asio/placeholders.hpp>
@@ -48,10 +47,10 @@ struct chunk_encoding_parser {
48
47
size_t chunk_size;
49
48
std::array<typename char_<Tag>::type, 1024 > buffer;
50
49
51
- void update_chunk_size (boost::iterator_range< typename std::array<
52
- typename char_<Tag>::type, 1024 >::const_iterator> const &range) {
53
- if ( range. empty ())
54
- return ;
50
+ void update_chunk_size (
51
+ boost::iterator_range< typename std::array<
52
+ typename char_<Tag>::type, 1024 >::const_iterator> const & range) {
53
+ if (range. empty ()) return ;
55
54
std::stringstream ss;
56
55
ss << std::hex << range;
57
56
size_t size;
@@ -61,15 +60,15 @@ struct chunk_encoding_parser {
61
60
}
62
61
63
62
boost::iterator_range<
64
- typename std::array<typename char_<Tag>::type, 1024 >::const_iterator>
65
- operator ()(boost::iterator_range<typename std::array<
66
- typename char_<Tag>::type, 1024 >::const_iterator> const &range) {
63
+ typename std::array<typename char_<Tag>::type, 1024 >::const_iterator>
64
+ operator ()(
65
+ boost::iterator_range<typename std::array<
66
+ typename char_<Tag>::type, 1024 >::const_iterator> const &range) {
67
67
auto iter = boost::begin (range);
68
68
auto begin = iter;
69
69
auto pos = boost::begin (buffer);
70
70
71
- while (iter != boost::end (range))
72
- switch (state) {
71
+ while (iter != boost::end (range)) switch (state) {
73
72
case state_t ::header:
74
73
iter = std::find (iter, boost::end (range), ' \r ' );
75
74
update_chunk_size (boost::make_iterator_range (begin, iter));
@@ -479,19 +478,22 @@ struct http_async_connection
479
478
string_type body_string;
480
479
if (this ->is_chunk_encoding && remove_chunk_markers_) {
481
480
for (size_t i = 0 ; i < this ->partial_parsed .size (); i += 1024 ) {
482
- auto range = parse_chunk_encoding (
483
- boost::make_iterator_range (this ->partial_parsed .data () + i,
484
- this ->partial_parsed .data () + std::min (i+1024 , this ->partial_parsed .size ())));
481
+ auto range = parse_chunk_encoding (boost::make_iterator_range (
482
+ this ->partial_parsed .data () + i,
483
+ this ->partial_parsed .data () +
484
+ std::min (i + 1024 , this ->partial_parsed .size ())));
485
485
body_string.append (boost::begin (range), boost::end (range));
486
486
}
487
487
this ->partial_parsed .clear ();
488
- auto range = parse_chunk_encoding (boost::make_iterator_range (this ->part .begin (),
489
- this ->part .begin () + bytes_transferred));
488
+ auto range = parse_chunk_encoding (boost::make_iterator_range (
489
+ this ->part .begin (),
490
+ this ->part .begin () + bytes_transferred));
490
491
body_string.append (boost::begin (range), boost::end (range));
491
492
this ->body_promise .set_value (body_string);
492
493
} else {
493
494
std::swap (body_string, this ->partial_parsed );
494
- body_string.append (this ->part .begin (), this ->part .begin () + bytes_transferred);
495
+ body_string.append (this ->part .begin (),
496
+ this ->part .begin () + bytes_transferred);
495
497
this ->body_promise .set_value (body_string);
496
498
}
497
499
}
0 commit comments