[Twisted-Python] stupid case sensitive web clients

Bob Ippolito bob at redivi.com
Tue Nov 12 14:03:24 MST 2002


I have a stupid device that's talking to a Twisted web server that 
demands HTTP headers to be capitalized Like-This, however Twisted only 
capitalizes the first character..

On line 567 in twisted/protocol/http.py (Twisted 1.0.0) what we have 
right now is:
l.append("%s: %s\r\n" % (name.capitalize(), value)) # content-length 
turns into Content-length

But what my stupid device wants to see is:
l.append("%s: %s\r\n" % ('-'.join(map(lambda 
n:n.capitalize(),name.split('-'))), value)) # content-length turns into 
Content-Length

Any chance someone could patch that up?

-bob





More information about the Twisted-Python mailing list