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

Refactored HTTP client v2.#476

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
deanberris merged 17 commits intocpp-netlib:masterfromglynos:master
Jan 2, 2015
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
17 commits
Select commitHold shift + click to select a range
0b49d2b
Added a facility to track upload/download progress.
glynosFeb 16, 2014
1bc435b
Removed ssl_connection from client.
glynosFeb 17, 2014
2b1c0e2
Added transfer direction callback.
glynosMar 23, 2014
d00f99f
Renamed request_helper as request_context.
glynosMar 23, 2014
47ced49
Updated uri submodule.
glynosMar 26, 2014
03dddb2
Removed noexcept from destructors; added some flags for chunked trans…
glynosApr 12, 2014
ccebaeb
Formatted source code and add source comments.
glynosMay 11, 2014
ad273ec
Added some comments; fixed tests so that they compile for Boost.Optio…
glynosSep 10, 2014
862263d
Updated uri submodule.
glynosSep 10, 2014
4f2f0e2
Formatted files with clang-format.
glynosSep 10, 2014
907a176
Updated uri submodule.
glynosSep 21, 2014
ff5f714
Merge remote-tracking branch 'upstream/master'
glynosDec 19, 2014
4e0add7
Use std::unique_ptr for pimpl idiom in HTTP client.
glynosDec 24, 2014
6771a55
Added connection timeout check to HTTP client.
glynosDec 24, 2014
50f3a4c
Fixed bug in error handling in the HTTP client.
glynosDec 24, 2014
e2da305
Minor refactoring in the HTTP client.
glynosDec 24, 2014
42ab79d
Simplified the HTTP client, request and response classes.
glynosDec 25, 2014
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
Fixed bug in error handling in the HTTP client.
  • Loading branch information
@glynos
glynos committedDec 24, 2014
commit50f3a4c3218dcbd941373eb02b86d8c4b6f8b539
14 changes: 12 additions & 2 deletionshttp/src/http/v2/client/client.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -99,7 +99,6 @@ namespace network {
boost::asio::io_service::strand strand_;
std::unique_ptr<client_connection::async_resolver> resolver_;
std::shared_ptr<client_connection::async_connection> mock_connection_;
// TODO configure deadline timer for timeouts
bool timedout_;
boost::asio::deadline_timer timer_;
std::thread lifetime_thread_;
Expand DownExpand Up@@ -409,6 +408,16 @@ namespace network {
const boost::system::error_code &ec, std::size_t bytes_read,
std::shared_ptr<request_context> context,
std::shared_ptr<response> res) {
if (timedout_) {
set_error(boost::asio::error::timed_out, context);
return;
}

if (ec && ec != boost::asio::error::eof) {
set_error(ec, context);
return;
}

// update progress.
context->total_bytes_read_ += bytes_read;
if (auto progress = context->options_.progress()) {
Expand All@@ -425,8 +434,9 @@ namespace network {

std::istream is(&context->response_buffer_);
string_type line;
line.reserve(bytes_read);
while (!getline_with_newline(is, line).eof()) {
res->append_body(line);
res->append_body(std::move(line));
}

// Keep reading the response body until we have nothing else to read.
Expand Down
4 changes: 2 additions & 2 deletionshttp/src/network/http/v2/client/response.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -166,8 +166,8 @@ class response {
* \param name The header name.
* \param value The header value.
*/
void add_header(conststring_type&name,conststring_type&value) {
headers_.push_back(std::make_pair(name, value));
void add_header(string_type name, string_type value) {
headers_.emplace_back(name, value);
}

/**
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp