author | Martin Geisler <mg@lazybytes.net> |
Wed, 27 Oct 2010 12:05:37 +0200 | |
branch | stable |
changeset 12857 | a9f91c844a3b |
parent 12410 | 2bfb335c7594 |
child 13269 | aa3f726a2bdb |
permissions | -rw-r--r-- |
12410
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
1 |
This is a test of the wire protocol over CGI-based hgweb. |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
2 |
initialize repository |
6922
1ec2d227a521
hgweb: fix WSGI iterators handling in CGI adapter (issue1254)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
3 |
|
12410
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
4 |
$ hg init test |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
5 |
$ cd test |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
6 |
$ echo a > a |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
7 |
$ hg ci -Ama |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
8 |
adding a |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
9 |
$ cd .. |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
10 |
$ cat >hgweb.cgi <<HGWEB |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
11 |
> # |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
12 |
> # An example CGI script to use hgweb, edit as necessary |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
13 |
> import cgitb |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
14 |
> cgitb.enable() |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
15 |
> from mercurial import demandimport; demandimport.enable() |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
16 |
> from mercurial.hgweb import hgweb |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
17 |
> from mercurial.hgweb import wsgicgi |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
18 |
> application = hgweb("test", "Empty test repository") |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
19 |
> wsgicgi.launch(application) |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
20 |
> HGWEB |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
21 |
$ chmod 755 hgweb.cgi |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
22 |
$ DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
23 |
$ GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
24 |
$ HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; export HTTP_ACCEPT |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
25 |
$ HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
26 |
$ HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
27 |
$ HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
28 |
$ HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
29 |
$ HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
30 |
$ HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
31 |
$ HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
32 |
$ HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"; export HTTP_USER_AGENT |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
33 |
$ PATH_INFO="/"; export PATH_INFO |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
34 |
$ PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
35 |
$ REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
36 |
$ REMOTE_PORT="44703"; export REMOTE_PORT |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
37 |
$ REQUEST_METHOD="GET"; export REQUEST_METHOD |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
38 |
$ REQUEST_URI="/test/"; export REQUEST_URI |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
39 |
$ SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
40 |
$ SCRIPT_NAME="/test"; export SCRIPT_NAME |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
41 |
$ SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
42 |
$ SCRIPT_URL="/test/"; export SCRIPT_URL |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
43 |
$ SERVER_ADDR="127.0.0.1"; export SERVER_ADDR |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
44 |
$ SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
45 |
$ SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
46 |
$ SERVER_PORT="80"; export SERVER_PORT |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
47 |
$ SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
48 |
$ SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
49 |
$ SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE |
6922
1ec2d227a521
hgweb: fix WSGI iterators handling in CGI adapter (issue1254)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
50 |
|
12410
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
51 |
try hgweb request |
6922
1ec2d227a521
hgweb: fix WSGI iterators handling in CGI adapter (issue1254)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
52 |
|
12410
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
53 |
$ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
54 |
$ python hgweb.cgi >page1 2>&1 |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
55 |
$ python "$TESTDIR/md5sum.py" page1 |
2bfb335c7594
tests: unify test-clone-cgi
Matt Mackall <mpm@selenic.com>
parents:
11584
diff
changeset
|
56 |
1f424bb22ec05c3c6bc866b6e67efe43 page1 |