Class: FCGI::Server

### Home Classes Methods

### In Files

- lib/fcgi.rb

### Parent

Object

### Methods

- ::new
- #each_request
- #session

### Class/Module Index

Quicksearch

- FCGI
- FCGI::AbortRequestRecord
- FCGI::BeginRequestRecord
- FCGI::DataRecord
- FCGI::EndRequestRecord
- FCGI::FastCGISocket
- FCGI::GenericDataRecord
- FCGI::GetValuesRecord
- FCGI::ParamsRecord
- FCGI::Record
- FCGI::RecordBuffer
- FCGI::Request
- FCGI::Server
- FCGI::StdinDataRecord
- FCGI::StdoutDataRecord
- FCGI::UnknownTypeRecord
- FCGI::ValuesRecord

No matching classes.

# FCGI::Server

### Constants

DATA_UNIT

### Public Class Methods

new(server) click to toggle source

    # File lib/fcgi.rb, line 89
    def initialize(server)
      @server = server
      @buffers = {}
      @default_parameters = {
        "FCGI_MAX_CONNS" => 1,
        "FCGI_MAX_REQS"  => 1,
        "FCGI_MPX_CONNS" => true
      }
    end

### Public Instance Methods

each_request(&block) click to toggle source

    # File lib/fcgi.rb, line 99
    def each_request(&block)
      graceful = false
      trap("SIGUSR1") { graceful = true }
      while true
        begin
          session(&block)
        rescue Errno::EPIPE, EOFError
          # HTTP request is canceled by the remote user
        end
        exit 0 if graceful
      end
    end

session() click to toggle source

    # File lib/fcgi.rb, line 112
    def session
      sock, addr = *@server.accept
      return unless sock
      fsock = FastCGISocket.new(sock)
      req = next_request(fsock)
      yield req
      respond_to req, fsock, FCGI_REQUEST_COMPLETE
    ensure
      sock.close if sock and not sock.closed?
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.