Class: Ronin::Web::Server::Request
- Inherits:
-
Sinatra::Request
- Object
- Sinatra::Request
- Ronin::Web::Server::Request
- Defined in:
- lib/ronin/web/server/request.rb
Overview
Convenience class that represents requests.
Direct Known Subclasses
Instance Method Summary collapse
-
#headers ⇒ Hash{String => String}
The HTTP Headers for the request.
-
#ip_with_port ⇒ String
Returns the remote IP address and port for the request.
Instance Method Details
#headers ⇒ Hash{String => String}
The HTTP Headers for the request.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ronin/web/server/request.rb', line 59 def headers headers = {} env.each do |name,value| if name =~ /^HTTP_/ header_words = name[5..].split('_') header_words.each(&:capitalize!) header_name = header_words.join('-') headers[header_name] = value end end return headers end |
#ip_with_port ⇒ String
Returns the remote IP address and port for the request.
43 44 45 46 47 48 49 |
# File 'lib/ronin/web/server/request.rb', line 43 def ip_with_port if env.has_key?('REMOTE_PORT') "#{ip}:#{env['REMOTE_PORT']}" else ip end end |