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

Commit8ae025d

Browse files
committed
Missed destination checking.
1 parent4c411e7 commit8ae025d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎boost/network/protocol/http/request/request.ipp‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct request_pimpl {
2424
: uri_(url)
2525
, read_offset_(0)
2626
, source_()
27+
, destination_()
2728
, headers_()
2829
{}
2930

@@ -86,6 +87,14 @@ struct request_pimpl {
8687
source = source_;
8788
}
8889

90+
voidset_destination(std::stringconst &destination) {
91+
destination_ = destination;
92+
}
93+
94+
voidget_destination(std::string &destination)const {
95+
destination = destination_;
96+
}
97+
8998
size_tread_offset()const {
9099
return read_offset_;
91100
}
@@ -98,6 +107,7 @@ struct request_pimpl {
98107
return uri_ == other.uri_ &&
99108
read_offset_ == other.read_offset_ &&
100109
source_ == other.source_ &&
110+
destination_ == other.destination_ &&
101111
headers_ == other.headers_;
102112
}
103113

@@ -106,13 +116,14 @@ struct request_pimpl {
106116

107117
uri::uri uri_;
108118
size_t read_offset_;
109-
std::string source_;
119+
std::string source_, destination_;
110120
headers_type headers_;
111121

112122
request_pimpl(request_pimplconst &other)
113123
: uri_(other.uri_)
114124
, read_offset_(other.read_offset_)
115125
, source_(other.source_)
126+
, destination_(other.destination_)
116127
, headers_(other.headers_)
117128
{}
118129
};
@@ -150,6 +161,7 @@ void request::swap(request & other) {
150161
// From message_base...
151162
// Mutators
152163
voidrequest::set_destination(std::stringconst & destination) {
164+
pimpl_->set_destination(destination);
153165
}
154166

155167
voidrequest::set_source(std::stringconst & source) {
@@ -178,6 +190,7 @@ void request::append_body(std::string const & data) {
178190

179191
// Retrievers
180192
voidrequest::get_destination(std::string & destination)const {
193+
pimpl_->get_destination(destination);
181194
}
182195

183196
voidrequest::get_source(std::string & source)const {

‎libs/network/test/http/request_test.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(request_basics_test) {
5858
http::request request;
5959
request.set_uri("http://www.google.com/");
6060
request.set_source("127.0.0.1");
61-
request.set_destination("http://www.google.com/");
61+
request.set_destination("destination!");
6262
request.append_header("X-Referer","http://cpp-netlib.github.com/");
6363
request.append_header("Connection","close");
6464
request.append_body("The quick brown fox jumps over the lazy dog!");
@@ -73,6 +73,7 @@ BOOST_AUTO_TEST_CASE(request_basics_test) {
7373

7474
BOOST_CHECK_EQUAL(uri_.string(),std::string("http://www.google.com/"));
7575
BOOST_CHECK_EQUAL(source_,std::string("127.0.0.1"));
76+
BOOST_CHECK_EQUAL(destination_,std::string("destination!"));
7677
BOOST_CHECK_EQUAL(body_,std::string("The quick brown fox jumps over the lazy dog!"));
7778
BOOST_CHECK(!boost::empty(headers_range));
7879
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp