Class: OverSIP::WebSocket::HttpRequest
- Inherits:
-
Hash
- Object
- Hash
- OverSIP::WebSocket::HttpRequest
- Includes:
- Logger
- Defined in:
- lib/oversip/websocket/http_request.rb
Constant Summary collapse
- LOG_ID =
"HTTP WS Request"
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#content_length ⇒ Object
readonly
Returns the value of attribute content_length.
-
#hdr_connection ⇒ Object
readonly
Returns the value of attribute hdr_connection.
-
#hdr_origin ⇒ Object
readonly
Returns the value of attribute hdr_origin.
-
#hdr_sec_websocket_key ⇒ Object
readonly
Returns the value of attribute hdr_sec_websocket_key.
-
#hdr_sec_websocket_protocol ⇒ Object
readonly
Returns the value of attribute hdr_sec_websocket_protocol.
-
#hdr_sec_websocket_version ⇒ Object
readonly
Returns the value of attribute hdr_sec_websocket_version.
-
#hdr_upgrade ⇒ Object
readonly
Returns the value of attribute hdr_upgrade.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#http_method ⇒ Object
readonly
HTTP request attributes.
-
#http_version ⇒ Object
readonly
Returns the value of attribute http_version.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#uri_fragment ⇒ Object
readonly
Returns the value of attribute uri_fragment.
-
#uri_path ⇒ Object
readonly
Returns the value of attribute uri_path.
-
#uri_query ⇒ Object
readonly
Returns the value of attribute uri_query.
-
#uri_scheme ⇒ Object
readonly
Returns the value of attribute uri_scheme.
Instance Method Summary collapse
- #log_id ⇒ Object
- #reply(status_code, reason_phrase = nil, extra_headers = {}) ⇒ Object
- #unknown_method? ⇒ Boolean
Methods included from Logger
fg_system_msg2str, load_methods
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
7 8 9 |
# File 'lib/oversip/websocket/http_request.rb', line 7 def connection @connection end |
#content_length ⇒ Object (readonly)
Returns the value of attribute content_length.
19 20 21 |
# File 'lib/oversip/websocket/http_request.rb', line 19 def content_length @content_length end |
#hdr_connection ⇒ Object (readonly)
Returns the value of attribute hdr_connection.
20 21 22 |
# File 'lib/oversip/websocket/http_request.rb', line 20 def hdr_connection @hdr_connection end |
#hdr_origin ⇒ Object (readonly)
Returns the value of attribute hdr_origin.
22 23 24 |
# File 'lib/oversip/websocket/http_request.rb', line 22 def hdr_origin @hdr_origin end |
#hdr_sec_websocket_key ⇒ Object (readonly)
Returns the value of attribute hdr_sec_websocket_key.
24 25 26 |
# File 'lib/oversip/websocket/http_request.rb', line 24 def hdr_sec_websocket_key @hdr_sec_websocket_key end |
#hdr_sec_websocket_protocol ⇒ Object (readonly)
Returns the value of attribute hdr_sec_websocket_protocol.
25 26 27 |
# File 'lib/oversip/websocket/http_request.rb', line 25 def hdr_sec_websocket_protocol @hdr_sec_websocket_protocol end |
#hdr_sec_websocket_version ⇒ Object (readonly)
Returns the value of attribute hdr_sec_websocket_version.
23 24 25 |
# File 'lib/oversip/websocket/http_request.rb', line 23 def hdr_sec_websocket_version @hdr_sec_websocket_version end |
#hdr_upgrade ⇒ Object (readonly)
Returns the value of attribute hdr_upgrade.
21 22 23 |
# File 'lib/oversip/websocket/http_request.rb', line 21 def hdr_upgrade @hdr_upgrade end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
17 18 19 |
# File 'lib/oversip/websocket/http_request.rb', line 17 def host @host end |
#http_method ⇒ Object (readonly)
HTTP request attributes.
10 11 12 |
# File 'lib/oversip/websocket/http_request.rb', line 10 def http_method @http_method end |
#http_version ⇒ Object (readonly)
Returns the value of attribute http_version.
11 12 13 |
# File 'lib/oversip/websocket/http_request.rb', line 11 def http_version @http_version end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
18 19 20 |
# File 'lib/oversip/websocket/http_request.rb', line 18 def port @port end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
13 14 15 |
# File 'lib/oversip/websocket/http_request.rb', line 13 def uri @uri end |
#uri_fragment ⇒ Object (readonly)
Returns the value of attribute uri_fragment.
16 17 18 |
# File 'lib/oversip/websocket/http_request.rb', line 16 def uri_fragment @uri_fragment end |
#uri_path ⇒ Object (readonly)
Returns the value of attribute uri_path.
14 15 16 |
# File 'lib/oversip/websocket/http_request.rb', line 14 def uri_path @uri_path end |
#uri_query ⇒ Object (readonly)
Returns the value of attribute uri_query.
15 16 17 |
# File 'lib/oversip/websocket/http_request.rb', line 15 def uri_query @uri_query end |
#uri_scheme ⇒ Object (readonly)
Returns the value of attribute uri_scheme.
12 13 14 |
# File 'lib/oversip/websocket/http_request.rb', line 12 def uri_scheme @uri_scheme end |
Instance Method Details
#log_id ⇒ Object
29 30 31 |
# File 'lib/oversip/websocket/http_request.rb', line 29 def log_id LOG_ID end |
#reply(status_code, reason_phrase = nil, extra_headers = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/oversip/websocket/http_request.rb', line 36 def reply status_code, reason_phrase=nil, extra_headers={} reason_phrase ||= REASON_PHRASE[status_code] || REASON_PHRASE_NOT_SET extra_headers ||= {} response = "#{@http_version} #{status_code} #{reason_phrase}\r\n" extra_headers.each {|header| response << header << "\r\n"} response << HDR_SERVER << "\r\n\r\n" log_system_debug "replying #{status_code} \"#{reason_phrase}\"" if $oversip_debug if @connection.error? log_system_warn "cannot send response, connection is closed" return false end @connection.send_data response return true end |
#unknown_method? ⇒ Boolean
33 |
# File 'lib/oversip/websocket/http_request.rb', line 33 def unknown_method? ; @is_unknown_method end |