Mercurial > hg
annotate tests/test-http @ 12570:a72c5ff1260c stable
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.
author | Ry4an Brase <ry4an-hg@ry4an.org> |
---|---|
date | Mon, 20 Sep 2010 14:56:08 -0500 |
parents | 1a8df80dfdde |
children |
rev | line source |
---|---|
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
4289
e17598881509
test-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4130
diff
changeset
|
3 cp "$TESTDIR"/printenv.py . |
e17598881509
test-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4130
diff
changeset
|
4 |
2621
5a5852a417b1
clone: disable stream support on server side by default.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
5 hg init test |
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
6 cd test |
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
7 echo foo>foo |
9506
49b62395e910
streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents:
8167
diff
changeset
|
8 mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg |
49b62395e910
streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents:
8167
diff
changeset
|
9 echo foo>foo.d/foo |
49b62395e910
streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents:
8167
diff
changeset
|
10 echo bar>foo.d/bAr.hg.d/BaR |
49b62395e910
streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents:
8167
diff
changeset
|
11 echo bar>foo.d/baR.d.hg/bAR |
49b62395e910
streamclone: partially encode filename over the wire, not for local read (issue1847)
Greg Ward <greg-hg@gerg.ca>
parents:
8167
diff
changeset
|
12 |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6263
diff
changeset
|
13 hg commit -A -m 1 |
10414
1a8df80dfdde
streaming: actually change default
Matt Mackall <mpm@selenic.com>
parents:
10398
diff
changeset
|
14 hg serve -p $HGPORT -d --pid-file=../hg1.pid |
1a8df80dfdde
streaming: actually change default
Matt Mackall <mpm@selenic.com>
parents:
10398
diff
changeset
|
15 hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid |
4130
178007785be8
web/server: disable address reuse option for BaseHTTPServer on windows
Patrick Mezard <pmezard@gmail.com>
parents:
3015
diff
changeset
|
16 # Test server address cannot be reused |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
17 hg serve -p $HGPORT1 2>&1 | sed -e "s/abort: cannot start server at ':$HGPORT1':.*/abort: cannot start server at ':\$HGPORT1':/" |
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
18 cd .. |
2676
7c81e337fed2
Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2673
diff
changeset
|
19 cat hg1.pid hg2.pid >> $DAEMON_PIDS |
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
20 |
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
21 echo % clone via stream |
10154
d4a62b6d4a58
run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
9506
diff
changeset
|
22 hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | \ |
3015
fa4229c60dd7
Allow for MB/sec transfer rates in test-http-proxy and test-ssh.
Lee Cantey <lcantey@gmail.com>
parents:
2986
diff
changeset
|
23 sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/' |
2676
7c81e337fed2
Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2673
diff
changeset
|
24 hg verify -R copy |
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 |
2621
5a5852a417b1
clone: disable stream support on server side by default.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
26 echo % try to clone via stream, should use pull instead |
10154
d4a62b6d4a58
run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
9506
diff
changeset
|
27 hg clone --uncompressed http://localhost:$HGPORT1/ copy2 |
2612
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
28 |
ffb895f16925
add support for streaming clone.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
29 echo % clone via pull |
10154
d4a62b6d4a58
run-tests.py: clears http_proxy for all tests
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
9506
diff
changeset
|
30 hg clone http://localhost:$HGPORT1/ copy-pull |
2676
7c81e337fed2
Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2673
diff
changeset
|
31 hg verify -R copy-pull |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
32 |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
33 cd test |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
34 echo bar > bar |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
35 hg commit -A -d '1 0' -m 2 |
2676
7c81e337fed2
Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2673
diff
changeset
|
36 cd .. |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
37 |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
38 echo % pull |
2676
7c81e337fed2
Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2673
diff
changeset
|
39 cd copy-pull |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2622
diff
changeset
|
40 echo '[hooks]' >> .hg/hgrc |
4289
e17598881509
test-http: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4130
diff
changeset
|
41 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc |
10398
ace3cf2bc991
tests: don't just silently strip port numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
10154
diff
changeset
|
42 hg pull | sed -e "s,:$HGPORT1/,:\$HGPORT1/," |
2676
7c81e337fed2
Fixed confused directory changing in test-http.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2673
diff
changeset
|
43 cd .. |