[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters]

Arc de Triomphe clipart (2486 bytes)

Small-FCGI: SmallEiffel Bindings for Fast CGI


Written by Lyn Headley.

Version 1.0

Small-FCGI-0_1.tar.gz (54,000 bytes) - source code
laheadle@cs.uchicago.edu Lyn Headley (maintainer) mail address.


Small-FCGI: Eiffel bindings for the Fast CGI high-performance web architecture

What Is It?

Small-FCGI is a set of SmallEiffel bindings for the Fast CGI web architecture. The Fast CGI protocol allows for the creation of high-performance web applications by greatly reducing program initialization time, an inherent performance bottleneck in short-lived CGI programs. In contrast to CGI programs, Fast CGI servers are persistent . Therefore, expensive initialization procedures can be performed once, at application start-up time. The effect on performance can be tremendous!

Some Documentation

It's a simple interface, so there's not much to document. Here is the short form of the base class FCGI,

class interface FCGI
   --  FIXME: add DBC

feature(s) from FCGI
   --  basic FCGI functionality

   fcgi_accept: INTEGER
      --  accept fastcgi connection

   fcgi_finish
      --  finish fastcgi connection

   fcgi_flush
      --  flush fastcgi output/error

   fcgi_print (str: STRING)
      --  print str to "standard output"

   fcgi_warn (str: STRING)
      --  print str to "standard error"

   fcgi_read (amount: INTEGER): STRING
      --  read amount characters from "standard input"

   fcgi_getenv (var: STRING): STRING
      --  get the value of the named environment variable

feature(s) from FCGI
   --  higher level services

   getenv_integer (var: STRING): INTEGER
      --  fetch and convert environment variable
      --  returns 0 on failure (bad idea?)


end of FCGI

and here is an example showing how it might be used.

class FCGI_TEST

inherit
   FCGI

creation
   make

feature

   make is
      local
         read_str: STRING
         content_length: INTEGER
      do
         from
         until
            fcgi_accept < 0
         loop
            -- this should appear in the logs
            fcgi_warn("Accepted -- YEAH! %N")

            content_length := getenv_integer("CONTENT_LENGTH")

            fcgi_print("Content-type: text/html%R%N%R%N")
            fcgi_print("TESTING<br>%N")

            fcgi_print("Content Length: ")
            fcgi_print(content_length.to_string)
            fcgi_print("<br>%N")
       
            if content_length > 0 then
               read_str := fcgi_read(content_length)
               fcgi_print("Content: ")
               fcgi_print(read_str)
               fcgi_print("%N")
            end -- if
         end -- loop
      end -- make

end -- class FCGI_TEST

There are more docs at www.fastcgi.com

I appreciate feedback.

Lyn Headley: laheadle@cs.uchicago.edu
Homepage: http://www.cs.uchicago.edu/~laheadle/Small-FCGI/
07 September 1999 (Added to Eiffel Forum Archive: 23 December 1999)


[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters]