Skip to content
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

Fix leaking TCP socket after failed SSL connect in HTTP::Client#socket #8025

Conversation

@straight-shoota
Copy link
Member

commented Aug 1, 2019

Fixes #7843

I couldn't make a spec for this, but this fix is good anyway.

@jhass

jhass approved these changes Aug 2, 2019

Show resolved Hide resolved src/http/client.cr Outdated
Update src/http/client.cr
Co-Authored-By: Julien Portalier <julien@portalier.com>
@ysbaddaden
Copy link
Member

left a comment

Please merge once CI is done :)

@straight-shoota straight-shoota merged commit 7f76bf1 into crystal-lang:master Aug 2, 2019

5 checks passed

ci/circleci: check_format Your tests passed on CircleCI!
Details
ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@straight-shoota straight-shoota added this to the 0.31.0 milestone Aug 2, 2019

@straight-shoota straight-shoota deleted the straight-shoota:fix/http-client-socket-leak branch Aug 2, 2019

socket = OpenSSL::SSL::Socket::Client.new(tcp_socket, context: tls, sync_close: true, hostname: @host)
rescue exc
# don't leak the TCP socket when the SSL connection failed
tcp_socket.close

This comment has been minimized.

Copy link
@RX14

RX14 Aug 2, 2019

Member

does socket.close not work?

This comment has been minimized.

Copy link
@straight-shoota

straight-shoota Aug 2, 2019

Author Member

It probably should, but this makes it more explicit what's going on.

@bcardiff bcardiff modified the milestones: 0.31.0, 0.30.1 Aug 8, 2019

bcardiff added a commit that referenced this pull request Aug 8, 2019

Fix leaking TCP socket after failed SSL connect in HTTP::Client#socket (
#8025)

Co-Authored-By: Julien Portalier <julien@portalier.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.