| 1 | # $Id: FCGI.PL,v 1.37 2002/12/15 20:02:48 skimo Exp $ | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package FCGI; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | require Exporter; | |||||||||||||||||||||||||||
| 6 | 1 | require DynaLoader; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | @ISA = qw(Exporter DynaLoader); | |||||||||||||||||||||||||||
| 9 | # Items to export into callers namespace by default. Note: do not export | ||||||||||||||||||||||||||||
| 10 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||||||||||||||||||||
| 11 | # Do not simply export all your public functions/methods/constants. | ||||||||||||||||||||||||||||
| 12 | 1 | @EXPORT = qw( | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | $VERSION = q{0.71_03}; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | bootstrap FCGI; | |||||||||||||||||||||||||||
| 19 | 1 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||
| 20 | # Preloaded methods go here. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Autoload methods go after __END__, and are processed by the autosplit program. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | *FAIL_ACCEPT_ON_INTR = sub() { 1 }; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub Request(;***$*$) { | ||||||||||||||||||||||||||||
| 27 | 1 | ▶ | my @defaults = (\*STDIN, \*STDOUT, \*STDERR, \%ENV, 0, FAIL_ACCEPT_ON_INTR()); | ||||||||||||||||||||||||||
|
Subroutine
Request: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 1 | ▶ | $_[4] = fileno($_[4]) if defined($_[4]) && defined(fileno($_[4])); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_[4] and defined fileno $_[4]
MC/DC0%0/2
defined $_[4] and defined fileno $_[4]
defined $_[4]
defined fileno $_[4]
Truth table33%1/3
A and B
A= defined $_[4]B= defined fileno $_[4]
| |||||||||||||||||||||||||||||
| 29 | 1 | splice @defaults,0,@_,@_; | |||||||||||||||||||||||||||
| 30 | 1 | RequestX(@defaults); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub accept() { | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | warn "accept called as a method; you probably wanted to call Accept" if @_; | ||||||||||||||||||||||||||
|
Subroutine
accept: not called CC=7 SCAR=40.3
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (%FCGI::ENV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 0 | %ENV = %FCGI::ENV; | |||||||||||||||||||||||||||
| 37 | } else { | ||||||||||||||||||||||||||||
| 38 | 0 | %FCGI::ENV = %ENV; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 0 | my $rc = Accept($global_request); | |||||||||||||||||||||||||||
| 41 | 0 | for (keys %FCGI::ENV) { | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | $ENV{$_} = $FCGI::ENV{$_} unless exists $ENV{$_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | # not SFIO | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $SIG{__WARN__} = $warn_handler if (tied (*STDIN)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | $SIG{__DIE__} = $die_handler if (tied (*STDIN)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | return $rc; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | sub finish() { | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | warn "finish called as a method; you probably wanted to call Finish" if @_; | ||||||||||||||||||||||||||
|
Subroutine
finish: not called CC=6 SCAR=37.4
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | %ENV = %FCGI::ENV if %FCGI::ENV; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | # not SFIO | ||||||||||||||||||||||||||||
| 57 | 0 | ▶ | if (tied (*STDIN)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | delete $SIG{__WARN__} if ($SIG{__WARN__} == $warn_handler); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | delete $SIG{__DIE__} if ($SIG{__DIE__} == $die_handler); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | Finish ($global_request); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | sub flush() { | ||||||||||||||||||||||||||||
| 66 | 0 | ▶ | warn "flush called as a method; you probably wanted to call Flush" if @_; | ||||||||||||||||||||||||||
|
Subroutine
flush: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 0 | Flush($global_request); | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | sub detach() { | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | warn "detach called as a method; you probably wanted to call Detach" if @_; | ||||||||||||||||||||||||||
|
Subroutine
detach: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | Detach($global_request); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub attach() { | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | warn "attach called as a method; you probably wanted to call Attach" if @_; | ||||||||||||||||||||||||||
|
Subroutine
attach: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | Attach($global_request); | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | # deprecated | ||||||||||||||||||||||||||||
| 81 | ▶ | sub set_exit_status { | |||||||||||||||||||||||||||
|
Subroutine
set_exit_status: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | sub start_filter_data() { | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | StartFilterData($global_request); | ||||||||||||||||||||||||||
|
Subroutine
start_filter_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 1 | $global_request = Request(); | |||||||||||||||||||||||||||
| 89 | 0 | ▶ | $warn_handler = sub { print STDERR @_ }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $die_handler = sub { print STDERR @_ unless $^S }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | package FCGI::Stream; | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub PRINTF { | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | shift->PRINT(sprintf(shift, @_)); | ||||||||||||||||||||||||||
|
Subroutine
PRINTF: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | ▶ | sub BINMODE { | |||||||||||||||||||||||||||
|
Subroutine
BINMODE: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | sub READLINE { | ||||||||||||||||||||||||||||
| 102 | 0 | ▶ | my $stream = shift; | ||||||||||||||||||||||||||
|
Subroutine
READLINE: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 103 | 0 | my ($s, $c); | |||||||||||||||||||||||||||
| 104 | 0 | ▶ | my $rs = $/ eq '' ? "\n\n" : $/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 0 | my $l = substr $rs, -1; | |||||||||||||||||||||||||||
| 106 | 0 | my $len = length $rs; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | $c = $stream->GETC(); | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($/ eq '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | while ($c eq "\n") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 0 | $c = $stream->GETC(); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 0 | ▶ | while (defined $c) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 0 | $s .= $c; | |||||||||||||||||||||||||||
| 116 | 0 | ▶ | last if $c eq $l and substr($s, -$len) eq $rs; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$c eq $l and substr($s, -$len) eq $rs
MC/DC0%0/2
$c eq $l and substr($s, -$len) eq $rs
$c eq $l
substr($s, -$len) eq $rs
Truth table0%0/3
A and B
A= $c eq $lB= substr($s, -$len) eq $rs
| |||||||||||||||||||||||||||||
| 117 | 0 | $c = $stream->GETC(); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | 0 | $s; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub OPEN { | ||||||||||||||||||||||||||||
| 123 | 0 | ▶ | $_[0]->CLOSE; | ||||||||||||||||||||||||||
|
Subroutine
OPEN: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if (@_ == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | return open($_[0], $_[1]); | |||||||||||||||||||||||||||
| 126 | } else { | ||||||||||||||||||||||||||||
| 127 | 0 | my $rc; | |||||||||||||||||||||||||||
| 128 | 0 | eval("$rc = open($_[0], $_[1], $_[2])"); | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 0 | return $rc; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | # Some things (e.g. IPC::Run) use fileno to determine if a filehandle is open, | ||||||||||||||||||||||||||||
| 135 | # so we return a defined, but meaningless value. (-1 being the error return | ||||||||||||||||||||||||||||
| 136 | # value from the syscall in c, meaning it can never be a valid fd no) | ||||||||||||||||||||||||||||
| 137 | # Probably a better alternative would be to return the fcgi stream fd. | ||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub FILENO { -1 } | ||||||||||||||||||||||||||
|
Subroutine
FILENO: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 1 | 1; | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =pod | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | =head1 NAME | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | FCGI - Fast CGI module | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | use FCGI; | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | my $count = 0; | ||||||||||||||||||||||||||||
| 153 | my $request = FCGI::Request(); | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | while($request->Accept() >= 0) { | ||||||||||||||||||||||||||||
| 156 | print("Content-type: text/html\r\n\r\n", ++$count); | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | Functions: | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | =over 4 | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =item FCGI::Request | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Creates a request handle. It has the following optional parameters: | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | =over 8 | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | =item input perl file handle (default: \*STDIN) | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | =item output perl file handle (default: \*STDOUT) | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | =item error perl file handle (default: \*STDERR) | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | These filehandles will be setup to act as input/output/error | ||||||||||||||||||||||||||||
| 178 | on successful Accept. | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | =item environment hash reference (default: \%ENV) | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | The hash will be populated with the environment. | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =item socket (default: 0) | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | Socket to communicate with the server. | ||||||||||||||||||||||||||||
| 187 | Can be the result of the OpenSocket function. | ||||||||||||||||||||||||||||
| 188 | For the moment, it's the file descriptor of the socket | ||||||||||||||||||||||||||||
| 189 | that should be passed. This may change in the future. | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | You should only use your own socket if your program | ||||||||||||||||||||||||||||
| 192 | is not started by a process manager such as mod_fastcgi | ||||||||||||||||||||||||||||
| 193 | (except for the FastCgiExternalServer case) or cgi-fcgi. | ||||||||||||||||||||||||||||
| 194 | If you use the option, you have to let your FastCGI | ||||||||||||||||||||||||||||
| 195 | server know which port (and possibly server) your program | ||||||||||||||||||||||||||||
| 196 | is listening on. | ||||||||||||||||||||||||||||
| 197 | See remote.pl for an example. | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | =item flags (default: 0) | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | Possible values: | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | =over 12 | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | =item FCGI::FAIL_ACCEPT_ON_INTR | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | If set, Accept will fail if interrupted. | ||||||||||||||||||||||||||||
| 208 | It not set, it will just keep on waiting. | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | =back | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | =back | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | Example usage: | ||||||||||||||||||||||||||||
| 215 | my $req = FCGI::Request; | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | or: | ||||||||||||||||||||||||||||
| 218 | my %env; | ||||||||||||||||||||||||||||
| 219 | my $in = new IO::Handle; | ||||||||||||||||||||||||||||
| 220 | my $out = new IO::Handle; | ||||||||||||||||||||||||||||
| 221 | my $err = new IO::Handle; | ||||||||||||||||||||||||||||
| 222 | my $req = FCGI::Request($in, $out, $err, \%env); | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =item FCGI::OpenSocket(path, backlog) | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | Creates a socket suitable to use as an argument to Request. | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | =over 8 | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | =item path | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | Pathname of socket or colon followed by local tcp port. | ||||||||||||||||||||||||||||
| 233 | Note that some systems take file permissions into account | ||||||||||||||||||||||||||||
| 234 | on Unix domain sockets, so you'll have to make sure that | ||||||||||||||||||||||||||||
| 235 | the server can write to the created file, by changing | ||||||||||||||||||||||||||||
| 236 | the umask before the call and/or changing permissions and/or | ||||||||||||||||||||||||||||
| 237 | group of the file afterwards. | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =item backlog | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | Maximum length of the queue of pending connections. | ||||||||||||||||||||||||||||
| 242 | If a connection | ||||||||||||||||||||||||||||
| 243 | request arrives with the queue full the client may receive | ||||||||||||||||||||||||||||
| 244 | an error with an indication of ECONNREFUSED. | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | =back | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | =item FCGI::CloseSocket(socket) | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | Close a socket opened with OpenSocket. | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | =item $req->Accept() | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | Accepts a connection on $req, attaching the filehandles and | ||||||||||||||||||||||||||||
| 255 | populating the environment hash. | ||||||||||||||||||||||||||||
| 256 | Returns 0 on success. | ||||||||||||||||||||||||||||
| 257 | If a connection has been accepted before, the old | ||||||||||||||||||||||||||||
| 258 | one will be finished first. | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | Note that unlike with the old interface, no die and warn | ||||||||||||||||||||||||||||
| 261 | handlers are installed by default. This means that if | ||||||||||||||||||||||||||||
| 262 | you are not running an sfio enabled perl, any warn or | ||||||||||||||||||||||||||||
| 263 | die message will not end up in the server's log by default. | ||||||||||||||||||||||||||||
| 264 | It is advised you set up die and warn handlers yourself. | ||||||||||||||||||||||||||||
| 265 | FCGI.pm contains an example of die and warn handlers. | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | =item $req->Finish() | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | Finishes accepted connection. | ||||||||||||||||||||||||||||
| 270 | Also detaches filehandles. | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | =item $req->Flush() | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | Flushes accepted connection. | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =item $req->Detach() | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | Temporarily detaches filehandles on an accepted connection. | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =item $req->Attach() | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | Re-attaches filehandles on an accepted connection. | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =item $req->LastCall() | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | Tells the library not to accept any more requests on this handle. | ||||||||||||||||||||||||||||
| 287 | It should be safe to call this method from signal handlers. | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | Note that this method is still experimental and everything | ||||||||||||||||||||||||||||
| 290 | about it, including its name, is subject to change. | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | =item $env = $req->GetEnvironment() | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | Returns the environment parameter passed to FCGI::Request. | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | =item ($in, $out, $err) = $req->GetHandles() | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | Returns the file handle parameters passed to FCGI::Request. | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | =item $isfcgi = $req->IsFastCGI() | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | Returns whether or not the program was run as a FastCGI. | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | =back | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =HEAD1 LIMITATIONS | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | FCGI.pm isn't Unicode aware, only characters within the range 0x00-0xFF are | ||||||||||||||||||||||||||||
| 309 | supported. Attempts to output strings containing characters above 0xFF results | ||||||||||||||||||||||||||||
| 310 | in a exception: (F) C<Wide character in %s>. | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | Users who wants the previous (FCGI.pm <= 0.68) incorrect behavior can disable the | ||||||||||||||||||||||||||||
| 313 | exception by using the C<bytes> pragma. | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | { | ||||||||||||||||||||||||||||
| 316 | use bytes; | ||||||||||||||||||||||||||||
| 317 | print "\x{263A}"; | ||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | Sven Verdoolaege <skimo@kotnet.org> | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | =cut | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | __END__ | ||||||||||||||||||||||||||||