Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1.5
- 2.2.3
- 2.3.0-preview1
- ruby-head
- jruby-18mode
- jruby-19mode
Expand Down
9 changes: 5 additions & 4 deletions lib/httpclient/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

require 'socket'
require 'thread'
require 'timeout'
require 'stringio'
require 'zlib'

Expand Down Expand Up @@ -497,7 +498,7 @@ def query(req)
# Use absolute URI (not absolute path) iif via proxy AND not HTTPS.
req.header.request_absolute_uri = !@proxy.nil? && !https?(@dest)
begin
timeout(@send_timeout, SendTimeoutError) do
::Timeout.timeout(@send_timeout, SendTimeoutError) do
set_header(req)
req.dump(@socket)
# flush the IO stream as IO::sync mode is false
Expand Down Expand Up @@ -731,7 +732,7 @@ def connect
site = @proxy || @dest
retry_number = 0
begin
timeout(@connect_timeout, ConnectTimeoutError) do
::Timeout.timeout(@connect_timeout, ConnectTimeoutError) do
if str = @test_loopback_http_response.shift
@socket = create_loopback_socket(site.host, site.port, str)
elsif https?(@dest)
Expand Down Expand Up @@ -784,7 +785,7 @@ def read_header

StatusParseRegexp = %r(\AHTTP/(\d+\.\d+)\s+(\d\d\d)\s*([^\r\n]+)?\r?\n\z)
def parse_header(socket)
timeout(@receive_timeout, ReceiveTimeoutError) do
::Timeout.timeout(@receive_timeout, ReceiveTimeoutError) do
initial_line = nil
begin
begin
Expand Down Expand Up @@ -864,7 +865,7 @@ def read_body_length(&block)
buf = empty_bin_str
maxbytes = @read_block_size
maxbytes = @content_length if maxbytes > @content_length && @content_length > 0
timeout(@receive_timeout, ReceiveTimeoutError) do
::Timeout.timeout(@receive_timeout, ReceiveTimeoutError) do
begin
@socket.readpartial(maxbytes, buf)
rescue EOFError
Expand Down