Class: HTTP::Protocol::HTTP10::Connection
Constant Summary
collapse
- KEEP_ALIVE =
'keep-alive'.freeze
- VERSION =
"HTTP/1.0".freeze
HTTP::Protocol::HTTP11::Connection::CLOSE, HTTP::Protocol::HTTP11::Connection::CONNECT, HTTP::Protocol::HTTP11::Connection::CONNECTION, HTTP::Protocol::HTTP11::Connection::CRLF, HTTP::Protocol::HTTP11::Connection::HEAD, HTTP::Protocol::HTTP11::Connection::HOST
Instance Attribute Summary
#count, #persistent, #stream
Instance Method Summary
collapse
#close, #each_line, #hijack, #initialize, #read_body, #read_chunk, #read_chunked_body, #read_fixed_body, #read_headers, #read_line, #read_remainder_body, #read_request, #read_request_body, #read_response, #read_response_body, #read_tunnel_body, #write_body_and_close, #write_body_head, #write_chunk, #write_chunked_body, #write_empty_body, #write_fixed_length_body, #write_headers, #write_request, #write_response
Instance Method Details
#persistent?(headers) ⇒ Boolean
34
35
36
37
38
39
40
|
# File 'lib/http/protocol/http10/connection.rb', line 34
def persistent?()
if connection = [CONNECTION]
return connection.include?(KEEP_ALIVE)
else
return false
end
end
|
#version ⇒ Object
30
31
32
|
# File 'lib/http/protocol/http10/connection.rb', line 30
def version
VERSION
end
|
#write_body(body, chunked = false) ⇒ Object
46
47
48
49
|
# File 'lib/http/protocol/http10/connection.rb', line 46
def write_body(body, chunked = false)
super(body, chunked)
end
|
42
43
44
|
# File 'lib/http/protocol/http10/connection.rb', line 42
def
@stream.write("connection: keep-alive\r\n") if @persistent
end
|