schmir/pypiserver — pull request #42 by rmohr (2014-01-03 12:24:17+00:00)
Title: use the same mimetypes as pypi does

it seems that since pip>=1.5, pip checks the response header of archives for Content-Encoding.

This is what pypiserver currently guesses when you try to download a tar.gz archive:
```
('Content-Type', 'application/x-tar')
('Content-Encoding', 'gzip')
```
What pip now does is decompressing the archive because of the Content-Encoding, without removing the .gz. Then it tries to untar it. Because of the filename it tries to decompress the tar archive again.

This is what pypi returns:
```
$ wget -S https://pypi.python.org/packages/source/p/pytz/pytz-2013.9.tar.gz
[...]
Content-Type: application/x-gzip
Accept-Ranges: bytes
[...]
```
The patch below returns the same types as pypi does.