-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
SecureSocketImpl::reset shouldn't close socket #4415
Comments
#2078 was not merged because it was part of the 2.0 effort, which never happened (too much work, not enough contributors) and was left orphaned (that PR is to the old develop branch). You are welcome to create a new PR to dev branch and if it passes CI, we'll include it in 1.14 same for the changes proposed here - send a PR with a testcase and we will merge it, if ok. otherwise, you'll have to wait until someone gets to it. |
I'm working on top of the
poco-1.12.6
branch and I want to implement HTTPSClientSession setSource to work.Changes for this: #2078 (Not sure why not still merged)
Everyting seems to work as I use cherry pick of this commit: d0312c6
I only encounter bug when I close session by my intention or by server sending me close connection header.
After reconnecting I "lose" source IP and fall back to default gateway. I found out that it is caused by
SecureSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout, bool performHandshake)
poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp
Line 134 in 93eee24
Caused by:
which calls:
close();
Maybe I don't understand something, but I believe reset shouldn't call close() as it can close just freshly created socket.
Where
SecureSocketImpl::reset
is called:So in other cases than dtor socket state will be managed by other classes like HTTPClientSession so no need to explicitly close socket here again.
I would propose:
This is how I close HTTPSClientSession:
Poco::Net::SecureStreamSocket(rawSession.socket()).close();
Not sure is it correct way but calling
HTTPSClientSession::abort
orHTTPSClientSession::reset
do not sound right.Maybe I'm doing something wrong ?
Also I tested calling abort/reset (or both) but I still have same issue with source IP.
I want to close gracefully socket so server ACK shutdown.
This is how call stack looks like:
Example
From this test I expect to get same public IP, without above "fix" I receive 2 different public IP's
The text was updated successfully, but these errors were encountered: