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

OpenSSL server socket fixes #3985

Merged
merged 3 commits into from
Feb 10, 2017

Conversation

ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Feb 2, 2017

  1. Close underlying IO on SSL accept errors.
  2. Report EOF instead of raising SSL_ERROR_ZERO_RETURN (the socket was normally closed). This happens to me all the time with cURL making requests to HTTP::Server that waits for another request (keepalive).

@denysvitali
Copy link

@sdogruyol It seems that this is the fix we're looking for. Can you try it?

@denysvitali
Copy link

cc @rdp

@ysbaddaden
Copy link
Contributor Author

Not exactly. There is another fix: ensure to close the underlying socket, whatever if it failed to flush pending data.

@sdogruyol
Copy link
Member

Related to #4003

This avoids leaving a socket in an indeterminate state opened longer
than necessary.

fixes crystal-lang#3953
HTTP::Server defaults to a keepalive connection (as expected by the
spec), but the connection may be closed normally while HTTP::Request
is waiting to receive a new request to process, yet
`OpenSSL::SSL::Socket#read` raised an exception instead of returning
`0` to report an EOF.
IO::Buffered tries to flush pending data when it's closed, but if
flushing fails, it won't try to close the IO, which could lead to
leaking file descriptors.
@ysbaddaden
Copy link
Contributor Author

Now with a fix for #4003.

@spalladino spalladino merged commit dcf47e8 into crystal-lang:master Feb 10, 2017
@spalladino spalladino added this to the Next milestone Feb 10, 2017
@ysbaddaden ysbaddaden deleted the std-openssl-fixes branch February 11, 2017 08:39
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.

None yet

4 participants