Class Puma::Server
In: lib/puma/server.rb
Parent: Object

The HTTP Server itself. Serves out a single Rack app.

Methods

Included Modules

Puma::Const

Attributes

app  [RW] 
auto_trim_time  [RW] 
binder  [RW] 
events  [R] 
leak_stack_on_error  [RW] 
max_threads  [RW] 
min_threads  [RW] 
persistent_timeout  [RW] 
thread  [R] 

Public Class methods

Create a server for the rack app app.

events is an object which will be called when certain error events occur to be handled. See Puma::Events for the list of current methods to implement.

Server#run returns a thread that you can join on to wait for the server to do it‘s work.

Public Instance methods

6 == Socket::IPPROTO_TCP 3 == TCP_CORK 1/0 == turn on/off

Wait for all outstanding requests to finish.

Given the request env from client and a partial request body in body, finish reading the body if there is one and invoke the rack app. Then construct the response and write it back to client

cl is the previously fetched Content-Length header if there was one. This is an optimization to keep from having to look it up again.

A fallback rack response if +@app+ raises as exception.

Given a Hash env for the request read from client, add and fixup keys to comply with Rack‘s env guidelines.

Given a connection on client, handle the incoming requests.

This method support HTTP Keep-Alive so it may, depending on if the client indicates that it supports keep alive, wait for another request before returning.

Given the requset env from client and the partial body body plus a potential Content-Length value cl, finish reading the body and return it.

If the body is larger than MAX_BODY, a Tempfile object is used for the body, otherwise a StringIO is used.

Runs the server.

If background is true (the default) then a thread is spun up in the background to handle requests. Otherwise requests are handled synchronously.

Stops the acceptor thread and then causes the worker threads to finish off the request queue before finally exiting.

[Validate]