Skip to content

Commit 2b49830

Browse files
committed
Update request.hpp
1 parent 9e0cfaa commit 2b49830

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

boost/network/protocol/http/impl/request.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,26 @@ template <class Tag>
5555
struct basic_request : public basic_message<Tag> {
5656

5757
mutable boost::network::uri::uri uri_;
58+
unsigned short source_port_;
5859
typedef basic_message<Tag> base_type;
5960

6061
public:
6162
typedef typename sync_only<Tag>::type tag;
6263
typedef typename string<tag>::type string_type;
6364
typedef boost::uint16_t port_type;
6465

65-
explicit basic_request(string_type const& uri_) : uri_(uri_) {}
66+
explicit basic_request(string_type const& uri_) : uri_(uri_), source_port_(0) {}
6667

67-
explicit basic_request(boost::network::uri::uri const& uri_) : uri_(uri_) {}
68+
explicit basic_request(boost::network::uri::uri const& uri_) : uri_(uri_), source_port_(0) {}
6869

6970
void uri(string_type const& new_uri) { uri_ = new_uri; }
7071

7172
void uri(boost::network::uri::uri const& new_uri) { uri_ = new_uri; }
7273

73-
basic_request() : base_type() {}
74+
basic_request() : base_type(), source_port_(0) {}
7475

7576
basic_request(basic_request const& other)
76-
: base_type(other), uri_(other.uri_) {}
77+
: base_type(other), uri_(other.uri_), source_port_(other.source_port_) {}
7778

7879
basic_request& operator=(basic_request rhs) {
7980
rhs.swap(*this);
@@ -85,6 +86,7 @@ struct basic_request : public basic_message<Tag> {
8586
basic_request<Tag>& this_ref(*this);
8687
base_ref.swap(this_ref);
8788
boost::swap(other.uri_, this->uri_);
89+
boost::swap(other.source_port_, this->source_port_);
8890
}
8991

9092
string_type const host() const { return uri_.host(); }
@@ -110,6 +112,10 @@ struct basic_request : public basic_message<Tag> {
110112
void uri(string_type const& new_uri) const { uri_ = new_uri; }
111113

112114
boost::network::uri::uri const& uri() const { return uri_; }
115+
116+
void setSourcePort(const unsigned short port) { source_port_ = port; }
117+
118+
unsigned short getSourcePort() const { return source_port_; }
113119
};
114120

115121
/** This is the implementation of a POD request type

0 commit comments

Comments
 (0)