Methods

Rocket uses Methods as a way to serve different types of content. Currently there are two methods:

  • fs - Serves files from a specified directory.
  • wsgi - Serves a WSGI-compliant application.

WSGI

The wsgi method is implemented by the WSGIWorker class.

The app_info property for the WSGIWorker should be a dictionary containing the following:

  • wsgi_app: an instance of the WSGI application Rocket should serve.

Rocket provides the following environment variables to applications that it runs in addition to WSGI’s standard environment variables:

  • REMOTE_PORT - the port from which the client computer is connecting.
  • REMOTE_ADDR - the IP address of the device directly connected to the server. Note: IP addresses can be spoofed or hidden behind a proxy, NAT device or redirector. This IP address is not guaranteed to reflect the true client’s IP address.

Since Rocket does not currently support HTTP-authentication, REMOTE_USER is never provided.

FS

The fs method is implemented by the FileSystemWorker class.

The app_info property for the FileSystemWorker should contain the following:

  • document_root: a string-value path to the directory that will serve as the root for serving files.
  • display_index: a boolean-value indicating if an HTML index of a directory should be served if a directory is requested.

Table Of Contents

Previous topic

Using Rocket

Next topic

Design

This Page