author | Adrian Buehlmann <adrian@cadifra.com> |
Wed, 26 Jan 2011 19:14:30 +0100 | |
branch | stable |
changeset 13305 | 035684c6b69a |
parent 12471 | d86dc8b1ffc3 |
child 13269 | aa3f726a2bdb |
permissions | -rw-r--r-- |
12471 | 1 |
This is a rudimentary test of the CGI files as of d74fc8dec2b4. |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
2 |
|
12471 | 3 |
$ hg init test |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
|
12471 | 5 |
$ cat >hgweb.cgi <<HGWEB |
6 |
> #!/usr/bin/env python |
|
7 |
> # |
|
8 |
> # An example CGI script to use hgweb, edit as necessary |
|
9 |
> |
|
10 |
> import cgitb |
|
11 |
> cgitb.enable() |
|
12 |
> |
|
13 |
> from mercurial import demandimport; demandimport.enable() |
|
14 |
> from mercurial.hgweb import hgweb |
|
15 |
> from mercurial.hgweb import wsgicgi |
|
16 |
> |
|
17 |
> application = hgweb("test", "Empty test repository") |
|
18 |
> wsgicgi.launch(application) |
|
19 |
> HGWEB |
|
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
20 |
|
12471 | 21 |
$ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
|
12471 | 23 |
$ cat >hgweb.config <<HGWEBDIRCONF |
24 |
> [paths] |
|
25 |
> test = test |
|
26 |
> HGWEBDIRCONF |
|
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
27 |
|
12471 | 28 |
$ cat >hgwebdir.cgi <<HGWEBDIR |
29 |
> #!/usr/bin/env python |
|
30 |
> # |
|
31 |
> # An example CGI script to export multiple hgweb repos, edit as necessary |
|
32 |
> |
|
33 |
> import cgitb |
|
34 |
> cgitb.enable() |
|
35 |
> |
|
36 |
> from mercurial import demandimport; demandimport.enable() |
|
37 |
> from mercurial.hgweb import hgwebdir |
|
38 |
> from mercurial.hgweb import wsgicgi |
|
39 |
> |
|
40 |
> application = hgwebdir("hgweb.config") |
|
41 |
> wsgicgi.launch(application) |
|
42 |
> HGWEBDIR |
|
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
43 |
|
12471 | 44 |
$ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 |
|
12471 | 46 |
$ DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT |
47 |
$ GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE |
|
48 |
$ 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 |
|
49 |
$ HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET |
|
50 |
$ HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING |
|
51 |
$ HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE |
|
52 |
$ HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL |
|
53 |
$ HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION |
|
54 |
$ HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST |
|
55 |
$ HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE |
|
56 |
$ 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 |
|
57 |
$ PATH_INFO="/"; export PATH_INFO |
|
58 |
$ PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED |
|
59 |
$ QUERY_STRING=""; export QUERY_STRING |
|
60 |
$ REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR |
|
61 |
$ REMOTE_PORT="44703"; export REMOTE_PORT |
|
62 |
$ REQUEST_METHOD="GET"; export REQUEST_METHOD |
|
63 |
$ REQUEST_URI="/test/"; export REQUEST_URI |
|
64 |
$ SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME |
|
65 |
$ SCRIPT_NAME="/test"; export SCRIPT_NAME |
|
66 |
$ SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI |
|
67 |
$ SCRIPT_URL="/test/"; export SCRIPT_URL |
|
68 |
$ SERVER_ADDR="127.0.0.1"; export SERVER_ADDR |
|
69 |
$ SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN |
|
70 |
$ SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME |
|
71 |
$ SERVER_PORT="80"; export SERVER_PORT |
|
72 |
$ SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL |
|
73 |
$ SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE |
|
74 |
$ SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE |
|
75 |
||
76 |
$ python hgweb.cgi > page1 |
|
77 |
$ python hgwebdir.cgi > page2 |
|
78 |
||
79 |
$ PATH_INFO="/test/" |
|
80 |
$ PATH_TRANSLATED="/var/something/test.cgi" |
|
81 |
$ REQUEST_URI="/test/test/" |
|
82 |
$ SCRIPT_URI="http://hg.omnifarious.org/test/test/" |
|
83 |
$ SCRIPT_URL="/test/test/" |
|
84 |
||
85 |
$ python hgwebdir.cgi > page3 |
|
86 |
||
87 |
$ grep -i error page1 page2 page3 |
|
88 |
[1] |