Class: FCGI

Inherits:
Object
  • Object
show all
Defined in:
lib/cgialt/fcgi/core.rb,
lib/cgialt/fcgi/cgi_helper.rb

Defined Under Namespace

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

Constant Summary collapse

ProtocolVersion =
1
FCGI_BEGIN_REQUEST =

Record types

1
FCGI_ABORT_REQUEST =
2
FCGI_END_REQUEST =
3
FCGI_PARAMS =
4
FCGI_STDIN =
5
FCGI_STDOUT =
6
FCGI_STDERR =
7
FCGI_DATA =
8
FCGI_GET_VALUES =
9
FCGI_GET_VALUES_RESULT =
10
FCGI_UNKNOWN_TYPE =
11
FCGI_MAXTYPE =
FCGI_UNKNOWN_TYPE
FCGI_NULL_REQUEST_ID =
0
FCGI_RESPONDER =

FCGI_BEGIN_REQUSET.role

1
FCGI_AUTHORIZER =
2
FCGI_FILTER =
3
FCGI_KEEP_CONN =

FCGI_BEGIN_REQUEST.flags

1
FCGI_REQUEST_COMPLETE =

FCGI_END_REQUEST.protocolStatus

0
FCGI_CANT_MPX_CONN =
1
FCGI_OVERLOADED =
2
FCGI_UNKNOWN_ROLE =
3

Class Method Summary collapse

Class Method Details

.default_connectionObject



49
50
51
# File 'lib/cgialt/fcgi/core.rb', line 49

def self::default_connection
  ::Socket.for_fd($stdin.fileno)
end

.each(&block) ⇒ Object



35
36
37
38
39
40
# File 'lib/cgialt/fcgi/core.rb', line 35

def self::each(&block)
  f = default_connection()
  Server.new(f).each_request(&block)
ensure
  f.close if f
end

.each_cgi(arg = nil) {|CGI.new(arg)| ... } ⇒ Object

Yields:

  • (CGI.new(arg))


22
23
24
25
# File 'lib/cgialt/fcgi/cgi_helper.rb', line 22

def FCGI.each_cgi(arg=nil)
  #require 'cgialt' unless defined?(CGI)
  yield CGI.new(arg)
end

.each_request(&block) ⇒ Object



42
43
44
45
46
47
# File 'lib/cgialt/fcgi/core.rb', line 42

def self::each_request(&block)
  f = default_connection()
  Server.new(f).each_request(&block)
ensure
  f.close if f
end

.is_cgi?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cgialt/fcgi/core.rb', line 23

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