forked fromglynos/cpp-netlib
- Notifications
You must be signed in to change notification settings - Fork425
Introduced new chunked transfer encoding parser to remove chunk markers#720
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
673b853 Introduced new chunked transfer encoding parser to remove chunk marke…
umennelc4d758a Applied new remove chunk markers option to tests.
umennele9bf5f7 Nicer formatting
umennel9586a81 Use strongly typed enum.
umennelc70f774 Clarified and commented expression.
umennelff5c7c8 Removed commented lines.
umennel192d520 Nicer formatting and clean ups
umennelFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Nicer formatting
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commite9bf5f7402664c1ae1673d31f1e59f4c10c7cb79
There are no files selected for viewing
6 changes: 3 additions & 3 deletionsboost/network/protocol/http/client/async_impl.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletionsboost/network/protocol/http/client/connection/async_base.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
24 changes: 14 additions & 10 deletionsboost/network/protocol/http/client/connection/async_normal.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 }; | ||
| ||
| @@ -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; | ||
| std::stringstream ss; | ||
| ss << std::hex << range; | ||
| size_t size; | ||
| ss >> 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) { | ||
| auto iter = boost::begin(range); | ||
| auto begin = iter; | ||
| auto pos = boost::begin(buffer); | ||
| 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)); | ||
| @@ -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))); | ||
| begin = iter; | ||
| iter = std::next(iter, len); | ||
| pos = std::copy(begin, iter, pos); | ||
| @@ -96,7 +100,7 @@ struct chunk_encoding_parser { | ||
| break; | ||
| case state_t::data_end: | ||
| BOOST_ASSERT(*iter == '\n'); | ||
| ++iter; | ||
| begin = iter; | ||
| state = state_t::header; | ||
6 changes: 3 additions & 3 deletionsboost/network/protocol/http/policies/async_connection.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.