Class: Ronin::Web::Server::ReverseProxy::Request

Inherits:
Ronin::Web::Server::Request show all
Defined in:
lib/ronin/web/server/reverse_proxy/request.rb

Overview

Class that represents a reverse proxied request.

Instance Method Summary collapse

Methods inherited from Ronin::Web::Server::Request

#headers, #ip_with_port

Instance Method Details

#accept_encoding=(new_encoding) ⇒ String

Changes the HTTP Accept-Encoding header of the request.

Parameters:

  • new_encoding (String)

    The new HTTP Accept-Encoding for the request.

Returns:

  • (String)

    The new HTTP Accept-Encoding 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.

Parameters:

  • new_body (String)

    The new body for the request.

Returns:

  • (String)

    The new 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.

Parameters:

  • new_content_type (String)

    The new HTTP Content-Type for the request.

Returns:

  • (String)

    The new HTTP Content-Type 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.

Parameters:

  • new_host (String)

    The new value of the HTTP Host header.

Returns:

  • (String)

    The new HTTP Host header.



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.

Parameters:

  • new_port (Integer)

    The new port the request will be sent to.

Returns:

  • (Integer)

    The new port the request will be 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.

Parameters:

  • new_query (String)

    The new HTTP Query String for the request.

Returns:

  • (String)

    The new 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.

Parameters:

  • new_referer (String)

    The new HTTP Referer header for the request.

Returns:

  • (String)

    The new 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.

Parameters:

  • new_method (String)

    The new HTTP Request Method.

Returns:

  • (String)

    The new HTTP Request Method.



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.

Parameters:

  • new_scheme (String)

    The new URI scheme for the request.

Returns:

  • (String)

    The new 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.

Parameters:

  • ssl (Boolean)

    Specifies whether to enable or disable SSL.

Returns:

  • (Boolean)

    Whether SSL is enabled or disabled.



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.

Parameters:

  • new_user_agent (String)

    The new User-Agent header to use.

Returns:

  • (String)

    The new User-Agent header.



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.

Parameters:

  • xhr (Boolean)

    Specifies whether the request is an XML HTTP Request.

Returns:

  • (Boolean)

    Specifies whether the request is an 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