logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SCGI - for implementing an SCGI interface for an application server

Author

       Thomas Yandell <mailto:tom+scgi@vipercode.com>

Description

publicmethods
       new Takes  a  socket  followed  by  a  set  of options (key value pairs) and returns a new SCGI listener.
           Currently the only supported option is blocking, to indicate that the  socket  blocks  and  that  the
           library should not treat it accordingly. By default blocking is false. (NOTE: blocking is now a named
           rather  than  positional  parameter.  Using  as a positional parameter will produce a warning in this
           version and will throw an exception in the next version).

       accept
           Accepts a connection from the socket and returns an "SCGI::Request" for it.

       socket
           Returns the socket that was passed to the constructor.

       blocking
           Returns true if it was indicated that the socket should be blocking when the SCGI object was created.

Known Issues

       The SCGI Apache2 module had a bug (for me at least), which resulted in segmentation faults. This appeared
       after version 1.2 (the version in Debian Sarge) and was fixed in 1.10.

       The SCGI Apache2 module has a bug where certain headers can be repeated. This is still present in version
       1.10. A patch has been accepted and this issue should be resolved in the  next  release.  This  modulenow
       issues a warning on a repeated header, rather than throwing an exception as in the previous version.

License

       This file is part of SCGI (perl SCGI library).

       This  program  is  free  software;  you can redistribute it and/or modify it under the same terms as Perl
       itself.

perl v5.36.0                                       2022-10-13                                          SCGI(3pm)

Name

       SCGI - for implementing an SCGI interface for an application server

Synopisis

         use SCGI;
         use IO::Socket;

         my $socket = IO::Socket::INET->new(Listen => 5, ReuseAddr => 1, LocalPort => 8080)
           or die "cannot bind to port 8080: $!";

         my $scgi = SCGI->new($socket, blocking => 1);

         while (my $request = $scgi->accept) {
           $request->read_env;
           read $request->connection, my $body, $request->env->{CONTENT_LENGTH};
           #
           print $request->connection "Content-Type: text/plain\n\nHello!\n";
         }

See Also