tests/test-hgcia
author Ry4an Brase <ry4an-hg@ry4an.org>
Mon, 20 Sep 2010 14:56:08 -0500
branchstable
changeset 12570 a72c5ff1260c
parent 7438 b80b944836ec
permissions -rwxr-xr-x
Correct Content-Type header values for archive downloads. The content type for both .tar.gz and .tar.bz2 downloads was application/x-tar, which is correct for .tar files when no Content-Encoding is present, but is not correct for .tar.gz and .tar.bz2 files unless Content-Encoding is set to gzip or x-bzip2, respectively. However, setting Content-Encoding causes browsers to undo that encoding during download, when a .gz or .bz2 file is usually the desired artifact. Omitting the Content-Encoding header is preferred to avoid having browsers uncompress non-render-able files. Additionally, the Content-Disposition line indicates a final desired filename with .tar.gz or .tar.bz2 extension which makes providing a Content-Encoding header inappropriate. With the current configuration browsers (Chrome and Firefox thus far) are registering the application/x-tar Content-Type and not .tar extension and appending that extension, yielding filename.tar.gz.tar as a final on-disk artifact. This was originally reported here: http://stackoverflow.com/questions/3753659 I've changed the .tar.gz and .tar.bz2 Content-Type values to application/x-gzip and application/x-bzip2, respectively. Which yields correctly named download artifacts on Firefox, Chrome, and IE.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7438
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     1
#!/bin/sh
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     3
cat >> $HGRCPATH <<EOF
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     4
[extensions]
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     5
hgcia=
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     6
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     7
[hooks]
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     8
changegroup.cia = python:hgext.hgcia.hook
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     9
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    10
[cia]
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    11
user = testuser
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    12
project = testproject
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    13
test = True
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    14
EOF
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    15
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    16
hg init src
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    17
hg init cia
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    18
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    19
cd src
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    20
echo foo > foo
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    21
hg ci -Amfoo
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    22
b80b944836ec Add hgcia to hgext
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    23
hg push ../cia