class M2R::Request
Abstraction over Mongrel 2 request @api public
Constants
- MONGREL2_BASE_HEADERS
@api private
- MONGREL2_HEADERS
@api private
- MONGREL2_UPLOAD_HEADERS
@api private
- TRUE_STRINGS
@api private
Attributes
@return [String] HTTP
Body of request
@return [String] Mongrel2
connection id sending this request
@return [String] HTTP
Path of request
@return [String] UUID of mongrel2 origin instance
Public Class Methods
@param [String] sender UUID of mongrel2 origin instance @param [String] conn_id
Mongrel2
connection id sending this request @param [String] path HTTP
Path of request @param [M2R::Headers] headers HTTP
headers of request @param [M2R::Headers] headers Additional mongrel2 headers @param [String] body HTTP
Body of request
# File lib/m2r/request.rb, line 42 def initialize(sender, conn_id, path, http_headers, mongrel_headers, body) @sender = sender @conn_id = conn_id @path = path @http_headers = http_headers @mongrel_headers = mongrel_headers @body = body @data = MultiJson.load(@body) if json? end
Public Instance Methods
@return [true, false] Internal mongrel2 message to handler issued when
message delivery is not possible because the client already disconnected and there is no connection with such {#conn_id}
# File lib/m2r/request.rb, line 96 def disconnect? json? and @data['type'] == 'disconnect' end
@return [M2R::Headers] HTTP
headers
# File lib/m2r/request.rb, line 65 def headers @http_headers end
# File lib/m2r/request.rb, line 89 def http_version @mongrel_headers['version'] end
@return [String] HTTP
method
# File lib/m2r/request.rb, line 75 def method @mongrel_headers['method'] end
@return [String] Mongrel2
pattern used to match this request
# File lib/m2r/request.rb, line 70 def pattern @mongrel_headers['pattern'] end
@return [String] Request
query string
# File lib/m2r/request.rb, line 80 def query @mongrel_headers['query'] end
return [String] URL scheme
# File lib/m2r/request.rb, line 85 def scheme @mongrel_headers['url_scheme'] || mongrel17_scheme end
Protected Instance Methods
# File lib/m2r/request.rb, line 107 def env_https (ENV['HTTPS'] || "").downcase end
# File lib/m2r/request.rb, line 111 def json? method == 'JSON' end
# File lib/m2r/request.rb, line 102 def mongrel17_scheme return 'https' if TRUE_STRINGS.include? env_https return 'http' end