Message6178
The roundup-server never compresses data even if accept-encoding
includes gzip.
This code from: https://stackoverflow.com/questions/9622998/how-to-use-
content-encoding-gzip-with-python-simplehttpserver
===
Building on @velis answer above, here is how I do it. gZipping small
data is not worth the time and can increase its size. Tested with
Dalvik client.
def do_GET(self):
... get content
self.send_response(returnCode) # 200, 401, etc
...your other headers, etc...
if len(content) > 100: # don't bother
compressing small data
if 'accept-encoding' in self.headers: # case insensitive
if 'gzip' in self.headers['accept-encoding']:
content = gzipencode(content) # gzipencode defined
above in @velis answer
self.send_header('content-encoding', 'gzip')
self.send_header('content-length', len(content))
self.end_headers() # send a blank line
self.wfile.write(content)
====
could be modified to compress static assets (@@file) if the browser
will accept gzippped data. For images, javascript (e.g. bootstrap used
by jinja templates) etc this could be a real win.
Some proxy servers (e.g. hiawatha) can't compress the data being
returned by roundup-server, so the roundup server needs to do the
compression. |
|
Date |
User |
Action |
Args |
2018-08-11 01:56:46 | rouilj | set | recipients:
+ rouilj |
2018-08-11 01:56:46 | rouilj | set | messageid: <1533952606.53.0.56676864532.issue2550990@psf.upfronthosting.co.za> |
2018-08-11 01:56:46 | rouilj | link | issue2550990 messages |
2018-08-11 01:56:45 | rouilj | create | |
|