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

Cherry picked relevant chunked transfer encoding commits from master#833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Nicer formatting and clean ups
  • Loading branch information
@umennel
umennel committedMar 31, 2018
commit76b4ebf31c718b434330e2187cf4f28163656ef7
34 changes: 18 additions & 16 deletionsboost/network/protocol/http/client/connection/async_normal.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,6 @@

#include <iterator>
#include <cstdint>
#include <iostream>
#include <boost/algorithm/string/trim.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/placeholders.hpp>
Expand DownExpand Up@@ -48,10 +47,10 @@ struct chunk_encoding_parser {
size_t chunk_size;
std::array<typename char_<Tag>::type, 1024> buffer;

void update_chunk_size(boost::iterator_range<typename std::array<
typename char_<Tag>::type, 1024>::const_iterator> const &range) {
if (range.empty())
return;
void update_chunk_size(
boost::iterator_range<typename std::array<
typename char_<Tag>::type, 1024>::const_iterator> const &range) {
if (range.empty()) return;
std::stringstream ss;
ss << std::hex << range;
size_t size;
Expand All@@ -61,15 +60,15 @@ struct chunk_encoding_parser {
}

boost::iterator_range<
typename std::array<typename char_<Tag>::type, 1024>::const_iterator>
operator()(boost::iterator_range<typename std::array<
typename char_<Tag>::type, 1024>::const_iterator> const &range) {
typename std::array<typename char_<Tag>::type, 1024>::const_iterator>
operator()(
boost::iterator_range<typename std::array<
typename char_<Tag>::type, 1024>::const_iterator> const &range) {
auto iter = boost::begin(range);
auto begin = iter;
auto pos = boost::begin(buffer);

while (iter != boost::end(range))
switch (state) {
while (iter != boost::end(range)) switch (state) {
case state_t::header:
iter = std::find(iter, boost::end(range), '\r');
update_chunk_size(boost::make_iterator_range(begin, iter));
Expand DownExpand Up@@ -485,19 +484,22 @@ struct http_async_connection
string_type body_string;
if (this->is_chunk_encoding && remove_chunk_markers_) {
for (size_t i = 0; i < this->partial_parsed.size(); i += 1024) {
auto range = parse_chunk_encoding(
boost::make_iterator_range(this->partial_parsed.data() + i,
this->partial_parsed.data() + std::min(i+1024, this->partial_parsed.size())));
auto range = parse_chunk_encoding(boost::make_iterator_range(
this->partial_parsed.data() + i,
this->partial_parsed.data() +
std::min(i + 1024, this->partial_parsed.size())));
body_string.append(boost::begin(range), boost::end(range));
}
this->partial_parsed.clear();
auto range = parse_chunk_encoding(boost::make_iterator_range(this->part.begin(),
this->part.begin() + bytes_transferred));
auto range = parse_chunk_encoding(boost::make_iterator_range(
this->part.begin(),
this->part.begin() + bytes_transferred));
body_string.append(boost::begin(range), boost::end(range));
this->body_promise.set_value(body_string);
} else {
std::swap(body_string, this->partial_parsed);
body_string.append(this->part.begin(), this->part.begin() + bytes_transferred);
body_string.append(this->part.begin(),
this->part.begin() + bytes_transferred);
this->body_promise.set_value(body_string);
}
}
Expand Down
6 changes: 3 additions & 3 deletionsboost/network/protocol/http/policies/async_connection.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,9 +49,9 @@ struct async_connection_policy : resolver_policy<Tag>::type {
optional<string_type> const& sni_hostname, long ssl_options) {
pimpl = impl::async_connection_base<Tag, version_major, version_minor>::
new_connection(resolve, resolver, follow_redirect, always_verify_peer,
https, timeout, remove_chunk_markers, certificate_filename,
verify_path, certificate_file, private_key_file, ciphers,
sni_hostname, ssl_options);
https, timeout, remove_chunk_markers,
certificate_filename, verify_path, certificate_file,
private_key_file, ciphers,sni_hostname, ssl_options);
}

basic_response<Tag> send_request(string_type /*unused*/ const& method,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp