SVN: r25514 - branches/quixote1/server
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 2 Nov 2004 15:41:39 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: nascheme
Date: 2004-11-02 15:41:19 -0500 (Tue, 02 Nov 2004)
New Revision: 25514
Modified:
branches/quixote1/server/twisted_http.py
Log:
Don't set the value to None for headers that exist.
Modified: branches/quixote1/server/twisted_http.py
===================================================================
--- branches/quixote1/server/twisted_http.py 2004-11-02 20:38:22 UTC (rev 25513)
+++ branches/quixote1/server/twisted_http.py 2004-11-02 20:41:19 UTC (rev 25514)
@@ -88,14 +88,18 @@
"SCRIPT_FILENAME": '',
"REQUEST_URI": self.uri,
"HTTPS": (self.isSecure() and 'on') or 'off',
- "ACCEPT_ENCODING": self.getHeader('Accept-encoding'),
- 'CONTENT_TYPE': self.getHeader('Content-type'),
- 'HTTP_COOKIE': self.getHeader('Cookie'),
- 'HTTP_REFERER': self.getHeader('Referer'),
- 'HTTP_USER_AGENT': self.getHeader('User-agent'),
'SERVER_PROTOCOL': 'HTTP/1.1',
}
+ for env_var, header in [('ACCEPT_ENCODING', 'Accept-encoding'),
+ ('CONTENT_TYPE', 'Content-type'),
+ ('HTTP_COOKIE', 'Cookie'),
+ ('HTTP_REFERER', 'Referer'),
+ ('HTTP_USER_AGENT', 'User-agent')]:
+ value = self.getHeader(header)
+ if value is not None:
+ env[env_var] = value
+
client = self.getClient()
if client is not None:
env['REMOTE_HOST'] = client