Changeset 54:2b5576bea19a
- Timestamp:
- 12/05/06 14:11:04
(2 years ago)
- Author:
- Allan Saddi <allan@saddi.com>
- branch:
- default
- convert_revision:
- svn:46762da8-4eb7-0310-94e9-d918b60927c8/flup/trunk@2188
- Message:
Update servers to default to an empty QUERY_STRING if
not present in the environ.
Update gzip.py: compresslevel -> compress_level
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r53 |
r54 |
|
| 1 | 1 | 2006-12-05 Allan Saddi <asaddi@sahara.flup.org> |
|---|
| | 2 | |
|---|
| | 3 | * Update servers to default to an empty QUERY_STRING if |
|---|
| | 4 | not present in the environ. |
|---|
| | 5 | |
|---|
| | 6 | * Update gzip.py: compresslevel -> compress_level |
|---|
| 2 | 7 | |
|---|
| 3 | 8 | * Update gzip.py by updating docstrings and renaming |
|---|
| r53 |
r54 |
|
| 122 | 122 | """ |
|---|
| 123 | 123 | |
|---|
| 124 | | def __init__(self, start_response, mime_types, compresslevel): |
|---|
| | 124 | def __init__(self, start_response, mime_types, compress_level): |
|---|
| 125 | 125 | self._start_response = start_response |
|---|
| 126 | 126 | self._mime_types = mime_types |
|---|
| … | … | |
| 132 | 132 | self._crc = zlib.crc32('') |
|---|
| 133 | 133 | self._size = 0 |
|---|
| 134 | | self._compress = zlib.compressobj(compresslevel, |
|---|
| | 134 | self._compress = zlib.compressobj(compress_level, |
|---|
| 135 | 135 | zlib.DEFLATED, |
|---|
| 136 | 136 | -zlib.MAX_WBITS, |
|---|
| … | … | |
| 207 | 207 | """ |
|---|
| 208 | 208 | |
|---|
| 209 | | def __init__(self, application, mime_types=None, compresslevel=9): |
|---|
| | 209 | def __init__(self, application, mime_types=None, compress_level=9): |
|---|
| 210 | 210 | """Initializes this GzipMiddleware. |
|---|
| 211 | 211 | |
|---|
| … | … | |
| 215 | 215 | specified. |
|---|
| 216 | 216 | |
|---|
| 217 | | ``compresslevel`` |
|---|
| | 217 | ``compress_level`` |
|---|
| 218 | 218 | The gzip compression level, an integer from 1 to 9; 1 is the |
|---|
| 219 | 219 | fastest and produces the least compression, and 9 is the slowest, |
|---|
| … | … | |
| 225 | 225 | self._application = application |
|---|
| 226 | 226 | self._mime_types = [re.compile(m) for m in mime_types] |
|---|
| 227 | | self._compresslevel = compresslevel |
|---|
| | 227 | self._compress_level = compress_level |
|---|
| 228 | 228 | |
|---|
| 229 | 229 | def __call__(self, environ, start_response): |
|---|
| … | … | |
| 236 | 236 | # All of the work is done in _GzipMiddleware and _GzipIterWrapper. |
|---|
| 237 | 237 | g = _GzipMiddleware(start_response, self._mime_types, |
|---|
| 238 | | self._compresslevel) |
|---|
| | 238 | self._compress_level) |
|---|
| 239 | 239 | |
|---|
| 240 | 240 | result = self._application(environ, g.start_response) |
|---|
| r52 |
r54 |
|
| 194 | 194 | '</body></html>\n' |
|---|
| 195 | 195 | |
|---|
| | 196 | from wsgiref import validate |
|---|
| | 197 | test_app = validate.validator(test_app) |
|---|
| 196 | 198 | # Explicitly set bindAddress to *:8009 for testing. |
|---|
| 197 | 199 | WSGIServer(test_app, |
|---|
| r37 |
r54 |
|
| 925 | 925 | environ['SCRIPT_NAME'] = scriptName |
|---|
| 926 | 926 | |
|---|
| | 927 | if not environ.has_key('QUERY_STRING'): |
|---|
| | 928 | environ['QUERY_STRING'] = '' |
|---|
| | 929 | |
|---|
| 927 | 930 | def error(self, request): |
|---|
| 928 | 931 | """ |
|---|
| r52 |
r54 |
|
| 192 | 192 | '</body></html>\n' |
|---|
| 193 | 193 | |
|---|
| | 194 | from wsgiref import validate |
|---|
| | 195 | test_app = validate.validator(test_app) |
|---|
| 194 | 196 | # Explicitly set bindAddress to *:8009 for testing. |
|---|
| 195 | 197 | WSGIServer(test_app, |
|---|
| r52 |
r54 |
|
| 148 | 148 | '</body></html>\n' |
|---|
| 149 | 149 | |
|---|
| | 150 | from wsgiref import validate |
|---|
| | 151 | test_app = validate.validator(test_app) |
|---|
| 150 | 152 | WSGIServer(test_app).run() |
|---|
| r41 |
r54 |
|
| 1135 | 1135 | if not environ.has_key('PATH_INFO'): |
|---|
| 1136 | 1136 | environ['PATH_INFO'] = '' |
|---|
| | 1137 | if not environ.has_key('QUERY_STRING'): |
|---|
| | 1138 | environ['QUERY_STRING'] = '' |
|---|
| 1137 | 1139 | |
|---|
| 1138 | 1140 | # If any of these are missing, it probably signifies a broken |
|---|
| r52 |
r54 |
|
| 163 | 163 | '</body></html>\n' |
|---|
| 164 | 164 | |
|---|
| | 165 | from wsgiref import validate |
|---|
| | 166 | test_app = validate.validator(test_app) |
|---|
| 165 | 167 | WSGIServer(test_app).run() |
|---|
| r52 |
r54 |
|
| 189 | 189 | '</body></html>\n' |
|---|
| 190 | 190 | |
|---|
| | 191 | from wsgiref import validate |
|---|
| | 192 | test_app = validate.validator(test_app) |
|---|
| 191 | 193 | WSGIServer(test_app, |
|---|
| 192 | 194 | loggingLevel=logging.DEBUG).run() |
|---|
| r47 |
r54 |
|
| 493 | 493 | environ['SCRIPT_NAME'] = scriptName |
|---|
| 494 | 494 | |
|---|
| | 495 | if not environ.has_key('QUERY_STRING'): |
|---|
| | 496 | environ['QUERY_STRING'] = '' |
|---|
| | 497 | |
|---|
| 495 | 498 | def error(self, request): |
|---|
| 496 | 499 | """ |
|---|
| r52 |
r54 |
|
| 187 | 187 | '</body></html>\n' |
|---|
| 188 | 188 | |
|---|
| | 189 | from wsgiref import validate |
|---|
| | 190 | test_app = validate.validator(test_app) |
|---|
| 189 | 191 | WSGIServer(test_app, |
|---|
| 190 | 192 | loggingLevel=logging.DEBUG).run() |
|---|