module M2R::HTTP::Close

Detect that whether connection should be closed based on http protocol version and `Connection' header We do not support persistent connections for HTTP 1.0

Public Instance Methods

close?() click to toggle source

@return [true, false] Information whether HTTP Connection should

be closed after processing the request. Happens when HTTP/1.0
or request has Connection=close header.
# File lib/m2r/http/close.rb, line 12
def close?
  unsupported_version? || connection_close?
end

Protected Instance Methods

connection_close?() click to toggle source
# File lib/m2r/http/close.rb, line 23
def connection_close?
  headers['Connection'] == 'close'
end
unsupported_version?() click to toggle source

en.wikipedia.org/wiki/HTTP_persistent_connection

# File lib/m2r/http/close.rb, line 19
def unsupported_version?
  http_version != 'HTTP/1.1'
end