Hello community,
here is the log from the commit of package python-scgi
checked in at Sun Aug 5 17:39:08 CEST 2007.
--------
--- python-scgi/python-scgi.changes 2006-10-20 18:59:35.000000000 +0200
+++ /mounts/work_src_done/STABLE/python-scgi/python-scgi.changes 2007-08-05 17:37:25.798045000 +0200
@@ -1,0 +2,15 @@
+Fri Apr 13 16:49:26 CEST 2007 - mrueckert@suse.de
+
+- update to version 1.12:
+ - Provide a new overridable method in SCGIHandler, produce(), as
+ a more user-friendly alternative to handle_connection().
+ Another new alternative is produce_cgilike() which receives the
+ request payload on standard input and is expected to write its
+ results to standard output.
+ (Jeroen T. Vermeulen )
+ - Define the CMSG_LEN and CMSG_SPACE macros if the platform
+ doesn't provide them. (Neil Schemenauer )
+ - Add guide.html document.
+ (Jeroen T. Vermeulen )
+
+-------------------------------------------------------------------
Old:
----
scgi-1.11.tar.bz2
New:
----
scgi-1.12.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-scgi.spec ++++++
--- /var/tmp/diff_new_pack.A26162/_old 2007-08-05 17:39:03.000000000 +0200
+++ /var/tmp/diff_new_pack.A26162/_new 2007-08-05 17:39:03.000000000 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package python-scgi (Version 1.11)
+# spec file for package python-scgi (Version 1.12)
#
-# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@@ -15,7 +15,7 @@
%define apxs /usr/sbin/apxs2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_mmn %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
-Version: 1.11
+Version: 1.12
Release: 1
Group: Development/Libraries/Python
License: Other uncritical OpenSource License
@@ -52,6 +52,8 @@
This package contains the apache2 module.
+To load mod_python into Apache, run the command "a2enmod scgi" as root.
+
Authors:
@@ -85,7 +87,19 @@
%{apache_libexecdir}/mod_scgi.so
%doc README.txt cgi2scgi.c CHANGES.txt LICENSE.txt README.apache2.txt
-%changelog -n python-scgi
+%changelog
+* Fri Apr 13 2007 - mrueckert@suse.de
+- update to version 1.12:
+ - Provide a new overridable method in SCGIHandler, produce(), as
+ a more user-friendly alternative to handle_connection().
+ Another new alternative is produce_cgilike() which receives the
+ request payload on standard input and is expected to write its
+ results to standard output.
+ (Jeroen T. Vermeulen )
+ - Define the CMSG_LEN and CMSG_SPACE macros if the platform
+ doesn't provide them. (Neil Schemenauer )
+ - Add guide.html document.
+ (Jeroen T. Vermeulen )
* Fri Sep 22 2006 - poeml@suse.de
- remove libapr-util1-devel from Buildrequires, since the correct
one comes with apache2-devel
++++++ scgi-1.11.tar.bz2 -> scgi-1.12.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/apache1/mod_scgi.c new/scgi-1.12/apache1/mod_scgi.c
--- old/scgi-1.11/apache1/mod_scgi.c 2006-08-14 21:13:08.000000000 +0200
+++ new/scgi-1.12/apache1/mod_scgi.c 2006-08-26 01:43:03.000000000 +0200
@@ -1,4 +1,4 @@
-#define MOD_SCGI_VERSION "1.11"
+#define MOD_SCGI_VERSION "1.12"
#define SCGI_PROTOCOL_VERSION "1"
/* #define VERBOSE_DEBUG */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/apache2/mod_scgi.c new/scgi-1.12/apache2/mod_scgi.c
--- old/scgi-1.11/apache2/mod_scgi.c 2006-08-14 21:15:09.000000000 +0200
+++ new/scgi-1.12/apache2/mod_scgi.c 2006-08-26 01:43:07.000000000 +0200
@@ -4,7 +4,7 @@
*
*/
-#define MOD_SCGI_VERSION "1.11"
+#define MOD_SCGI_VERSION "1.12"
#define SCGI_PROTOCOL_VERSION "1"
#include "ap_config.h"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/CHANGES.txt new/scgi-1.12/CHANGES.txt
--- old/scgi-1.11/CHANGES.txt 2006-08-14 20:06:04.000000000 +0200
+++ new/scgi-1.12/CHANGES.txt 2006-10-03 02:15:10.000000000 +0200
@@ -1,6 +1,24 @@
Summary of changes
==================
+1.12 (2006-10-02)
+-----------------------
+
+Jeroen T. Vermeulen
+ Provide a new overridable method in SCGIHandler, produce(), as a more
+ user-friendly alternative to handle_connection(). Another new
+ alternative is produce_cgilike() which receives the request payload on
+ standard input and is expected to write its results to standard
+ output.
+
+Neil Schemenauer :
+ Define the CMSG_LEN and CMSG_SPACE macros if the platform doesn't
+ provide them.
+
+Jeroen T. Vermeulen
+ Add guide.html document.
+
+
1.11 (released 2006-08-14)
--------------------------
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/doc/guide.html new/scgi-1.12/doc/guide.html
--- old/scgi-1.11/doc/guide.html 1970-01-01 01:00:00.000000000 +0100
+++ new/scgi-1.12/doc/guide.html 2006-10-03 02:04:29.000000000 +0200
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="us-ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="CONTENT-TYPE" content="text/html; charset=us-ascii" />
+ <title>SCGI Guide</title>
+ <style type="text/css">
+/*<![CDATA[*/
+ <!--
+ @page { margin: 0.79in }
+ -->
+/*]]>*/
+</style>
+ </head>
+ <body lang="en-GB" xml:lang="en-GB">
+ <h1>Using SCGI with Apache 2.x and Python</h1>
+ <p>This guide describes how to use SCGI with Apache 2.x, to serve an
+ application written in Python. The SCGI package also comes with modules
+ to use the protocol with Apache 1.x or <tt>lighttpd</tt>, and
+ frameworks for applications in other languages are available (including
+ LISP).</p>
+ <p>A complete setup for an SCGI application involves these four
+ components:</p>
+ <ol>
+ <li>
+ <p style="margin-bottom: 0in">A web server to process incoming
+ <tt>http</tt> requests--in our case, Apache 2.</p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">The Apache SCGI module to delegate
+ requests over the SCGI protocol.</p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">An SCGI server process based on the
+ Python <tt>scgi_server</tt> module.</p>
+ </li>
+ <li>
+ <p>An application to be run in child processes forked off by the
+ server process.</p>
+ </li>
+ </ol>
+ <p>A single SCGI server process serves only one application, but
+ multiple instances of it. Each instance lives in its own child process
+ of the SCGI server. More child processes are created on demand.</p>
+ <h2>Apache module</h2>
+ <p>To install the module by hand, <tt>cd</tt> into the <tt>apache2</tt>
+ subdirectory of the SCGI source tree, and, as root, <tt>make
+ install</tt>. On Debian-based systems and Gentoo, however, just install
+ the <tt>libapache2-mod-scgi</tt> package. RPM users can install
+ <tt>apache2-mod_scgi</tt>.</p>
+ <p>Next, set up the webserver to load the module and delegate requests
+ (in this example, for the <tt>http</tt> path "<tt>/dynamic</tt>") to a
+ separate server process accepting SCGI requests over a TCP socket. That
+ server will typically run on the same machine as the <tt>http</tt>
+ server, but it doesn't have to. Here's a snippet of Apache 2 config to
+ delegate requests for the <tt>http</tt> path <tt>/dynamic</tt> to local
+ TCP port 4000, which is the default:</p>
+ <pre>
+# (This actually better set up permanently with the command line
+# "a2enmod scgi" but shown here for completeness)
+LoadModule scgi_module /usr/lib/apache2/modules/mod_scgi.so
+
+# Set up a location to be served by an SCGI server process
+SCGIMount /dynamic/ 127.0.0.1:4000
+</pre>
+ <p>The deprecated way of delegating requests to an SCGI server
+ is as follows:</p>
+ <pre>
+<Location "/dynamic">
+ # Enable SCGI delegation
+ SCGIHandler On
+ # Delegate requests in the "/dynamic" path to daemon on local
+ # server, port 4000
+ SCGIServer 127.0.0.1:4000
+</Location>
+</pre>
+ <p>Note that using <tt>SCGIMount</tt> instead of <tt>SCGIServer</tt>
+ allows Apache to compute <tt>PATH_INFO</tt> as most software
+ expects.</p>
+ <p>Here's a description of the configuration directives accepted by
+ this Apache module. The information is largely derived from the source,
+ so please excuse (or better yet: help improve) poor descriptions:</p>
+ <table width="99%" border="0" cellpadding="2" cellspacing="0">
+ <col width="43*" />
+ <col width="52*" />
+ <col width="57*" />
+ <col width="103*" />
+ <tr>
+ <th width="17%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Directive</strong>
+ </p>
+ </th>
+ <th width="20%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Arguments</strong>
+ </p>
+ </th>
+ <th width="22%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Example</strong>
+ </p>
+ </th>
+ <th width="40%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Description</strong>
+ </p>
+ </th>
+ </tr>
+ <tr>
+ <td width="17%" bgcolor="#E6E6E6">
+ <p>
+ <tt>SCGIMount</tt>
+ </p>
+ </td>
+ <td width="20%" bgcolor="#E6E6E6">
+ <p><tt>http</tt> path and IP/port pair</p>
+ </td>
+ <td width="22%" bgcolor="#E6E6E6">
+ <p>
+ <tt>/dynamic 127.0.0.1:4000</tt>
+ </p>
+ </td>
+ <td width="40%" bgcolor="#E6E6E6">
+ <p>Path prefix and address of SCGI server</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="17%" bgcolor="#E6E6E6">
+ <p>
+ <tt>SCGIServer</tt>
+ </p>
+ </td>
+ <td width="20%" bgcolor="#E6E6E6">
+ <p>IP address and port</p>
+ </td>
+ <td width="22%" bgcolor="#E6E6E6">
+ <p>
+ <tt>127.0.0.1:4000</tt>
+ </p>
+ </td>
+ <td width="40%" bgcolor="#E6E6E6">
+ <p>Address and port of an SCGI server</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="17%" bgcolor="#E6E6E6">
+ <p>
+ <tt>SCGIHandler</tt>
+ </p>
+ </td>
+ <td width="20%" bgcolor="#E6E6E6">
+ <p><em>On</em> or <em>Off</em></p>
+ </td>
+ <td width="22%" bgcolor="#E6E6E6">
+ <p>
+ <tt>On</tt>
+ </p>
+ </td>
+ <td width="40%" bgcolor="#E6E6E6">
+ <p>Enable delegation of requests through SCGI</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="17%" bgcolor="#E6E6E6">
+ <p>
+ <tt>SCGIServerTimeout</tt>
+ </p>
+ </td>
+ <td width="20%" bgcolor="#E6E6E6">
+ <p>Number of seconds</p>
+ </td>
+ <td width="22%" bgcolor="#E6E6E6">
+ <p>10</p>
+ </td>
+ <td width="40%" bgcolor="#E6E6E6">
+ <p>Timeout for communication with SCGI server</p>
+ </td>
+ </tr>
+ </table>
+ <h2>Server process</h2>
+ <p>To install the Python module for creating SCGI applications, go to
+ the main SCGI source directory and run <tt><em>python setup.py
+ build</em></tt> and then, as <tt>root</tt>, <em><tt>python setup.py
+ install</tt>.</em> Or, on most GNU/Linux systems, just install the
+ <tt>python-scgi</tt> package.</p>
+ <p>The hard part is creating that application server process. The SCGI
+ home page provides a server implementation in Python, called
+ <tt>scgi_server.py</tt>, but this is really just a kind of support
+ module. In order to port an application to use this server, write a
+ main program in Python that imports this module and uses it. There is
+ one, fairly complex, example that makes an application called <a href="http://www.quixote.ca/">Quixote</a> run over
+ SCGI.</p>
+ <p>The main program that you write for yourself creates a handler class
+ describing how requests should be processed. You then tell the SCGI
+ server module to loop forever, handling incoming requests and creating
+ processes running your handler class as needed. <em>It is your own
+ responsibility to ensure that the server process is running.</em></p>
+ <p>Once the SCGI server process runs, it can accept requests forwarded
+ by the <tt>http</tt> server. It will attempt to delegate every request
+ that comes in to an existing child process, invoking its handler. If no
+ child process is free to take the request, an additional child process
+ is spawned (if the configured maximum number of child processes is not
+ exceeded; if it is, the request blocks until a child process becomes
+ free). If a handler "dies" (e.g. exits with an exception), a new child
+ is spawned to replace it.</p>
+ <h3>Writing a handler</h3>
+ <p>The server process must <tt>import scgi_server</tt>, then derive
+ handler classes from <tt>scgi_server.SCGIHandler</tt>. Just
+ <tt>scgi_server.py</tt> can also be run standalone, in which case it
+ return pages displaying the details of your browser's request.</p>
+ <p>Your handler class should be derived from the <tt>SCGIHandler</tt>
+ class defined in <tt>scgi_server.py</tt>, and override its
+ <tt>produce()</tt> function to process a request. This is new in SCGI
+ 1.12. Before that, the function to override was
+ <tt>handle_connection()</tt> which involved a lot more work.</p>
+ <p>Besides <em><tt>self</tt>,</em> the <tt>produce()</tt> function
+ takes several arguments:</p>
+ <ol>
+ <li>
+ <p style="margin-bottom: 0in">
+ <em>a dict mapping names of CGI
+ parameters to request details</em>
+ </p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">
+ <em>size (in bytes) of the request
+ body</em>
+ </p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">
+ <em>an input stream providing the
+ request body</em>
+ </p>
+ </li>
+ <li>
+ <p>
+ <em>an output stream to write a page to.</em>
+ </p>
+ </li>
+ </ol>
+ <p>Alternatively, override <tt>SCGIHandler.produce_cgilike()</tt> which
+ can read the request body from standard input, write its output to
+ standard output, and receives its request details both as an argument
+ dict and added to its environment variables.</p>
+ <p>Your output should start out with an <tt>http</tt> header, so
+ normally you'd want to start out with something like <tt>"Content-Type:
+ text/plain\r\n\r\n"</tt> followed by page content.</p>
+ <p>Besides a header containing CGI variables, the request may also
+ contain a body. The length of this body is passed as the CGI parameter
+ <tt>CONTENT_LENGTH</tt>, but for your convenience is also converted to
+ an integer and passed separately to the <tt>produce()</tt> function. If
+ your handler needs the request body, it can read this number of bytes
+ from its input socket. Do not rely on EOF; explicitly read the correct
+ number of bytes (or less, if that's what you want).</p>
+ <h3>Writing a server</h3>
+ <p>Your main SCGI server program should create an <tt>SCGIServer</tt>
+ object (defined in <tt>scgi_server.py</tt>), passing in your handler
+ class for the <tt>handler_class</tt> parameter, and then call its
+ <tt>serve()</tt> method which will loop indefinitely to process
+ requests:</p>
+ <pre>
+def main():
+ SCGIServer(handler_class=MyAppHandler).serve()
+
+if __name__ == "__main__":
+ main()
+</pre>
+ <p>You may want to support command-line options to influence various
+ options of the server's operation. The <tt>SCGIServer</tt>
+ initialization function takes several arguments:</p>
+ <center>
+ <table width="67%" border="0" cellpadding="2" cellspacing="0">
+ <col width="53*" />
+ <col width="157*" />
+ <col width="46*" />
+ <tr>
+ <th width="21%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Name</strong>
+ </p>
+ </th>
+ <th width="61%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Meaning</strong>
+ </p>
+ </th>
+ <th width="18%" bgcolor="#E6E6E6">
+ <p>
+ <strong>Default</strong>
+ </p>
+ </th>
+ </tr>
+ <tr>
+ <td width="21%" bgcolor="#E6E6E6">
+ <p>
+ <tt>handler_class</tt>
+ </p>
+ </td>
+ <td width="61%" bgcolor="#E6E6E6">
+ <p>Class (not object!) of handler to invoke for requests</p>
+ </td>
+ <td width="18%" bgcolor="#E6E6E6">
+ <p>
+ <tt>SCGIHandler</tt>
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td width="21%" bgcolor="#E6E6E6">
+ <p>
+ <tt>host</tt>
+ </p>
+ </td>
+ <td width="61%" bgcolor="#E6E6E6">
+ <p>Local IP address to bind to</p>
+ </td>
+ <td width="18%" bgcolor="#E6E6E6">
+ <p>
+ <em>empty string</em>
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td width="21%" bgcolor="#E6E6E6">
+ <p>
+ <tt>port</tt>
+ </p>
+ </td>
+ <td width="61%" bgcolor="#E6E6E6">
+ <p>TCP port to listen on</p>
+ </td>
+ <td width="18%" bgcolor="#E6E6E6">
+ <p>4000</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="21%" bgcolor="#E6E6E6">
+ <p>
+ <tt>max_children</tt>
+ </p>
+ </td>
+ <td width="61%" bgcolor="#E6E6E6">
+ <p>Maximum number of child processes to spawn</p>
+ </td>
+ <td width="18%" bgcolor="#E6E6E6">
+ <p>5</p>
+ </td>
+ </tr>
+ </table>
+ </center>
+ <h2>Links</h2>
+ <ul>
+ <li>
+ <p style="margin-bottom: 0in">
+ <a href="http://python.ca/nas/scgi/">SCGI home
+ page</a>
+ </p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">
+ <a href="http://quixote.python.ca/releases/">SCGI download</a>
+ </p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">
+ <a href="http://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/DjangoScgi">
+ Setting up Django with SCGI</a>
+ </p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">
+ <a href="http://www.rexx.com/%7Edkuhlman/quixote_scgi.html">Setting up
+ Quixote with SCGI</a>
+ </p>
+ </li>
+ <li>
+ <p style="margin-bottom: 0in">
+ <a href="http://www.zedshaw.com/projects/scgi_rails/">Using Ruby on Rails
+ with SCGI</a>
+ </p>
+ </li>
+ <li>
+ <p>bazaar-ng (<em>bzr</em>) repository: <a href="http://quixote.python.ca/scgi.dev/">http://quixote.python.ca/scgi.dev/</a></p>
+ </li>
+ </ul>
+ </body>
+</html>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/MANIFEST.in new/scgi-1.12/MANIFEST.in
--- old/scgi-1.11/MANIFEST.in 2006-08-14 20:10:21.000000000 +0200
+++ new/scgi-1.12/MANIFEST.in 2006-10-03 02:15:24.000000000 +0200
@@ -1,5 +1,6 @@
include *.txt MANIFEST.in setup.py cgi2scgi.c
include doc/*.txt
+include doc/*.html
include apache1/mod_scgi.c
include apache1/README.txt
include apache1/Makefile
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/PKG-INFO new/scgi-1.12/PKG-INFO
--- old/scgi-1.11/PKG-INFO 2006-08-14 21:15:20.000000000 +0200
+++ new/scgi-1.12/PKG-INFO 2006-10-03 02:15:41.000000000 +0200
@@ -1,10 +1,19 @@
Metadata-Version: 1.0
Name: scgi
-Version: 1.11
+Version: 1.12
Summary: A Python package for implementing SCGI servers.
-Home-page: http://www.mems-exchange.org/software/scgi/
+Home-page: UNKNOWN
Author: Neil Schemenauer
-Author-email: nas@mems-exchange.org
-License: see LICENSE.txt
+Author-email: nas@arctrix.com
+License: DFSG approved (see LICENSE.txt)
+Download-URL: http://quixote.python.ca/releases/scgi-1.12.tar.gz
Description: UNKNOWN
Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Web Environment
+Classifier: License :: DFSG approved
+Classifier: Intended Audience :: Developers
+Classifier: Operating System :: Unix
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/README.txt new/scgi-1.12/README.txt
--- old/scgi-1.11/README.txt 2006-05-19 17:33:43.000000000 +0200
+++ new/scgi-1.12/README.txt 2006-10-03 02:13:44.000000000 +0200
@@ -11,6 +11,9 @@
Software
--------
+ See doc/guide.html for an overview of how SCGI works. Below is a
+ list of components included in this package.
+
scgi
----
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/scgi/__init__.py new/scgi-1.12/scgi/__init__.py
--- old/scgi-1.11/scgi/__init__.py 2006-08-14 19:38:10.000000000 +0200
+++ new/scgi-1.12/scgi/__init__.py 2006-08-26 01:42:47.000000000 +0200
@@ -1 +1 @@
-__version__ = "1.11"
+__version__ = "1.12"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/scgi/passfd.c new/scgi-1.12/scgi/passfd.c
--- old/scgi-1.11/scgi/passfd.c 2006-08-14 20:03:35.000000000 +0200
+++ new/scgi-1.12/scgi/passfd.c 2006-08-26 01:41:13.000000000 +0200
@@ -21,6 +21,23 @@
#include
#include
+/* for platforms that don't provide CMSG_* macros */
+#ifndef ALIGNBYTES
+#define ALIGNBYTES (sizeof(int) - 1)
+#endif
+
+#ifndef ALIGN
+#define ALIGN(p) (((unsigned int)(p) + ALIGNBYTES) & ~ ALIGNBYTES)
+#endif
+
+#ifndef CMSG_LEN
+#define CMSG_LEN(len) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(len))
+#endif
+
+#ifndef CMSG_SPACE
+#define CMSG_SPACE(len) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(len))
+#endif
+
static int
recv_fd(int sockfd)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/scgi/scgi_server.py new/scgi-1.12/scgi/scgi_server.py
--- old/scgi-1.11/scgi/scgi_server.py 2006-05-25 20:55:17.000000000 +0200
+++ new/scgi-1.12/scgi/scgi_server.py 2006-08-26 01:24:46.000000000 +0200
@@ -76,18 +76,87 @@
return read_env(input)
def handle_connection(self, conn):
+ """Handle an incoming request. This used to be the function to
+ override in your own handler class, and doing so will still work.
+ It will be easier (and therefore probably safer) to override
+ produce() or produce_cgilike() instead.
+ """
input = conn.makefile("r")
output = conn.makefile("w")
-
env = self.read_env(input)
- output.write("Content-Type: text/plain\r\n")
- output.write("\r\n")
+ bodysize = int(env.get('CONTENT_LENGTH', 0))
+ try:
+ self.produce(env, bodysize, input, output)
+ finally:
+ output.close()
+ input.close()
+ conn.close()
+
+ def produce(self, env, bodysize, input, output):
+ """This is the function you normally override to run your
+ application. It is called once for every incoming request that
+ this process is expected to handle.
+
+ Parameters:
+
+ env - a dict mapping CGI parameter names to their values.
+
+ bodysize - an integer giving the length of the request body, in
+ bytes (or zero if there is none).
+
+ input - a file allowing you to read the request body, if any,
+ over a socket. The body is exactly bodysize bytes long; don't
+ try to read more than bodysize bytes. This parameter is taken
+ from the CONTENT_LENGTH CGI parameter.
+
+ output - a file allowing you to write your page over a socket
+ back to the client. Before writing the page's contents, you
+ must write an http header, e.g. "Content-Type: text/plain\\r\\n"
+
+ The default implementation of this function sets up a CGI-like
+ environment, calls produce_cgilike(), and then restores the
+ original environment for the next request. It is probably
+ faster and cleaner to override produce(), but produce_cgilike()
+ may be more convenient.
+ """
+
+ # Preserve current system environment
+ stdin = sys.stdin
+ stdout = sys.stdout
+ environ = os.environ
+
+ # Set up CGI-like environment for produce_cgilike()
+ sys.stdin = input
+ sys.stdout = output
+ os.environ = env
+
+ # Call CGI-like version of produce() function
+ try:
+ self.produce_cgilike(env, bodysize)
+ finally:
+ # Restore original environment no matter what happens
+ sys.stdin = stdin
+ sys.stdout = stdout
+ os.environ = environ
+
+
+ def produce_cgilike(self, env, bodysize):
+ """A CGI-like version of produce. Override this function instead
+ of produce() if you want a CGI-like environment: CGI parameters
+ are added to your environment variables, the request body can be
+ read on standard input, and the resulting page is written to
+ standard output.
+
+ The CGI parameters are also passed as env, and the size of the
+ request body in bytes is passed as bodysize (or zero if there is
+ no body).
+
+ Default implementation is to produce a text page listing the
+ request's CGI parameters, which can be useful for debugging.
+ """
+ sys.stdout.write("Content-Type: text/plain\r\n\r\n")
for k, v in env.items():
- output.write("%s: %r\n" % (k, v))
-
- output.close()
- input.close()
- conn.close()
+ print "%s: %r" % (k, v)
class SCGIServer:
@@ -103,7 +172,7 @@
self.children = {} # { pid : fd }
self.spawn_child()
self.restart = 0
-
+
#
# Deal with a hangup signal. All we can really do here is
# note that it happened.
@@ -121,7 +190,7 @@
if pid == 0:
if conn:
conn.close() # in the midst of handling a request, close
- # the connection in the child
+ # the connection in the child
os.close(child_fd)
self.handler_class(parent_fd).serve()
sys.exit(0)
@@ -161,7 +230,7 @@
#
self.spawn_child()
self.restart = 0
-
+
def delegate_request(self, conn):
"""Pass a request fd to a child process to handle. This method
@@ -234,11 +303,11 @@
# didn't find any child, check if any died
self.reap_children()
-
+
# start more children if we haven't met max_children limit
if len(self.children) < self.max_children:
self.spawn_child(conn)
-
+
# Start blocking inside select. We might have reached
# max_children limit and they are all busy.
timeout = 2
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/scgi-1.11/setup.py new/scgi-1.12/setup.py
--- old/scgi-1.11/setup.py 2006-08-14 21:15:15.000000000 +0200
+++ new/scgi-1.12/setup.py 2006-08-24 04:22:30.000000000 +0200
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import sys
-from distutils.core import setup
+from distutils import core
from distutils.extension import Extension
from scgi.__init__ import __version__
@@ -16,13 +16,33 @@
if 'sdist' in sys.argv[1:]:
_check_version_numbers()
-setup(name = "scgi",
- version = __version__,
- description = "A Python package for implementing SCGI servers.",
- author = "Neil Schemenauer",
- author_email = "nas@mems-exchange.org",
- url = "http://www.mems-exchange.org/software/scgi/",
- license = "see LICENSE.txt",
- packages = ['scgi'],
- ext_modules = [Extension(name="scgi.passfd", sources=['scgi/passfd.c'])],
- )
+kw = dict(
+ name = "scgi",
+ version = __version__,
+ description = "A Python package for implementing SCGI servers.",
+ author = "Neil Schemenauer",
+ author_email = "nas@arctrix.com",
+ #url = "http://",
+ license = "DFSG approved (see LICENSE.txt)",
+ packages = ['scgi'],
+ ext_modules = [Extension(name="scgi.passfd", sources=['scgi/passfd.c'])],
+ )
+
+# If we're running Python 2.3, add extra information
+if hasattr(core, 'setup_keywords'):
+ if 'classifiers' in core.setup_keywords:
+ kw['classifiers'] = ['Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'License :: DFSG approved',
+ 'Intended Audience :: Developers',
+ 'Operating System :: Unix',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
+ ]
+ if 'download_url' in core.setup_keywords:
+ kw['download_url'] = ('http://quixote.python.ca/releases/'
+ 'scgi-%s.tar.gz' % kw['version'])
+
+
+core.setup(**kw)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org