Class: Waitress::Request
- Inherits:
-
Object
- Object
- Waitress::Request
- Defined in:
- lib/waitress/request.rb
Overview
The request class is used to represent a HTTP request by a client. This includes all the headers sent to the server by the client, request URI and those properties parsed by Mongrel, including the Path and QueryString. GET and POST queries are to be parsed on-request by the handler or .wrb file as to not waste CPU resources.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_version ⇒ Object
Returns the value of attribute http_version.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#querystring ⇒ Object
Returns the value of attribute querystring.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#get_query ⇒ Object
The GET query for the request in the form of a hash.
-
#initialize(method, path, uri, query, http_version, body, headers) ⇒ Request
constructor
A new instance of Request.
-
#post_query ⇒ Object
The POST query for the request in the form of a hash.
- #to_s ⇒ Object
Constructor Details
#initialize(method, path, uri, query, http_version, body, headers) ⇒ Request
Returns a new instance of Request.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/waitress/request.rb', line 16 def initialize method, path, uri, query, http_version, body, headers @method = method @path = Waitress::QueryParser.unescape(path) @uri = Waitress::QueryParser.unescape(uri) @querystring = query @http_version = http_version @body = body @headers = headers @marks = {} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
13 14 15 |
# File 'lib/waitress/request.rb', line 13 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
14 15 16 |
# File 'lib/waitress/request.rb', line 14 def headers @headers end |
#http_version ⇒ Object
Returns the value of attribute http_version.
12 13 14 |
# File 'lib/waitress/request.rb', line 12 def http_version @http_version end |
#method ⇒ Object
Returns the value of attribute method.
8 9 10 |
# File 'lib/waitress/request.rb', line 8 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/waitress/request.rb', line 9 def path @path end |
#querystring ⇒ Object
Returns the value of attribute querystring.
11 12 13 |
# File 'lib/waitress/request.rb', line 11 def querystring @querystring end |
#uri ⇒ Object
Returns the value of attribute uri.
10 11 12 |
# File 'lib/waitress/request.rb', line 10 def uri @uri end |
Instance Method Details
#get_query ⇒ Object
The GET query for the request in the form of a hash. This is parsed on-request
28 29 30 31 |
# File 'lib/waitress/request.rb', line 28 def get_query @get ||= Waitress::QueryParser.parse(@querystring) @get end |
#post_query ⇒ Object
The POST query for the request in the form of a hash. This is parsed on-request
34 35 36 37 |
# File 'lib/waitress/request.rb', line 34 def post_query @post ||= Waitress::QueryParser.parse(@body) @post end |
#to_s ⇒ Object
39 40 41 42 |
# File 'lib/waitress/request.rb', line 39 def to_s m = lambda { |a,x| x.nil? ? "" : "#{a}=#{x.inspect}" } "#<#{self.class} method=#{@method} path=#{@path} #{m.call("query", @query)}>" end |