module Rex::Proto::Http::ServerClient

Runtime extension of the HTTP clients that connect to the server.

Attributes

keepalive[RW]

Boolean that indicates whether or not the connection supports keep-alive.

request[RW]

The current request context.

server[RW]

A reference to the server the client is associated with.

Public Instance Methods

init_cli(server) click to toggle source

Initialize a new request instance.

# File lib/rex/proto/http/server.rb, line 19
def init_cli(server)
  self.request   = Request.new
  self.server    = server
  self.keepalive = false
end
reset_cli() click to toggle source

Resets the parsing state.

# File lib/rex/proto/http/server.rb, line 28
def reset_cli
  self.request.reset
end
send_response(response) click to toggle source

Transmits a response and adds the appropriate headers.

# File lib/rex/proto/http/server.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