Module: Ronin::Listener::HTTP

Defined in:
lib/ronin/listener/http.rb,
lib/ronin/listener/http/server.rb,
lib/ronin/listener/http/request.rb,
lib/ronin/listener/http/version.rb

Overview

Top-level methods for HTTP.

Defined Under Namespace

Classes: Request, Server

Constant Summary collapse

VERSION =

ronin-listener-http version

'0.1.0'

Class Method Summary collapse

Class Method Details

.listen(**kwargs) {|request| ... } ⇒ Object

Starts the HTTP listener server.

Parameters:

Options Hash (**kwargs):

  • :host (String) — default: '0.0.0.0'

    The interface to listen on.

  • :port (Integer) — default: 80

    The local port to listen on.

  • :vhost (String, Regexp)

    The virtual host (vhost) to filter requests with.

  • :root (String) — default: '/'

    The root directory to filter requests with. Defaults to /.

Yields:

  • (request)

    The given block will be passed each received HTTP request.

Yield Parameters:

  • request (Request)

    The received HTTP request object.

Raises:

  • (ArgumentError)

    No callback block was given.



56
57
58
59
# File 'lib/ronin/listener/http.rb', line 56

def self.listen(**kwargs,&callback)
  server = Server.new(**kwargs,&callback)
  server.run
end