Class: ICAPrb::Server::RequestHeader
- Inherits:
-
HTTP_Header
- Object
- Hash
- HTTP_Header
- ICAPrb::Server::RequestHeader
- Defined in:
- lib/icaprb/server/data_structures.rb
Overview
The RequestHeader represents the header information of an HTTP request. It contains the status line as well as the other headers. The headers are accessible by the array access operator
Instance Attribute Summary collapse
-
#http_method ⇒ Object
The HTTP Method (also known as Verb) as a String.
-
#http_path ⇒ Object
the path requested by the user.
-
#http_version ⇒ Object
The HTTP version which is used by the application.
Instance Method Summary collapse
-
#<=>(value) ⇒ Object
The request header is always the first header and it can be included only once in an ICAP response.
-
#initialize(http_method, http_path, http_version = '1.1') ⇒ RequestHeader
constructor
- Initializes a new Object of
RequestHeaderParams:http_method -
The HTTP Method (also known as Verb) as a String.
- Initializes a new Object of
-
#request_line ⇒ Object
creates the request line for the request it will include the method, the path and the used http version.
Methods inherited from HTTP_Header
Constructor Details
#initialize(http_method, http_path, http_version = '1.1') ⇒ RequestHeader
Initializes a new Object of RequestHeader Params:
http_method-
The HTTP Method (also known as Verb) as a String. For Example GET, POST, PUT, DELETE or OPTIONS
http_path-
The Resource which has been requested by the user
http_version-
The HTTP version which is used by the application
53 54 55 56 57 |
# File 'lib/icaprb/server/data_structures.rb', line 53 def initialize(http_method, http_path, http_version = '1.1') @http_method = http_method @http_path = http_path @http_version = http_version end |
Instance Attribute Details
#http_method ⇒ Object
The HTTP Method (also known as Verb) as a String. For Example GET, POST, PUT, DELETE or OPTIONS
44 45 46 |
# File 'lib/icaprb/server/data_structures.rb', line 44 def http_method @http_method end |
#http_path ⇒ Object
the path requested by the user
42 43 44 |
# File 'lib/icaprb/server/data_structures.rb', line 42 def http_path @http_path end |
#http_version ⇒ Object
The HTTP version which is used by the application
46 47 48 |
# File 'lib/icaprb/server/data_structures.rb', line 46 def http_version @http_version end |
Instance Method Details
#<=>(value) ⇒ Object
The request header is always the first header and it can be included only once in an ICAP response
60 61 62 63 |
# File 'lib/icaprb/server/data_structures.rb', line 60 def <=>(value) return 0 if value.class == RequestHeader -1 end |
#request_line ⇒ Object
creates the request line for the request it will include the method, the path and the used http version.
67 68 69 |
# File 'lib/icaprb/server/data_structures.rb', line 67 def request_line "#{@http_method} #{@http_path} HTTP/#{@http_version}\r\n" end |