You would like to give your web server users better performance in downloading web pages. By compressing HTTP data, you can speed up the serving of web contents.
Saving bandwidth in web requests with the HTTP compression
How to do it...
Let us create a web server that serves contents after compressing it to the gzip format.
Listing 4.8 explains the HTTP compression as follows:
#!/usr/bin/env python # Python Network Programming Cookbook -- Chapter - 4 # This program requires Python 3.5.2 or any later version # It may run on any other version with/without modifications. # # Follow the comments inline to make it run on Python 2.7.x. import argparse import string import os import sys import gzip import io # Comment...