Merge pull request #695 from leonklingele/crystalfmt

Format Crystal files
This commit is contained in:
Omar Roth 2019-08-14 18:06:37 -05:00 committed by GitHub
commit 0727acf458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -69,20 +69,20 @@ class FilteredCompressHandler < Kemal::Handler
return call_next env if exclude_match? env return call_next env if exclude_match? env
{% if flag?(:without_zlib) %} {% if flag?(:without_zlib) %}
call_next env call_next env
{% else %} {% else %}
request_headers = env.request.headers request_headers = env.request.headers
if request_headers.includes_word?("Accept-Encoding", "gzip") if request_headers.includes_word?("Accept-Encoding", "gzip")
env.response.headers["Content-Encoding"] = "gzip" env.response.headers["Content-Encoding"] = "gzip"
env.response.output = Gzip::Writer.new(env.response.output, sync_close: true) env.response.output = Gzip::Writer.new(env.response.output, sync_close: true)
elsif request_headers.includes_word?("Accept-Encoding", "deflate") elsif request_headers.includes_word?("Accept-Encoding", "deflate")
env.response.headers["Content-Encoding"] = "deflate" env.response.headers["Content-Encoding"] = "deflate"
env.response.output = Flate::Writer.new(env.response.output, sync_close: true) env.response.output = Flate::Writer.new(env.response.output, sync_close: true)
end end
call_next env call_next env
{% end %} {% end %}
end end
end end

View File

@ -31,10 +31,10 @@ class HTTPProxy
if resp[:code]? == 200 if resp[:code]? == 200
{% if !flag?(:without_openssl) %} {% if !flag?(:without_openssl) %}
if tls if tls
tls_socket = OpenSSL::SSL::Socket::Client.new(socket, context: tls, sync_close: true, hostname: host) tls_socket = OpenSSL::SSL::Socket::Client.new(socket, context: tls, sync_close: true, hostname: host)
socket = tls_socket socket = tls_socket
end end
{% end %} {% end %}
return socket return socket