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

Excon::Socket.readline to use buffered reads #720

Merged
merged 1 commit into from Jun 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 2 additions & 12 deletions lib/excon/socket.rb
Expand Up @@ -60,18 +60,8 @@ def read(max_length = nil)
def readline
return legacy_readline if RUBY_VERSION.to_f <= 1.8_7
buffer = String.new
begin
buffer << @socket.read_nonblock(1) while buffer[-1] != "\n"
buffer
rescue *READ_RETRY_EXCEPTION_CLASSES
select_with_timeout(@socket, :read) && retry
rescue OpenSSL::SSL::SSLError => error
if error.message == 'read would block'
select_with_timeout(@socket, :read) && retry
else
raise(error)
end
end
buffer << read_nonblock(1) while buffer[-1] != "\n"
buffer
end

def legacy_readline
Expand Down