Skip to content

Commit

Permalink
Merge pull request #33 from mamantoha/fix-timeouts
Browse files Browse the repository at this point in the history
don't mind about timeouts
  • Loading branch information
mamantoha authored Mar 22, 2024
2 parents 5c20653 + 67f7cdf commit 9f001d6
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/http/proxy/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ module HTTP

getter tls : OpenSSL::SSL::Context::Client?

{% if compare_versions(Crystal::VERSION, "1.12.0-dev") < 0 %}
@dns_timeout : Float64?
@connect_timeout : Float64?
@read_timeout : Float64?
@write_timeout : Float64?
{% else %}
@dns_timeout : Time::Span?
@connect_timeout : Time::Span?
@read_timeout : Time::Span?
@write_timeout : Time::Span?
{% end %}

# Creates a new socket factory that tunnels via the given host and port.
# The following optional arguments are supported:
#
Expand All @@ -50,10 +38,10 @@ module HTTP

# Returns a new socket connected to the given host and port via the
# proxy that was requested when the socket factory was instantiated.
def open(host, port, tls = nil, *, @dns_timeout, @connect_timeout, @read_timeout, @write_timeout) : IO
socket = TCPSocket.new(@host, @port, @dns_timeout, @connect_timeout)
socket.read_timeout = @read_timeout if @read_timeout
socket.write_timeout = @write_timeout if @write_timeout
def open(host, port, tls = nil, *, dns_timeout, connect_timeout, read_timeout, write_timeout) : IO
socket = TCPSocket.new(@host, @port, dns_timeout, connect_timeout)
socket.read_timeout = read_timeout if read_timeout
socket.write_timeout = write_timeout if write_timeout
socket.sync = false

if tls
Expand Down

0 comments on commit 9f001d6

Please sign in to comment.