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

Commitfce0312

Browse files
committed
Moved http::client_message::request/response into the http namespace.
1 parenta96eac6 commitfce0312

File tree

7 files changed

+28
-25
lines changed

7 files changed

+28
-25
lines changed

‎contrib/http_examples/read_headers.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ main(int argc, char *argv[]) {
1919

2020
try {
2121
http::client client;
22-
http::client::request request{network::uri{std::string{argv[1]}}};
22+
http::request request{network::uri{std::string{argv[1]}}};
2323
request.version("1.0");
2424
request.append_header("Connection","close");
2525
request.append_header("User-Agent","cpp-netlib read_headers example");

‎contrib/http_examples/simple_wget.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main(int argc, char* argv[]) {
3737

3838
try {
3939
http::client client;
40-
http::client::request request{network::uri{std::string{argv[1]}}};
40+
http::request request{network::uri{std::string{argv[1]}}};
4141
request.version("1.0");
4242
request.append_header("Connection","close");
4343
request.append_header("User-Agent","cpp-netlib simple_wget example");

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ namespace network {
2626

2727
std::shared_ptr<client_connection::async_connection> connection_;
2828

29-
client::request request_;
30-
client::request_options options_;
29+
request request_;
30+
request_options options_;
3131

32-
std::promise<client::response> response_promise_;
32+
std::promise<response> response_promise_;
3333

3434
boost::asio::streambuf request_buffer_;
3535
boost::asio::streambuf response_buffer_;
3636

3737
// TODO configure deadline timer for timeouts
3838

3939
request_helper(std::shared_ptr<client_connection::async_connection> connection,
40-
client::request request,
41-
client::request_options options)
40+
request request,
41+
request_options options)
4242
: connection_(connection)
4343
, request_(request)
4444
, options_(options) { }
@@ -118,8 +118,8 @@ namespace network {
118118
lifetime_thread_.join();
119119
}
120120

121-
std::future<client::response>client::impl::execute(std::shared_ptr<request_helper> helper) {
122-
std::future<client::response> res = helper->response_promise_.get_future();
121+
std::future<response>client::impl::execute(std::shared_ptr<request_helper> helper) {
122+
std::future<response> res = helper->response_promise_.get_future();
123123

124124
// TODO see linearize.hpp
125125

@@ -332,7 +332,7 @@ namespace network {
332332
delete pimpl_;
333333
}
334334

335-
std::future<client::response>client::execute(request req, request_options options) {
335+
std::future<response>client::execute(request req, request_options options) {
336336
std::shared_ptr<client_connection::async_connection> connection;
337337
if (pimpl_->mock_connection_) {
338338
connection = pimpl_->mock_connection_;
@@ -344,32 +344,32 @@ namespace network {
344344
return pimpl_->execute(std::make_shared<request_helper>(connection, req, options));
345345
}
346346

347-
std::future<client::response>client::get(request req, request_options options) {
347+
std::future<response>client::get(request req, request_options options) {
348348
req.method(method::get);
349349
returnexecute(req, options);
350350
}
351351

352-
std::future<client::response>client::post(request req, request_options options) {
352+
std::future<response>client::post(request req, request_options options) {
353353
req.method(method::post);
354354
returnexecute(req, options);
355355
}
356356

357-
std::future<client::response>client::put(request req, request_options options) {
357+
std::future<response>client::put(request req, request_options options) {
358358
req.method(method::put);
359359
returnexecute(req, options);
360360
}
361361

362-
std::future<client::response>client::delete_(request req, request_options options) {
362+
std::future<response>client::delete_(request req, request_options options) {
363363
req.method(method::delete_);
364364
returnexecute(req, options);
365365
}
366366

367-
std::future<client::response>client::head(request req, request_options options) {
367+
std::future<response>client::head(request req, request_options options) {
368368
req.method(method::head);
369369
returnexecute(req, options);
370370
}
371371

372-
std::future<client::response>client::options(request req, request_options options) {
372+
std::future<response>client::options(request req, request_options options) {
373373
req.method(method::options);
374374
returnexecute(req, options);
375375
}

‎http/src/network/http/client.hpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8-
#ifndefNETWORK_HTTP_CLIENT_INC__
9-
#defineNETWORK_HTTP_CLIENT_INC__
8+
#ifndefNETWORK_HTTP_CLIENT_INC
9+
#defineNETWORK_HTTP_CLIENT_INC
1010

1111
#include<network/http/v2/client.hpp>
1212
#include<network/http/v2/method.hpp>
@@ -16,6 +16,9 @@ namespace network {
1616
namespacehttp {
1717
using v2::client;
1818
using v2::client_options;
19+
using v2::request;
20+
using v2::request_options;
21+
using v2::response;
1922
using v2::method;
2023
namespacestatus= v2::status;
2124
using v2::client_error;
@@ -25,4 +28,4 @@ namespace network {
2528
}// namespace network
2629

2730

28-
#endif//NETWORK_HTTP_CLIENT_INC__
31+
#endif//NETWORK_HTTP_CLIENT_INC

‎http/src/network/http/v2/client/client.hpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ namespace network {
280280
lhs.swap(rhs);
281281
}
282282

283+
typedef client_message::request_options request_options;
284+
typedef client_message::request request;
285+
typedef client_message::response response;
286+
283287
/**
284288
* \ingroup http_client
285289
* \class client network/http/v2/client/client.hpp network/http/v2/client.hpp
@@ -293,10 +297,6 @@ namespace network {
293297

294298
public:
295299

296-
typedef client_message::request_options request_options;
297-
typedef client_message::request request;
298-
typedef client_message::response response;
299-
300300
/**
301301
* \typedef string_type
302302
* \brief The client string_type.

‎http/test/v2/client/features/http_client_test.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Describe(http_client) {
2020
}
2121

2222
It(gets_a_header_response) {
23-
http::client::request request{network::uri{"http://www.boost.org/"}};
23+
http::request request{network::uri{"http://www.boost.org/"}};
2424
request
2525
.method(http::method::get)
2626
.path("/LICENSE_1_0.txt")

‎http/test/v2/client/units/client_resolution_test.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class client_resolution_test : public ::testing::Test {
7575
};
7676

7777
TEST_F(client_resolution_test, host_not_found) {
78-
http::client::request request;
78+
http::request request;
7979
request
8080
.method(http::method::get)
8181
.path("/LICENSE_1_0.txt")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp