example/upgrade_server.rb in http-2-0.9.1 vs example/upgrade_server.rb in http-2-0.10.0
- old
+ new
@@ -37,16 +37,16 @@
end
end
class UpgradeHandler
VALID_UPGRADE_METHODS = %w(GET OPTIONS).freeze
- UPGRADE_RESPONSE = <<-RESP
-HTTP/1.1 101 Switching Protocols
-Connection: Upgrade
-Upgrade: h2c
+ UPGRADE_RESPONSE = <<-RESP.strip_heredoc.freeze
+ HTTP/1.1 101 Switching Protocols
+ Connection: Upgrade
+ Upgrade: h2c
-RESP
+ RESP
attr_reader :complete, :headers, :body, :parsing
def initialize(conn, sock)
@conn, @sock = conn, sock
@@ -189,10 +189,10 @@
when uh.complete
conn << data
end
- rescue => e
+ rescue StandardError => e
puts "Exception: #{e}, #{e.message} - closing socket."
puts e.backtrace.last(10).join("\n")
sock.close
end
end