[Zope-dev] ZServer 1.0b1: spurious colon in HTTP response line (fwd)

skip@mojam.com (Skip Montanaro) skip@mojam.com (Skip Montanaro)
Wed, 21 Apr 1999 10:01:06 -0400 (EDT)


Zopistas:

My brain is apparently fried and it's only 10am.  I originally posted this
to python-dev by mistake.

Skip
-------------------------

(Also reported to the bug catcher.)

I'm trying to migrate from ZopeHTTPServer to ZServer 1.0b1.  I was seeing
the ZServer headers turning up in pages generated by the process.  When I
viewed the page source of the generated HTML I saw:

    HTTP/1.0: 200 OK
    Server: Zope/experimental ZServer/1.1b1
    Date: Wed, 21 Apr 1999 13:00:38 GMT
    X-Powered-By: Zope (www.zope.org), Python (www.python.org)
    Connection: close
    Content-Type: text/html
    Content-Length: 7802
    

    <!-- -*-html-helper -*- -->
    <HTML>
    <HEAD>
    <TITLE>Musi-Cal... Concert Schedules: Folk Music, Country Music, Rock Music &amp; more!</TITLE>
    ...

I run ZServer behind an Apache 1.3.3 running mod_proxy.  Apparently Apache
doesn't recognize the HTTP response when there is a colon following the
version number and adds a simple set of headers itself.  I guess web
browsers either ignore that line or are more lenient in their parsing of the
response.

The following simple patch corrects the problem:

diff -c2 HTTPResponse.py.~1~ HTTPResponse.py
*** HTTPResponse.py.~1~	Tue Apr 13 15:21:12 1999
- --- HTTPResponse.py	Wed Apr 21 09:05:00 1999
***************
*** 146,150 ****
       
          # status header must come first.
!         append("HTTP/%s: %s" % (self._http_version, status))
          if headers.has_key('status'):
              del headers['status']
- --- 146,150 ----
       
          # status header must come first.
!         append("HTTP/%s %s" % (self._http_version, status))
          if headers.has_key('status'):
              del headers['status']
***************


Skip Montanaro	| Mojam: "Uniting the World of Music" http://www.mojam.com/
skip@mojam.com  | Musi-Cal: http://www.musi-cal.com/
518-372-5583