Skip to content

Setting source port #551

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

DanielBujnik
Copy link

With this change it is possible to set the TCP source port of HTTP and HTTPS client requests by calling setSourcePort method of client::request object.

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

boost::network::uri::uri const& uri() const { return uri_; }

void setSourcePort(const unsigned short port) { source_port_ = port; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this as source_port instead to follow the convention already set in the class.

@deanberris
Copy link
Member

Just a couple of comments, sorry for the very long delay @DanielBujnik -- I'm usually better about these things. 😏

@DanielBujnik
Copy link
Author

Thanks for feedback. Getter and setter methods are now named as source_port as requested.

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

boost::network::uri::uri const& uri() const { return uri_; }

void source_port(const unsigned short port) { source_port_ = port; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use boost::uint16_t instead of unsigned short.

@deanberris
Copy link
Member

Sorry about the back-and forth here, just a couple more things.

@DanielBujnik
Copy link
Author

OK done.

@deanberris
Copy link
Member

LGTM -- thanks @DanielBujnik, merging now.

deanberris added a commit that referenced this pull request Aug 25, 2015
@deanberris deanberris merged commit 0803d8b into cpp-netlib:0.11-devel Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants