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
Minor refactoring in the HTTP client.
  • Loading branch information
@glynos
glynos committedDec 24, 2014
commite2da30516c3855f52ce81013f024d2c0161ffbeb
14 changes: 8 additions & 6 deletionshttp/src/http/v2/client/client.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,7 @@ namespace network {

void read_response_status(const boost::system::error_code &ec,
std::size_t bytes_written,
std::shared_ptr<request_context> context,
std::shared_ptr<response> res);
std::shared_ptr<request_context> context);

void read_response_headers(const boost::system::error_code &ec,
std::size_t bytes_read,
Expand DownExpand Up@@ -299,19 +298,17 @@ namespace network {
}

// Create a response object and fill it with the status from the server.
std::shared_ptr<response> res(new response{});
context->connection_->async_read_until(
context->response_buffer_, "\r\n",
strand_.wrap([=](const boost::system::error_code &ec,
std::size_t bytes_read) {
read_response_status(ec, bytes_read, context, res);
read_response_status(ec, bytes_read, context);
}));
}

void client::impl::read_response_status(
const boost::system::error_code &ec, std::size_t,
std::shared_ptr<request_context> context,
std::shared_ptr<response> res) {
std::shared_ptr<request_context> context) {
if (timedout_) {
set_error(boost::asio::error::timed_out, context);
return;
Expand All@@ -331,6 +328,11 @@ namespace network {
string_type message;
std::getline(is, message);

// if options_.follow_redirects()
// and if status in range 300 - 307
// then take the request and reset the URL

std::shared_ptr<response> res(new response{});
res->set_version(version);
res->set_status(network::http::v2::status::code(status));
res->set_status_message(boost::trim_copy(message));
Expand Down
2 changes: 1 addition & 1 deletionhttp/src/network/http/v2/client/request.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -373,7 +373,7 @@ class request {
* \brief Move constructor.
*/
request(request &&other)noexcept
: url_(std::move(other.url_))
: url_(std::move(other.url_))
, method_(std::move(other.method_))
, path_(std::move(other.path_))
, version_(std::move(other.version_))
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp