Module: Rex::Proto::Http::ServerClient
- Defined in:
- lib/rex/proto/http/server_client.rb
Overview
Runtime extension of the HTTP clients that connect to the server.
Instance Attribute Summary collapse
-
#keepalive ⇒ Object
Boolean that indicates whether or not the connection supports keep-alive.
-
#request ⇒ Object
The current request context.
-
#server ⇒ Object
A reference to the server the client is associated with.
Instance Method Summary collapse
-
#init_cli(server) ⇒ Object
Initialize a new request instance.
-
#reset_cli ⇒ Object
Resets the parsing state.
-
#send_response(response) ⇒ Object
Transmits a response and adds the appropriate headers.
Instance Attribute Details
#keepalive ⇒ Object
Boolean that indicates whether or not the connection supports keep-alive.
54 55 56 |
# File 'lib/rex/proto/http/server_client.rb', line 54 def keepalive @keepalive end |
#request ⇒ Object
The current request context.
50 51 52 |
# File 'lib/rex/proto/http/server_client.rb', line 50 def request @request end |
#server ⇒ Object
A reference to the server the client is associated with.
58 59 60 |
# File 'lib/rex/proto/http/server_client.rb', line 58 def server @server end |
Instance Method Details
#init_cli(server) ⇒ Object
Initialize a new request instance.
19 20 21 22 23 |
# File 'lib/rex/proto/http/server_client.rb', line 19 def init_cli(server) self.request = Request.new self.server = server self.keepalive = false end |
#reset_cli ⇒ Object
Resets the parsing state.
28 29 30 |
# File 'lib/rex/proto/http/server_client.rb', line 28 def reset_cli self.request.reset end |
#send_response(response) ⇒ Object
Transmits a response and adds the appropriate headers.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rex/proto/http/server_client.rb', line 35 def send_response(response) # Set the connection to close or keep-alive depending on what the client # can support. response['Connection'] = (keepalive) ? 'Keep-Alive' : 'close' # Add any other standard response headers. server.add_response_headers(response) # Send it off. put(response.to_s) end |