Skip to content

Commit

Permalink
Require Crystal >= 0.36.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Jan 27, 2021
1 parent 640c612 commit 9dfcfe8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.8.0

* Require Crystal >= 0.36.0

## 0.7.3

* Fixed compatibility with Crystal nightly
Expand Down
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: http_proxy
version: 0.7.3
version: 0.8.0

authors:
- Theo Li <[email protected]>
- Anton Maminov <[email protected]>

crystal: ">= 0.35.0"
crystal: ">= 0.36.0"

development_dependencies:
ameba:
Expand Down
27 changes: 8 additions & 19 deletions src/http/proxy/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,14 @@ module HTTP
return unless proxy

begin
{% if compare_versions(Crystal::VERSION, "0.35.1") <= 0 %}
@socket = proxy.open(
host: @host,
port: @port,
tls: @tls,
dns_timeout: @dns_timeout,
connect_timeout: @connect_timeout,
read_timeout: @read_timeout
)
{% else %}
@io = proxy.open(
host: @host,
port: @port,
tls: @tls,
dns_timeout: @dns_timeout,
connect_timeout: @connect_timeout,
read_timeout: @read_timeout
)
{% end %}
@io = proxy.open(
host: @host,
port: @port,
tls: @tls,
dns_timeout: @dns_timeout,
connect_timeout: @connect_timeout,
read_timeout: @read_timeout
)
rescue ex : IO::Error
raise IO::Error.new("Failed to open TCP connection to #{@host}:#{@port} (#{ex.message})")
end
Expand Down

0 comments on commit 9dfcfe8

Please sign in to comment.