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 fromall commits
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
10 changes: 5 additions & 5 deletionscontrib/http_examples/simple_wget.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,11 +21,11 @@
namespace http = network::http;

namespace {
std::string get_filename(const std::string& path) {
auto index = path.find_last_of('/');
auto filename = path.substr(index + 1);
return filename.empty() ? "index.html" : filename;
}
std::string get_filename(const std::string& path) {
auto index = path.find_last_of('/');
auto filename = path.substr(index + 1);
return filename.empty() ? "index.html" : filename;
}
} // namespace

int main(int argc, char* argv[]) {
Expand Down
489 changes: 307 additions & 182 deletionshttp/src/http/v2/client/client.cpp
View file
Open in desktop

Large diffs are not rendered by default.

74 changes: 30 additions & 44 deletionshttp/src/http/v2/client/client_errors.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2013 by Glyn Matthews
// Copyright (C) 2013, 2014 by Glyn Matthews
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
Expand All@@ -9,71 +9,57 @@

namespace network {
namespace http {
namespace v2 {

inline namespace v2 {
class client_category_impl : public std::error_category {

public:

client_category_impl() = default;
public:
client_category_impl() = default;

virtual ~client_category_impl() noexcept;
virtual ~client_category_impl() noexcept override;

virtual const char *name() const noexcept;

virtual std::string message(int ev) const;
virtual const char *name() const noexcept override;

virtual std::string message(int ev) const override;
};

client_category_impl::~client_category_impl() noexcept {

}
client_category_impl::~client_category_impl() noexcept {}

const char *client_category_impl::name() const noexcept {
static const char name[] = "client_error";
return name;
static const char name[] = "client_error";
return name;
}

std::string client_category_impl::message(int ev) const {
switch (client_error(ev)) {

case client_error::invalid_request:
return "Invalid HTTP request.";
case client_error::invalid_response:
return "Invalid HTTP response.";
default:
break;
}
return "Unknown client error.";
switch (client_error(ev)) {

case client_error::invalid_request:
return "Invalid HTTP request.";
case client_error::invalid_response:
return "Invalid HTTP response.";
default:
break;
}
return "Unknown client error.";
}

const std::error_category &client_category() {
static client_category_impl client_category;
return client_category;
static client_category_impl client_category;
return client_category;
}

std::error_code make_error_code(client_error e) {
return std::error_code(static_cast<int>(e), client_category());
return std::error_code(static_cast<int>(e), client_category());
}

invalid_url::invalid_url()
: std::invalid_argument("Requires HTTP or HTTPS URL.") {

}
: std::invalid_argument("Requires HTTP or HTTPS URL.") {}

invalid_url::~invalid_url() noexcept {

}
invalid_url::~invalid_url() noexcept {}

client_exception::client_exception(client_error error)
: std::system_error(make_error_code(error)) {

}

client_exception::~client_exception() noexcept {

}
: std::system_error(make_error_code(error)) {}

} // namespace v2
} // namespace network
} // namespace network
client_exception::~client_exception() noexcept {}
} // namespace v2
} // namespace http
} // namespace network
Loading

[8]ページ先頭

©2009-2025 Movatter.jp