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

Commit2c44282

Browse files
committed
Merge pull request#476 from glynos/master
Refactored HTTP client v2.
2 parents28c7400 +42ab79d commit2c44282

File tree

18 files changed

+1969
-1733
lines changed

18 files changed

+1969
-1733
lines changed

‎contrib/http_examples/simple_wget.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
namespacehttp= network::http;
2222

2323
namespace {
24-
std::stringget_filename(const std::string& path) {
25-
auto index = path.find_last_of('/');
26-
auto filename = path.substr(index +1);
27-
return filename.empty() ?"index.html" : filename;
28-
}
24+
std::stringget_filename(const std::string& path) {
25+
auto index = path.find_last_of('/');
26+
auto filename = path.substr(index +1);
27+
return filename.empty() ?"index.html" : filename;
28+
}
2929
}// namespace
3030

3131
intmain(int argc,char* argv[]) {

‎http/src/http/v2/client/client.cpp

Lines changed: 307 additions & 182 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2013 by Glyn Matthews
1+
// Copyright (C) 2013, 2014 by Glyn Matthews
22
// Distributed under the Boost Software License, Version 1.0.
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
@@ -9,71 +9,57 @@
99

1010
namespacenetwork {
1111
namespacehttp {
12-
namespacev2 {
13-
12+
inlinenamespacev2 {
1413
classclient_category_impl :publicstd::error_category {
1514

16-
public:
17-
18-
client_category_impl() =default;
15+
public:
16+
client_category_impl() =default;
1917

20-
virtual~client_category_impl()noexcept;
18+
virtual~client_category_impl()noexceptoverride;
2119

22-
virtualconstchar *name()constnoexcept;
23-
24-
virtual std::stringmessage(int ev)const;
20+
virtualconstchar *name()constnoexceptoverride;
2521

22+
virtual std::stringmessage(int ev)constoverride;
2623
};
2724

28-
client_category_impl::~client_category_impl()noexcept {
29-
30-
}
25+
client_category_impl::~client_category_impl()noexcept {}
3126

3227
constchar *client_category_impl::name()constnoexcept {
33-
staticconstchar name[] ="client_error";
34-
return name;
28+
staticconstchar name[] ="client_error";
29+
return name;
3530
}
3631

3732
std::stringclient_category_impl::message(int ev)const {
38-
switch (client_error(ev)) {
39-
40-
case client_error::invalid_request:
41-
return"Invalid HTTP request.";
42-
case client_error::invalid_response:
43-
return"Invalid HTTP response.";
44-
default:
45-
break;
46-
}
47-
return"Unknown client error.";
33+
switch (client_error(ev)) {
34+
35+
case client_error::invalid_request:
36+
return"Invalid HTTP request.";
37+
case client_error::invalid_response:
38+
return"Invalid HTTP response.";
39+
default:
40+
break;
41+
}
42+
return"Unknown client error.";
4843
}
4944

5045
const std::error_category &client_category() {
51-
static client_category_impl client_category;
52-
return client_category;
46+
static client_category_impl client_category;
47+
return client_category;
5348
}
5449

5550
std::error_codemake_error_code(client_error e) {
56-
returnstd::error_code(static_cast<int>(e),client_category());
51+
returnstd::error_code(static_cast<int>(e),client_category());
5752
}
5853

5954
invalid_url::invalid_url()
60-
: std::invalid_argument("Requires HTTP or HTTPS URL.") {
61-
62-
}
55+
: std::invalid_argument("Requires HTTP or HTTPS URL.") {}
6356

64-
invalid_url::~invalid_url()noexcept {
65-
66-
}
57+
invalid_url::~invalid_url()noexcept {}
6758

6859
client_exception::client_exception(client_error error)
69-
: std::system_error(make_error_code(error)) {
70-
71-
}
72-
73-
client_exception::~client_exception()noexcept {
74-
75-
}
60+
: std::system_error(make_error_code(error)) {}
7661

77-
}// namespace v2
78-
}// namespace network
79-
}// namespace network
62+
client_exception::~client_exception()noexcept {}
63+
}// namespace v2
64+
}// namespace http
65+
}// namespace network

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp