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
  • Loading branch information
@umennel
umennel committedMar 31, 2018
commit8bf074204ce373f88031291d25d4544da2a062f8
6 changes: 3 additions & 3 deletionsboost/network/protocol/http/client/async_impl.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,16 +41,16 @@ struct async_client
typedef std::function<bool(string_type&)> body_generator_function_type;

async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
bool remove_chunk_markers,
bool always_verify_peer, int timeout, bool remove_chunk_markers,
std::shared_ptr<boost::asio::io_service> service,
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
optional<string_type> private_key_file,
optional<string_type> ciphers,
optional<string_type> sni_hostname, long ssl_options)
: connection_base(cache_resolved, follow_redirect, timeout, remove_chunk_markers),
: connection_base(cache_resolved, follow_redirect, timeout,
remove_chunk_markers),
service_ptr(service.get() ? service
: std::make_shared<boost::asio::io_service>()),
service_(*service_ptr),
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,8 @@ struct async_connection_base {
// tag.
static connection_ptr new_connection(
resolve_function resolve, resolver_type &resolver, bool follow_redirect,
bool always_verify_peer, bool https, int timeout, bool remove_chunk_markers,
bool always_verify_peer, bool https, int timeout,
bool remove_chunk_markers,
optional<string_type> certificate_filename = optional<string_type>(),
optional<string_type> const &verify_path = optional<string_type>(),
optional<string_type> certificate_file = optional<string_type>(),
Expand All@@ -59,7 +60,8 @@ struct async_connection_base {
certificate_filename, verify_path, certificate_file, private_key_file,
ciphers, sni_hostname, ssl_options);
auto temp = std::make_shared<async_connection>(
resolver, resolve, follow_redirect, timeout, remove_chunk_markers, std::move(delegate));
resolver, resolve, follow_redirect, timeout, remove_chunk_markers,
std::move(delegate));
BOOST_ASSERT(temp != nullptr);
return temp;
}
Expand Down
24 changes: 14 additions & 10 deletionsboost/network/protocol/http/client/connection/async_normal.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,6 @@ namespace impl {

template <class Tag>
struct chunk_encoding_parser {

chunk_encoding_parser() : state(state_t::header), chunk_size(0) {}

enum state_t { header, header_end, data, data_end };
Expand All@@ -49,23 +48,27 @@ 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;
ss >> size;
chunk_size = (chunk_size << (range.size()*4)) + size;
chunk_size = (chunk_size << (range.size() *4)) + size;
}

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) {
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) {
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 All@@ -87,7 +90,8 @@ struct chunk_encoding_parser {
++iter;
state = state_t::data_end;
} else {
auto len = std::min(chunk_size, (size_t)std::distance(iter, boost::end(range)));
auto len = std::min(chunk_size,
(size_t)std::distance(iter, boost::end(range)));
begin = iter;
iter = std::next(iter, len);
pos = std::copy(begin, iter, pos);
Expand All@@ -96,7 +100,7 @@ struct chunk_encoding_parser {
break;

case state_t::data_end:
BOOST_ASSERT(*iter == '\n');
BOOST_ASSERT(*iter == '\n');
++iter;
begin = iter;
state = state_t::header;
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@@ -87,9 +87,9 @@ struct async_connection_policy : resolver_policy<Tag>::type {
std::uint16_t port, resolve_completion_function once_resolved) {
this->resolve(resolver, host, port, once_resolved);
},
resolver, boost::iequals(protocol_, string_type("https")), timeout_, remove_chunk_markers_,
certificate_filename, verify_path, certificate_file, private_key_file,
ciphers, sni_hostname, ssl_options);
resolver, boost::iequals(protocol_, string_type("https")), timeout_,
remove_chunk_markers_, certificate_filename, verify_path,
certificate_file, private_key_file,ciphers, sni_hostname, ssl_options);
}

void cleanup() {}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp