Class: Ronin::Web::Server::ReverseProxy::Request
- Inherits:
-
Ronin::Web::Server::Request
- Object
- Sinatra::Request
- Ronin::Web::Server::Request
- Ronin::Web::Server::ReverseProxy::Request
- Defined in:
- lib/ronin/web/server/reverse_proxy/request.rb
Overview
Class that represents a reverse proxied request.
Instance Method Summary collapse
-
#accept_encoding=(new_encoding) ⇒ String
Changes the HTTP Accept-Encoding header of the request.
-
#body=(new_body) ⇒ String
Changes the body of the request.
-
#content_type=(new_content_type) ⇒ String
Changes the HTTP Content-Type header of the request.
-
#host=(new_host) ⇒ String
Changes the HTTP Host header of the request.
-
#port=(new_port) ⇒ Integer
Changes the port the request is being sent to.
-
#query_string=(new_query) ⇒ String
Changes the HTTP Query String of the request.
-
#referer=(new_referer) ⇒ String
(also: #referrer=)
Changes the HTTP
Referer
header of the request. -
#request_method=(new_method) ⇒ String
Changes the HTTP Request Method of the request.
-
#scheme=(new_scheme) ⇒ String
Changes the URI scheme of the request.
-
#ssl=(ssl) ⇒ Boolean
Toggles whether the request to be proxied over SSL.
-
#user_agent=(new_user_agent) ⇒ String
Sets the HTTP User-Agent header of the request.
-
#xhr=(xhr) ⇒ Boolean
Toggles whether the request is a XML HTTP Request.
Methods inherited from Ronin::Web::Server::Request
Instance Method Details
#accept_encoding=(new_encoding) ⇒ String
Changes the HTTP Accept-Encoding header of the request.
175 176 177 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 175 def accept_encoding=(new_encoding) @env['HTTP_ACCEPT_ENCODING'] = new_encoding end |
#body=(new_body) ⇒ String
Changes the body of the request.
222 223 224 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 222 def body=(new_body) @env['rack.input'] = new_body end |
#content_type=(new_content_type) ⇒ String
Changes the HTTP Content-Type header of the request.
160 161 162 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 160 def content_type=(new_content_type) @env['CONTENT_TYPE'] = new_content_type end |
#host=(new_host) ⇒ String
Changes the HTTP Host header of the request.
43 44 45 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 43 def host=(new_host) @env['HTTP_HOST'] = new_host end |
#port=(new_port) ⇒ Integer
Changes the port the request is being sent to.
58 59 60 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 58 def port=(new_port) @env['SERVER_PORT'] = new_port end |
#query_string=(new_query) ⇒ String
Changes the HTTP Query String of the request.
126 127 128 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 126 def query_string=(new_query) @env['QUERY_STRING'] = new_query end |
#referer=(new_referer) ⇒ String Also known as: referrer=
Changes the HTTP Referer
header of the request.
205 206 207 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 205 def referer=(new_referer) @env['HTTP_REFERER'] = new_referer end |
#request_method=(new_method) ⇒ String
Changes the HTTP Request Method of the request.
111 112 113 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 111 def request_method=(new_method) @env['REQUEST_METHOD'] = new_method end |
#scheme=(new_scheme) ⇒ String
Changes the URI scheme of the request.
73 74 75 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 73 def scheme=(new_scheme) @env['rack.url_scheme'] = new_scheme end |
#ssl=(ssl) ⇒ Boolean
Toggles whether the request to be proxied over SSL.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 88 def ssl=(ssl) if ssl self.port = 443 self.scheme = 'https' else self.port = 80 self.scheme = 'http' end return ssl end |
#user_agent=(new_user_agent) ⇒ String
Sets the HTTP User-Agent header of the request.
190 191 192 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 190 def user_agent=(new_user_agent) @env['HTTP_USER_AGENT'] = new_user_agent end |
#xhr=(xhr) ⇒ Boolean
Toggles whether the request is a XML HTTP Request.
141 142 143 144 145 146 147 |
# File 'lib/ronin/web/server/reverse_proxy/request.rb', line 141 def xhr=(xhr) if xhr then @env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' else @env.delete('HTTP_X_REQUESTED_WITH') end return xhr end |