Skip to content

stattrak-dragonlore/cSCGI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

* What's it?
  A scgi server written in C, mostly translated from the Python
  scgi server (http://python.ca/scgi/)

* How to use it?

  1. Include these 2 headers:

     #include <unistd.h>
     #include "scgi.h"


  2. Define your own connection handler [and child initialization hook].

   struct scgi_handler handler = {
   	  .child_init_hook = NULL,
   	  .handle_connection = handle_connection,
   };

   child_init_hook() is where you can do some initialization work before
   handling connections, leave it NULL if nothing to do.

   handle_connection(int conn) is called when a new connection has been
   established. You should define this handler function.


  3. Declare a scgi_server and initialize it with:

   void init_scgi(struct scgi_server *server, unsigned short port,
   	          int max_children, struct scgi_handler *handler)


  4. Call int serve_scgi(struct scgi_server *server) to serve forever.

     That's all, read demo.c for a complete example.

      $ make
      $ ./demo_server

     A scgi server is serving on DEFAULT_PORT(4000)...




About

scgi server in c

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages