<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Allan Saddi's projects blog - Python</title>
    <link>http://www.saddi.com/software/news/</link>
    <description>Announcements and ramblings about projects new and old.</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.5 - http://www.s9y.org/</generator>
    <pubDate>Wed, 06 Jul 2011 15:28:43 GMT</pubDate>

    <image>
        <url>http://www.saddi.com/software/news/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Allan Saddi's projects blog - Python - Announcements and ramblings about projects new and old.</title>
        <link>http://www.saddi.com/software/news/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Latest Projects</title>
    <link>http://www.saddi.com/software/news/archives/86-Latest-Projects.html</link>
            <category>General</category>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/86-Latest-Projects.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=86</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=86</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    It seems like I&#039;ve been working on so many random things the past few weeks. And all on different platforms: C (UNIX/POSIX), Python, Cocoa, iOS.&lt;br /&gt;
&lt;br /&gt;
Anyhow, the only things that are almost ready for public consumption are the security-related libraries/modules. (Each succeeding project builds on the previous.) All are BSD licensed.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/sha-asaddi&quot;&gt;sha-asaddi&lt;/a&gt;&lt;br /&gt;
Everything SHA, from SHA-1 to SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512) to the newest truncated editions (SHA-512/224, SHA-512/256). Also includes HMAC wrappers for each. This is a cleaned up and refactored version of my previous command-line sha project. Still WIP though.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/pbkdf2&quot;&gt;pbkdf2&lt;/a&gt;&lt;br /&gt;
Implementations of &lt;a href=&quot;http://en.wikipedia.org/wiki/PBKDF2&quot;&gt;PBKDF2&lt;/a&gt; in C and Python. The C version depends on sha-asaddi, though I suppose it can easily be swapped to use any other SHA/HMAC implementations with similar signatures. The Python version has no dependencies outside of the standard library.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/scrypt&quot;&gt;scrypt&lt;/a&gt;&lt;br /&gt;
Implementations of Colin Percival&#039;s &lt;a href=&quot;http://www.tarsnap.com/scrypt.html&quot;&gt;scrypt&lt;/a&gt; in C and pure Python. This was more of an academic exercise since Mr. Percival&#039;s version is far more optimized and is already available under a BSD license. (At least, I&#039;m assuming it&#039;s more optimized &amp;mdash; I haven&#039;t actually looked at his code yet. But he did seem to have assembly/SSE optimized versions.) The Python version is probably too slow to be practical. (A &lt;a href=&quot;http://pypi.python.org/pypi/scrypt/&quot;&gt;Python wrapper&lt;/a&gt; for the original scrypt implementation is already available.) Will gladly take optimization suggestions for the Python version! &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Oh, and these three projects represent a general shift in my packaging/building ideals. For now, I&#039;ve decided to ditch GNU&#039;s autotools in favor of &lt;a href=&quot;http://www.cmake.org/&quot;&gt;CMake&lt;/a&gt; for my projects. CMake just seems like a more coherent tool for configuring/building in a platform-independent manner. But, that just, like, my opinion, man... &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 29 Jun 2011 18:10:00 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/86-guid.html</guid>
    
</item>
<item>
    <title>CASMiddleware</title>
    <link>http://www.saddi.com/software/news/archives/84-CASMiddleware.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/84-CASMiddleware.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=84</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=84</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    For anyone not familiar with it, &lt;a href=&quot;http://www.jasig.org/cas&quot;&gt;CAS&lt;/a&gt; is an open source single-sign on service. It&#039;s implemented in Java, but I have stumbled across a &lt;a href=&quot;https://bitbucket.org/desmaj/wsgicas/&quot;&gt;CAS server implemented in Python&lt;/a&gt;. (Which I haven&#039;t tried yet.)&lt;br /&gt;
&lt;br /&gt;
Anyway, I&#039;ve been running my own CAS server for a while now (which provides SSO service for all the webapps on my server). I actually have my own Python CAS client and WSGI middleware that I&#039;ve been using for years. In addition to a number of my Python webapps, I&#039;ve successfully used it to CASsify MoinMoin. I&#039;m sure I could get it to work with Trac too, but that would probably annoy my Trac users. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; (It works with any app that simply relies on REMOTE_USER.)&lt;br /&gt;
&lt;br /&gt;
casclient and casmiddleware were part of of my &#039;py-lib&#039; project (if anyone remembers that). Though &#039;py-lib&#039; was never really a project. It was more like a directory of Python modules I had written for myself &amp;mdash; a place to incubate early Python projects (flup&#039;s fcgi.py started there, along with the other pre-1.0 flup modules).&lt;br /&gt;
&lt;br /&gt;
But when I moved beyond Subversion, py-lib was abandoned.&lt;br /&gt;
&lt;br /&gt;
I was reminded of the fact that my Python CAS stuff was never really released due to all the work-related CAS work I&#039;ve been doing lately. JA-SIG has their own Python CAS code, but it seems to be more geared toward CGI. I&#039;m sure a few of the various Python authentication frameworks out there have a CAS module. But anyway, I just wanted to get the ball rolling and get my own CASMiddleware &#039;out there&#039; &amp;mdash; in case anyone else finds it useful.&lt;br /&gt;
&lt;br /&gt;
It&#039;s pretty small and only depends on Beaker.&lt;br /&gt;
&lt;br /&gt;
For now, it&#039;s only available at my Hg repo. I&#039;ll send it over to PyPI when I get the chance. (Hah! I should have searched PyPI first, so many hits for &#039;CAS&#039;. Oh well...)&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/casmiddleware/&quot;&gt;casmiddleware&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Sat, 09 Apr 2011 14:14:55 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/84-guid.html</guid>
    
</item>
<item>
    <title>scgi-wsgi for Python 3.2</title>
    <link>http://www.saddi.com/software/news/archives/82-scgi-wsgi-for-Python-3.2.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/82-scgi-wsgi-for-Python-3.2.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=82</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=82</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I merged all the Python 3.x-specific commits in ajp-wsgi-py3.0 into scgi-wsgi and surprisingly, it was painless and (seemingly) functional on the first try.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/scgi-wsgi-py3.0/&quot;&gt;scgi-wsgi for Python 3.2 (Hg repo)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
(Don&#039;t forget to clone &lt;a href=&quot;http://hg.saddi.com/scgi/&quot;&gt;scgi&lt;/a&gt;, &lt;a href=&quot;http://hg.saddi.com/threadpool/&quot;&gt;threadpool&lt;/a&gt; and &lt;a href=&quot;http://hg.saddi.com/preforkserver/&quot;&gt;preforkserver&lt;/a&gt; as well.)&lt;br /&gt;
&lt;br /&gt;
Really cool stuff. Though admittedly, most of my amazement comes from how easy it was to cherry-pick and merge specific revisions thanks to Mercurial. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Addendum:&lt;/strong&gt; Oh yeah, I fixed ajp-wsgi-py3.0 so it compiles under Python 3.2. Even though the PyCapsule stuff was backported to Python 2.7, I won&#039;t be merging that change over. I still want the Python 2.x version to work with Python as old as 2.4. 
    </content:encoded>

    <pubDate>Wed, 16 Mar 2011 14:25:07 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/82-guid.html</guid>
    
</item>
<item>
    <title>While shaking fist at mod_proxy_scgi...</title>
    <link>http://www.saddi.com/software/news/archives/81-While-shaking-fist-at-mod_proxy_scgi....html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/81-While-shaking-fist-at-mod_proxy_scgi....html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=81</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=81</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    It was &lt;a href=&quot;http://www.saddi.com/software/news/archives/64-Dabbling-in-Python-3.0.html#c290&quot;&gt;brought to my attention&lt;/a&gt; that my trac sites were no longer authenticating the generic user I set up. Apparently, something I missed in my switch to SCGI...&lt;br /&gt;
&lt;br /&gt;
But it&#039;s not scgi-wsgi&#039;s fault, really. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; I narrowed it down to mod_proxy_scgi (obviously, by the title of this entry!). mod_scgi works fine. mod_proxy_scgi does not seem to pass the HTTP Authorization header along. I&#039;m currently looking around for flags/options to remedy this with no luck. A quick Google search &lt;a href=&quot;https://issues.apache.org/bugzilla/show_bug.cgi?id=50880&quot;&gt;revealed something similar, but not quite&lt;/a&gt;. Though that may address the SCRIPT_NAME/PATH_INFO issues I&#039;ve seen... in a future version of Apache HTTPD.&lt;br /&gt;
&lt;br /&gt;
I wish I had more time to figure out what was really going on. In the mean time, I will probably switch away from mod_proxy_scgi (to mod_scgi) where possible...&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 16 Mar 2011 11:27:35 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/81-guid.html</guid>
    
</item>
<item>
    <title>scgi-wsgi 1.1 released</title>
    <link>http://www.saddi.com/software/news/archives/80-scgi-wsgi-1.1-released.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/80-scgi-wsgi-1.1-released.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=80</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=80</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I haven&#039;t run into any problems with scgi-wsgi in the few weeks that I&#039;ve been using it. My issues with SCGI stem from mod_scgi and mod_proxy_scgi.&lt;br /&gt;
&lt;br /&gt;
Namely, I think mod_scgi&#039;s handling of environment variables is perfect (see my previous rants about mod_proxy_scgi). It&#039;s even slightly faster than mod_proxy_scgi. But configuration leaves a bit to be desired. Say I want to mount an application at the root but I want the path &quot;/static&quot; to be handled by the web server. How does one do this? I&#039;m guessing it has something to do with the SCGIHandler on/off directive (in fact, it probably &lt;em&gt;is&lt;/em&gt; that simple) &amp;mdash; but that method is a bit way too verbose, especially if you have multiple exclusions.&lt;br /&gt;
&lt;br /&gt;
I like the way the mod_proxy_* stuff is configured (namely with ProxyPass). It&#039;s easy to exclude directories. And the directives are parsed in order, meaning configuration is sane and intuitive (at least to me). You specify the most specific entries first.&lt;br /&gt;
&lt;br /&gt;
But again, see my rant about mod_proxy_scgi&#039;s environment handling.&lt;br /&gt;
&lt;br /&gt;
Anyway, scgi-wsgi incorporates both a thread pool and a process pool. Since handling is done on a per-request basis, I thought it would be poor form if scgi-wsgi simply closed the connection from the web server if the pool was full &amp;mdash; so instead, requests received are queued when the pool is over capacity. (This is in contrast to ajp-wsgi which does drop connections, but again, there&#039;s no 1:1 mapping between AJP connections and requests.) So you can have your app running on a single thread/process and still dozens or hundreds of concurrent requests. Those requests won&#039;t be served in a timely manner, but at least they will be served. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
On my server, scgi-wsgi is one of the fastest WSGI servers I&#039;ve tried (that&#039;s out of flup, ajp-wsgi, Paste&#039;s scgiserver, and CherryPy&#039;s web server). I have no idea what the state of the art in the WSGI world is, but it was certainly impressive enough to get me to write the thread/process pool code and start switching over my applications. And unlike CherryPy, it had the disadvantage (like the others) of sitting behind Apache httpd. (Though the fact that CherryPy is quite fast and speaks HTTP natively will probably stave off any urge to glue together an embeddable C web server and my C WSGI code... for a while. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;)&lt;br /&gt;
&lt;br /&gt;
So anyway: &lt;a href=&quot;http://www.saddi.com/software/scgi-wsgi/&quot;&gt;scgi-wsgi&lt;/a&gt;. I&#039;ve put it in its own space for now. Additional, more interesting links below.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/scgi-wsgi/dist/ChangeLog&quot;&gt;ChangeLog&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/scgi-wsgi/dist/scgi-wsgi-1.1.tar.bz2&quot;&gt;Tarball&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/scgi-wsgi&quot;&gt;Hg Repository&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Mon, 07 Feb 2011 16:00:00 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/80-guid.html</guid>
    
</item>
<item>
    <title>ajp-wsgi 1.1 released</title>
    <link>http://www.saddi.com/software/news/archives/79-ajp-wsgi-1.1-released.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/79-ajp-wsgi-1.1-released.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=79</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=79</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    Well, it&#039;s been a few weeks since I&#039;ve touched (or had the need to touch) ajp-wsgi. I&#039;ve been running it a few places &amp;mdash; sometimes forked if the app allowed it.&lt;br /&gt;
&lt;br /&gt;
Anyway, the biggest new feature is, of course, forking support. I think now is a good time to &quot;release&quot; it, as any.&lt;br /&gt;
&lt;br /&gt;
The 1.1 release will probably be the last for ajp-wsgi (barring any bugfix releases). I imagine I&#039;ll be folding AJP support into scgi-wsgi in the future (and renaming it all too). At this point, scgi-wsgi is a bit more advanced than ajp-wsgi with its thread pooling and pre-fork multiprocessing. Though neither of those features are really required (or make sense) with AJP&#039;s persistent connections.&lt;br /&gt;
&lt;br /&gt;
scgi-wsgi 1.1 will follow in a few days.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ChangeLog&quot;&gt;ChangeLog&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ajp-wsgi-1.1.tar.bz2&quot;&gt;Tarball&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/ajp-wsgi/&quot;&gt;Hg Repository&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 02 Feb 2011 15:48:31 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/79-guid.html</guid>
    
</item>
<item>
    <title>mod_proxy_scgi, why?!?!</title>
    <link>http://www.saddi.com/software/news/archives/78-mod_proxy_scgi,-why!!.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/78-mod_proxy_scgi,-why!!.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=78</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=78</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I went ahead and installed the &lt;a href=&quot;http://www.python.ca/scgi/&quot;&gt;original mod_scgi&lt;/a&gt; and it opened my eyes to how utterly &lt;em&gt;different&lt;/em&gt; (or maybe broken) mod_proxy_scgi&#039;s handling of SCRIPT_NAME/PATH_INFO was.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve been poring over the source for both modules, and though it&#039;s been years since I&#039;ve coded Apache modules, I couldn&#039;t find any glaring differences. mod_scgi set the variables itself using some particular logic, while mod_proxy_scgi called ap_add_cgi_vars() to set the variables. That function &lt;em&gt;appears&lt;/em&gt; to use the same logic.&lt;br /&gt;
&lt;br /&gt;
So in spite of all that, I just cannot explain why Apache&#039;s mod_proxy_scgi is so broken. To give you an idea of how broken, given the request URI of &quot;/foo/bar%20garply&quot;, it would set SCRIPT_NAME/PATH_INFO as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SCRIPT_NAME&lt;/b&gt;: &lt;code&gt;/foo/bar garply&lt;/code&gt;&lt;br /&gt;
&lt;b&gt;PATH_INFO&lt;/b&gt;: &lt;code&gt;/foo/bar%20garply&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
The sane thing to do (which mod_scgi does) is:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SCRIPT_NAME&lt;/b&gt;: (empty)&lt;br /&gt;
&lt;b&gt;PATH_INFO&lt;/b&gt;: &lt;code&gt;/foo/bar garply&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
So not only is SCRIPT_NAME utterly wrong for something mounted at the root, but PATH_INFO remains quoted.&lt;br /&gt;
&lt;br /&gt;
My solution involves re-deriving SCRIPT_NAME/PATH_INFO from REQUEST_URI. Of course, mod_scgi doesn&#039;t need this, and in fact, shouldn&#039;t use it all since it sets SCRIPT_NAME correctly for non-root-mounted applications (removing the need to manually specify it).&lt;br /&gt;
&lt;br /&gt;
Since I wouldn&#039;t trust auto-detection of the SCGI module, I decided to leave it up to the invoker of scgi-wsgi to decide what&#039;s right. Which lead to this lovely feature being created (from scgi-wsgi&#039;s README):&lt;br /&gt;
&lt;blockquote&gt;Due to the inconsistency between the various SCGI connectors, you may need to specify an environment profile using the -E option. The default profile is &lt;em&gt;pass-through&lt;/em&gt;. The profiles are described below:&lt;ul&gt;&lt;li&gt;&lt;em&gt;pass-through&lt;/em&gt; passes SCRIPT_NAME and PATH_INFO unchanged from the connector. REQUEST_URI will be unquoted unless the -Q option is used. Any scriptName passed from the command-line (or via WSGI_SCRIPT_NAME) is ignored. This profile is meant for the original mod_scgi available at http://python.ca/scgi/&lt;/li&gt;&lt;li&gt;&lt;em&gt;request-uri&lt;/em&gt; only trusts REQUEST_URI and derives SCRIPT_NAME and PATH_INFO from it. scriptName must be given from the command-line (or via WSGI_SCRIPT_NAME) if the application resides at a non-root location. This profile is meant for Apache HTTPD&#039;s mod_proxy_scgi.&lt;/li&gt;&lt;li&gt;&lt;em&gt;script-name&lt;/em&gt; only trusts SCRIPT_NAME and PATH_INFO. It forms REQUEST_URI by their concatenation and then re-derives SCRIPT_NAME and PATH_INFO using scriptName given from the command-line (or WSGI_SCRIPT_NAME). This option is here for completeness.&lt;/li&gt;&lt;/ul&gt;Other SCGI modules (e.g. for lighttpd and nginx) have not yet been tested, but I imagine their handling of SCRIPT_NAME/PATH_INFO falls under one of the above.&lt;br /&gt;
&lt;/blockquote&gt;So... yeah. I&#039;m not too happy about it, and it diminishes my motivation to switch over to SCGI. I like the mod_proxy* stuff because it lets me use load balancing and/or set backend connection limits. But between the two, only mod_scgi seems to be the saner implementation. (As mentioned, I&#039;ve yet to try nginx and lighttpd).&lt;br /&gt;
&lt;br /&gt;
If I can gather code/test cases into a coherent bug report, I&#039;ll be posting one with Apache. Because really, the presence of quoted characters in the URL should not throw everything off.&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Sun, 23 Jan 2011 18:49:06 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/78-guid.html</guid>
    
</item>
<item>
    <title>scgi-wsgi!</title>
    <link>http://www.saddi.com/software/news/archives/77-scgi-wsgi!.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/77-scgi-wsgi!.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=77</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=77</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    Shortly after my last entry, I switched from a CPU-bound WSGI app to something comparatively more I/O heavy: serving a static 10K page. I then tried it out with the &lt;em&gt;non-threadpool version&lt;/em&gt; of scgi-wsgi. The results surprised me. scgi-wsgi was doing well over 700 (nearly 800 at times) requests per second while ajp-wsgi only mustered 300 requests/sec.&lt;br /&gt;
&lt;br /&gt;
Though of course, like before, when I switched to the non-preforking scgi-wsgi, its throughput dropped to a little over 50 requests/sec. ajp-wsgi maintained 300 requests/sec even while forking.&lt;br /&gt;
&lt;br /&gt;
Given the non-threadpool performance of scgi-wsgi, I was spurred to write my own preforking server code (again), this time in C. The result can be found &lt;a href=&quot;http://hg.saddi.com/preforkserver/&quot;&gt;here&lt;/a&gt;. Unlike flup&#039;s preforking server, this one is based on descriptor passing. (And since I couldn&#039;t find my copy of UNIX Network Programming, I have to thank Google for having it browsable online. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;)&lt;br /&gt;
&lt;br /&gt;
Hooking up the prefork server into scgi-wsgi, I now get similar performance to the threaded version: 700+ requests/sec. With that, scgi-wsgi graduated from &#039;limbo&#039; to &#039;alpha.&#039; &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; And since mod_proxy_scgi is now included with vanilla Apache HTTPD, I will probably be transitioning my stuff from ajp-wsgi to scgi-wsgi. (Eat your own dog food and all that.)&lt;br /&gt;
&lt;br /&gt;
As for the future, I would like to merge the two. I&#039;m still entertaining the idea of hooking up my C WSGI code to an embedded HTTP server, similar to what PyCaduceus did (but remaining a top-level program rather than a Python module). I haven&#039;t really found an embeddable HTTP server with an interface that I like, though &lt;a href=&quot;http://code.google.com/p/mongoose/&quot;&gt;mongoose&lt;/a&gt; looks promising.&lt;br /&gt;
&lt;br /&gt;
In the meantime, I&#039;ll go ahead and release ajp-wsgi 1.1 and scgi-wsgi 1.1 (eventually).&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/scgi-wsgi/&quot;&gt;scgi-wsgi Hg repository&lt;/a&gt; (don&#039;t forget to clone &lt;a href=&quot;http://hg.saddi.com/scgi/&quot;&gt;scgi&lt;/a&gt; and &lt;a href=&quot;http://hg.saddi.com/preforkserver/&quot;&gt;preforkserver&lt;/a&gt; as well)&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/scgi-wsgi-1.1alpha.tar.bz2&quot;&gt;scgi-wsgi tarball&lt;/a&gt; 
    </content:encoded>

    <pubDate>Fri, 21 Jan 2011 11:09:20 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/77-guid.html</guid>
    
</item>
<item>
    <title>scgi-wsgi?</title>
    <link>http://www.saddi.com/software/news/archives/76-scgi-wsgi.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/76-scgi-wsgi.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=76</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=76</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I just recently discovered that Apache HTTPD now ships with &lt;a href=&quot;http://httpd.apache.org/docs/2.2/mod/mod_proxy_scgi.html&quot;&gt;mod_proxy_scgi&lt;/a&gt;. (Probably old news to some, that was 3 patch versions ago.) Couple that with the fact that I stumbled upon &lt;a href=&quot;http://code.google.com/p/pycaduceus/&quot;&gt;PyCaduceus&lt;/a&gt; again recently (which proves to me that the C WSGI code written for ajp-wsgi was relatively transport-independent)... So I decided to spend a few hours today to writing an &lt;a href=&quot;http://hg.saddi.com/scgi&quot;&gt;SCGI driver in C&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Well, it was actually pretty easy considering the &lt;a href=&quot;http://www.python.ca/scgi/protocol.txt&quot;&gt;SCGI spec&lt;/a&gt; is only a page long. DJB&#039;s &lt;a href=&quot;http://cr.yp.to/proto/netstrings.txt&quot;&gt;netstrings&lt;/a&gt; description was just as short.&lt;br /&gt;
&lt;br /&gt;
Replacing AJP in ajp-wsgi was straightforward as well. In fact, building the WSGI environment is a lot simpler with SCGI since the &quot;headers&quot; from the web server don&#039;t need to be re-interpreted/converted. (And I&#039;ve yet to test this, but I don&#039;t think specifying the scriptName is necessary anymore.)&lt;br /&gt;
&lt;br /&gt;
Once scgi-wsgi was in a working state, I was curious how it compared to ajp-wsgi. The results were surprising at first, but later made sense once I figured out what was happening. These were on my server using an extremely compute-bound WSGI application:&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;Driver&lt;/th&gt;&lt;th align=&quot;left&quot;&gt;Requests/sec&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ajp-wsgi threading&lt;/td&gt;&lt;td&gt;~96&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;scgi-wsgi threading&lt;/td&gt;&lt;td&gt;~92&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ajp-wsgi forking&lt;/td&gt;&lt;td&gt;200+&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;scgi-wsgi forking&lt;/td&gt;&lt;td&gt;~53(!)&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
So... yeah. scgi-wsgi is slightly slower when threading and significantly slower when forking. Despite SCGI&#039;s simplicity, the explanation for this is that &lt;b&gt;AJP uses persistent &quot;backend&quot; connections while SCGI uses one connection per request&lt;/b&gt;. In other words, the SCGI version was heavily penalized because there was no thread pooling or process pooling.&lt;br /&gt;
&lt;br /&gt;
So where do I go from here? I&#039;ll probably just continue on with ajp-wsgi 1.1 as planned and leave scgi-wsgi in limbo. (I was entertaining the idea of merging the two.) SCGI needs thread/process pools to be competitive. Unless I find C implementations with a friendly-enough license (i.e. not copyleft), it&#039;s probably not worth writing my own pool implementations just for scgi-wsgi. The forking reference implementation (now found in Paste, I believe) is still probably the best.&lt;br /&gt;
&lt;br /&gt;
(As an aside, since the SCGI protocol is so simple, moving the implementation to C to avoid the GIL probably doesn&#039;t improve things much over a pure-Python implementation.)&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/scgi-wsgi&quot;&gt;Hg Repository&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Addendum:&lt;/b&gt; Apparently, the C implementations shine over their pure-Python counterparts when uploading files (i.e. large request body). When uploading a ~100MB file, ajp-wsgi and scgi-wsgi took ~6 seconds and ~4 seconds respectively (simplicity wins out!) When using flup ajp/scgi and Paste&#039;s scgiserver, I couldn&#039;t be bothered to wait for the upload to complete. (It was well over a few minutes for each before I canceled.) 
    </content:encoded>

    <pubDate>Mon, 17 Jan 2011 19:23:55 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/76-guid.html</guid>
    
</item>
<item>
    <title>ajp-wsgi 1.1 alpha</title>
    <link>http://www.saddi.com/software/news/archives/75-ajp-wsgi-1.1-alpha.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/75-ajp-wsgi-1.1-alpha.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=75</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=75</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I was curious about what it would take to add forking/multi-process support to ajp-wsgi and apparently the answer is: &lt;em&gt;not much!&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Well, it becomes trivial when you don&#039;t bother with preforking or process pools. I don&#039;t think an AJP backend really needs to worry much about saving fork() time since connections (and therefore processes) are more or less persistant.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve done some basic stress testing using ApacheBench (ab): 100 concurrent requests, 500 concurrent requests. It&#039;s looking promising (no errors!). I haven&#039;t done any extensive testing between threaded vs. forking, but the results seem to be the same (using a freshly created Pylons app). Obviously the GIL isn&#039;t really being exercised when serving a static ~5K page.&lt;br /&gt;
&lt;br /&gt;
And I did learn one oddity about mod_proxy/mod_proxy_ajp &amp;mdash; apparently, when you specify max connections, you&#039;re actually specifying max connections &lt;em&gt;per httpd process&lt;/em&gt;. On my server, where httpd uses the worker MPM (hybrid thread/process), the hard process limit is apparently 16, so even specifying max=1 means ajp-wsgi can expect up to 16 connections. (Conveniently for me, ajp-wsgi&#039;s default &lt;em&gt;process&lt;/em&gt; limit is 16.) Something to keep in mind when tweaking ajp-wsgi&#039;s maxConnections parameter.&lt;br /&gt;
&lt;br /&gt;
(Also note that if mod_proxy_ajp ever goes over ajp-wsgi&#039;s maxConnections limit, users &lt;em&gt;will&lt;/em&gt; see HTTP 503 errors.)&lt;br /&gt;
&lt;br /&gt;
Anyway, I think I&#039;ll stick to threading for now. But 1.1 alpha is out there for anyone interested...&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ChangeLog&quot;&gt;ChangeLog&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ajp-wsgi-1.1alpha.tar.bz2&quot;&gt;Tarball&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/ajp-wsgi1.1&quot;&gt;Hg repository&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Thu, 13 Jan 2011 13:09:07 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/75-guid.html</guid>
    
</item>
<item>
    <title>ajp-wsgi 1.0.3 pulled, 1.0.4 released</title>
    <link>http://www.saddi.com/software/news/archives/74-ajp-wsgi-1.0.3-pulled,-1.0.4-released.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/74-ajp-wsgi-1.0.3-pulled,-1.0.4-released.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=74</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=74</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I just discovered a rather fatal bug introduced in 1.0.3 which leads to high CPU utilization when the web server closes transport connections. I only just discovered the issue tonight, when all of my ajp-wsgi instances went full bore and brought my server&#039;s load average to over 15. (Apparently, Apache decided it was a good time to reap stale AJP connections.)&lt;br /&gt;
&lt;br /&gt;
Anyway, I&#039;m kicking myself, since this problem was also seen in flup but was patched some time ago. Shows me not to make post-midnight releases, especially after such short testing cycles. Oh wait...&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ajp-wsgi-1.0.4.tar.bz2&quot;&gt;Tarball&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Sun, 12 Dec 2010 00:23:43 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/74-guid.html</guid>
    
</item>
<item>
    <title>ajp-wsgi 1.0.3 released</title>
    <link>http://www.saddi.com/software/news/archives/72-ajp-wsgi-1.0.3-released.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/72-ajp-wsgi-1.0.3-released.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=72</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=72</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    New version of ajp-wsgi released, with the following change:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Handle socket reads more sanely, so things don&#039;t break with non-local connections. (ajp.c update)&lt;/li&gt;&lt;/ul&gt;&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ChangeLog&quot;&gt;ChangeLog&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ajp-wsgi-1.0.3.tar.bz2&quot;&gt;Tarball&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/ajp-wsgi/&quot;&gt;HG repository&lt;/a&gt; (also &lt;a href=&quot;http://hg.saddi.com/ajp/&quot;&gt;here&lt;/a&gt; for ajp)&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 08 Dec 2010 01:29:09 -0800</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/72-guid.html</guid>
    
</item>
<item>
    <title>ajp-wsgi 1.0.2 released</title>
    <link>http://www.saddi.com/software/news/archives/71-ajp-wsgi-1.0.2-released.html</link>
            <category>Python</category>
    
    <comments>http://www.saddi.com/software/news/archives/71-ajp-wsgi-1.0.2-released.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=71</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=71</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    Released version 1.0.2 of ajp-wsgi (there was no 1.0.1 release, apparently).&lt;br /&gt;
&lt;br /&gt;
It&#039;s made up mainly of Mac OS X build fixes, though there were 2 general bugs:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Fix minor bug: if WSGI_SCRIPT_NAME is defined, ensure SCRIPT_NAME is set to the same value.&lt;/li&gt;&lt;li&gt;Fix initialization order. Do socket and Python initialization after daemonizing to avoid issues with e.g. APScheduler.&lt;/li&gt;&lt;/ul&gt;&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ChangeLog&quot;&gt;ChangeLog&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.saddi.com/software/ajp-wsgi/dist/ajp-wsgi-1.0.2.tar.bz2&quot;&gt;Tarball&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://hg.saddi.com/ajp-wsgi&quot;&gt;HG Repository&lt;/a&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Thu, 17 Jun 2010 10:51:56 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/71-guid.html</guid>
    
</item>
<item>
    <title>new flup snapshot</title>
    <link>http://www.saddi.com/software/news/archives/70-new-flup-snapshot.html</link>
            <category>flup</category>
    
    <comments>http://www.saddi.com/software/news/archives/70-new-flup-snapshot.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=70</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=70</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I just released a new snapshot, it includes the following changes:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;fix fork bomb and check number of children against minSpare not maxSpare&lt;/li&gt;&lt;li&gt;Restore check of the absolute number of children against maxSpare and document rationale.&lt;/li&gt;&lt;li&gt;Add configurable timeout (default: no timeout) to be used when the WSGI application is called. Only applies to forked servers!&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
Here are links to the &lt;a href=&quot;http://hg.saddi.com/flup-server/&quot;&gt;Hg repository&lt;/a&gt; and the &lt;a href=&quot;http://pypi.python.org/pypi/flup/1.0.3.dev-20091021&quot;&gt;PyPI page&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
If there are any issues, please open a ticket at the &lt;a href=&quot;http://trac.saddi.com/flup&quot;&gt;flup Trac&lt;/a&gt; and/or submit a patch. &lt;img src=&quot;http://www.saddi.com/software/news/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; 
    </content:encoded>

    <pubDate>Wed, 21 Oct 2009 09:48:10 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/70-guid.html</guid>
    
</item>
<item>
    <title>SHA stuff moved to Hg</title>
    <link>http://www.saddi.com/software/news/archives/68-SHA-stuff-moved-to-Hg.html</link>
            <category>General</category>
            <category>py-lib</category>
    
    <comments>http://www.saddi.com/software/news/archives/68-SHA-stuff-moved-to-Hg.html#comments</comments>
    <wfw:comment>http://www.saddi.com/software/news/wfwcomment.php?cid=68</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.saddi.com/software/news/rss.php?version=2.0&amp;type=comments&amp;cid=68</wfw:commentRss>
    

    <author>nospam@example.com (Allan Saddi)</author>
    <content:encoded>
    I didn&#039;t realize this, but all my SHA implementations were still living in my Subversion repository. Well, after some meticulous converting from both my archived CVS &lt;em&gt;and&lt;/em&gt; SVN repositories, I&#039;ve managed to finally move them over to Mercurial.&lt;br /&gt;
&lt;br /&gt;
Anyway, I&#039;m not sure what else in Subversion I&#039;d like to move over. Certainly, there&#039;s nothing left in there that&#039;s all that interesting to the public. So I will take down the public-facing SVN repo... someday.&lt;br /&gt;
&lt;br /&gt;
Searching Google, I see nothing links directly svn.saddi.com. However, there&#039;s quite &lt;em&gt;a lot&lt;/em&gt; of documentation that references flup and fcgi.py within it. Well, if anyone&#039;s been checking out &lt;em&gt;that&lt;/em&gt; flup, it&#039;s 2 years out of date. And the standalone fcgi.py module... I&#039;d rather just forget about that since it&#039;s hopelessly out of sync from the flup version. (It&#039;s basically the flup threaded fcgi server without thread pools.) 
    </content:encoded>

    <pubDate>Mon, 03 Aug 2009 21:21:29 -0700</pubDate>
    <guid isPermaLink="false">http://www.saddi.com/software/news/archives/68-guid.html</guid>
    
</item>

</channel>
</rss>