Class: FCGI

### Home Classes Methods

### In Files

- lib/fcgi.rb

### Parent

Object

### Namespace

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

### Methods

- ::default_connection
- ::each
- ::each_cgi
- ::each_request
- ::is_cgi?

### 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

There is no C version of 'each_cgi' Note: for ruby-1.6.8 at least, the constants CGI_PARAMS/CGI_COOKIES are defined within module 'CGI', even if you have subclassed it

### Constants

FCGI_ABORT_REQUEST
FCGI_AUTHORIZER
FCGI_BEGIN_REQUEST

  Record types

FCGI_CANT_MPX_CONN
FCGI_DATA
FCGI_END_REQUEST
FCGI_FILTER
FCGI_GET_VALUES
FCGI_GET_VALUES_RESULT
FCGI_KEEP_CONN

  FCGI_BEGIN_REQUEST.flags

FCGI_MAXTYPE
FCGI_NULL_REQUEST_ID
FCGI_OVERLOADED
FCGI_PARAMS
FCGI_REQUEST_COMPLETE

  FCGI_END_REQUEST.protocolStatus

FCGI_RESPONDER

  FCGI_BEGIN_REQUSET.role

FCGI_STDERR
FCGI_STDIN
FCGI_STDOUT
FCGI_UNKNOWN_ROLE
FCGI_UNKNOWN_TYPE
ProtocolVersion

### Public Class Methods

default_connection() click to toggle source

    # File lib/fcgi.rb, line 48
    def self::default_connection
      ::Socket.for_fd($stdin.fileno)
    end

each(&block) click to toggle source

    # File lib/fcgi.rb, line 34
    def self::each(&block)
      f = default_connection()
      Server.new(f).each_request(&block)
    ensure
      f.close if f
    end

each_cgi(*args) click to toggle source

    # File lib/fcgi.rb, line 567
    def self::each_cgi(*args)
      require 'cgi'

      eval(    class CGI      public :env_table      def self::remove_params        if (const_defined?(:CGI_PARAMS))          remove_const(:CGI_PARAMS)          remove_const(:CGI_COOKIES)        end      end    end # ::CGI class    class FCGI      class CGI < ::CGI        def initialize(request, *args)          ::CGI.remove_params          @request = request          super(*args)          @args = *args        end        def args          @args        end        def env_table          @request.env        end        def stdinput          @request.in        end        def stdoutput          @request.out        end      end # FCGI::CGI class    end # FCGI class,TOPLEVEL_BINDING)

      if FCGI::is_cgi?
        yield ::CGI.new(*args)
      else
        exit_requested = false
        FCGI::each {|request|
          $stdout, $stderr = request.out, request.err

          yield CGI.new(request, *args)

          request.finish
        }
      end
    end

each_request(&block) click to toggle source

    # File lib/fcgi.rb, line 41
    def self::each_request(&block)
      f = default_connection()
      Server.new(f).each_request(&block)
    ensure
      f.close if f
    end

is_cgi?() click to toggle source

    # File lib/fcgi.rb, line 22
    def self::is_cgi?
      begin
        s = Socket.for_fd($stdin.fileno)
        s.getpeername
        false
      rescue Errno::ENOTCONN
        false
      rescue Errno::ENOTSOCK, Errno::EINVAL
        true
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.