Class: Hobix::WebApp::Request
- Defined in:
- lib/hobix/webapp/message.rb
Instance Attribute Summary collapse
-
#action_uri ⇒ Object
readonly
Returns the value of attribute action_uri.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#path_info ⇒ Object
readonly
Returns the value of attribute path_info.
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
-
#remote_addr ⇒ Object
readonly
Returns the value of attribute remote_addr.
-
#request_method ⇒ Object
readonly
Returns the value of attribute request_method.
-
#request_uri ⇒ Object
readonly
Returns the value of attribute request_uri.
-
#script_name ⇒ Object
readonly
Returns the value of attribute script_name.
-
#server_name ⇒ Object
readonly
Returns the value of attribute server_name.
-
#server_port ⇒ Object
readonly
Returns the value of attribute server_port.
-
#server_protocol ⇒ Object
readonly
Returns the value of attribute server_protocol.
Attributes inherited from Message
Instance Method Summary collapse
-
#initialize(request_line = nil, header = {}, body = '') ⇒ Request
constructor
A new instance of Request.
- #make_request_header_from_cgi_env(env) ⇒ Object
Methods inherited from Message
#freeze, #output_body, #output_header, #output_message
Constructor Details
#initialize(request_line = nil, header = {}, body = '') ⇒ Request
Returns a new instance of Request.
126 127 128 129 |
# File 'lib/hobix/webapp/message.rb', line 126 def initialize(request_line=nil, header={}, body='') @request_line = request_line super header, body end |
Instance Attribute Details
#action_uri ⇒ Object (readonly)
Returns the value of attribute action_uri.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def action_uri @action_uri end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def content_type @content_type end |
#path_info ⇒ Object (readonly)
Returns the value of attribute path_info.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def path_info @path_info end |
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def query_string @query_string end |
#remote_addr ⇒ Object (readonly)
Returns the value of attribute remote_addr.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def remote_addr @remote_addr end |
#request_method ⇒ Object (readonly)
Returns the value of attribute request_method.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def request_method @request_method end |
#request_uri ⇒ Object (readonly)
Returns the value of attribute request_uri.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def request_uri @request_uri end |
#script_name ⇒ Object (readonly)
Returns the value of attribute script_name.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def script_name @script_name end |
#server_name ⇒ Object (readonly)
Returns the value of attribute server_name.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def server_name @server_name end |
#server_port ⇒ Object (readonly)
Returns the value of attribute server_port.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def server_port @server_port end |
#server_protocol ⇒ Object (readonly)
Returns the value of attribute server_protocol.
130 131 132 |
# File 'lib/hobix/webapp/message.rb', line 130 def server_protocol @server_protocol end |
Instance Method Details
#make_request_header_from_cgi_env(env) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/hobix/webapp/message.rb', line 137 def make_request_header_from_cgi_env(env) env.each {|k, v| next if /\AHTTP_/ !~ k k = Header.capitalize_field_name($') k.gsub!(/_/, '-') @header_object.add k, v } @request_method = env['REQUEST_METHOD'] @server_name = ( env['SERVER_NAME'] || '' ).gsub( /\:\d+$/, '' ) # lighttpd affixes port!! @server_port = env['SERVER_PORT'].to_i @script_name = env['SCRIPT_NAME'] || '' @path_info = env['PATH_INFO'] || '' @query_string = QueryString.primitive_new_for_raw_query_string(env['QUERY_STRING'] || '') @server_protocol = env['SERVER_PROTOCOL'] || '' @remote_addr = env['REMOTE_ADDR'] || '' @content_type = env['CONTENT_TYPE'] || '' # non-standard: @request_uri = env['REQUEST_URI'] # Apache # hobix action uri @action_uri = ( env['PATH_INFO'] || env['REQUEST_URI'] ). gsub( /^(#{ Regexp::quote( File::dirname( @script_name ) ) })?\/*/, '' ). gsub( /\?.+$/, '' ) end |