diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/plum/errors.rb | 1 | ||||
-rw-r--r-- | lib/plum/http_connection.rb | 17 |
2 files changed, 2 insertions, 16 deletions
diff --git a/lib/plum/errors.rb b/lib/plum/errors.rb index 5b4b565..2770b27 100644 --- a/lib/plum/errors.rb +++ b/lib/plum/errors.rb @@ -1,5 +1,6 @@ module Plum class Error < StandardError; end + class LegacyHTTPError < Error; end class HPACKError < Error; end class HTTPError < Error ERROR_CODES = { diff --git a/lib/plum/http_connection.rb b/lib/plum/http_connection.rb index 4ffea73..b7ca046 100644 --- a/lib/plum/http_connection.rb +++ b/lib/plum/http_connection.rb @@ -35,8 +35,7 @@ module Plum settings != nil) switch_protocol(settings) else - respond_not_supported - close + raise LegacyHTTPError.new end } @@ -60,20 +59,6 @@ module Plum io.write(resp) end - def respond_not_supported - data = "Use modern web browser with HTTP/2 support." - - resp = "" - resp << "HTTP/1.1 505 HTTP Version Not Supported\r\n" - resp << "Content-Type: text/plain\r\n" - resp << "Content-Length: #{data.bytesize}\r\n" - resp << "Server: plum/#{Plum::VERSION}\r\n" - resp << "\r\n" - resp << data - - io.write(resp) - end - def process_first_request encoder = HPACK::Encoder.new(0, indexing: false) # don't pollute connection's HPACK context stream = new_stream(1) |