| 1 |
#require no-msys # MSYS will translate web paths as if they were file paths |
| 2 |
|
| 3 |
This tests if CGI files from after d0db3462d568 but |
| 4 |
before d74fc8dec2b4 still work. |
| 5 |
|
| 6 |
$ hg init test |
| 7 |
$ cat >hgweb.cgi <<HGWEB |
| 8 |
> #!$PYTHON |
| 9 |
> # |
| 10 |
> # An example CGI script to use hgweb, edit as necessary |
| 11 |
> |
| 12 |
> from mercurial import demandimport; demandimport.enable() |
| 13 |
> from mercurial.hgweb import hgweb |
| 14 |
> from mercurial.hgweb import wsgicgi |
| 15 |
> from mercurial.hgweb.request import wsgiapplication |
| 16 |
> |
| 17 |
> def make_web_app(): |
| 18 |
> return hgweb(b"test", b"Empty test repository") |
| 19 |
> |
| 20 |
> wsgicgi.launch(wsgiapplication(make_web_app)) |
| 21 |
> HGWEB |
| 22 |
|
| 23 |
$ chmod 755 hgweb.cgi |
| 24 |
|
| 25 |
$ cat >hgweb.config <<HGWEBDIRCONF |
| 26 |
> [paths] |
| 27 |
> test = test |
| 28 |
> HGWEBDIRCONF |
| 29 |
|
| 30 |
$ cat >hgwebdir.cgi <<HGWEBDIR |
| 31 |
> #!$PYTHON |
| 32 |
> # |
| 33 |
> # An example CGI script to export multiple hgweb repos, edit as necessary |
| 34 |
> |
| 35 |
> from mercurial import demandimport; demandimport.enable() |
| 36 |
> from mercurial.hgweb import hgwebdir |
| 37 |
> from mercurial.hgweb import wsgicgi |
| 38 |
> from mercurial.hgweb.request import wsgiapplication |
| 39 |
> |
| 40 |
> def make_web_app(): |
| 41 |
> return hgwebdir(b"hgweb.config") |
| 42 |
> |
| 43 |
> wsgicgi.launch(wsgiapplication(make_web_app)) |
| 44 |
> HGWEBDIR |
| 45 |
|
| 46 |
$ chmod 755 hgwebdir.cgi |
| 47 |
|
| 48 |
$ . "$TESTDIR/cgienv" |
| 49 |
$ "$PYTHON" hgweb.cgi > page1 |
| 50 |
$ "$PYTHON" hgwebdir.cgi > page2 |
| 51 |
|
| 52 |
$ PATH_INFO="/test/" |
| 53 |
$ PATH_TRANSLATED="/var/something/test.cgi" |
| 54 |
$ REQUEST_URI="/test/test/" |
| 55 |
$ SCRIPT_URI="http://hg.omnifarious.org/test/test/" |
| 56 |
$ SCRIPT_URL="/test/test/" |
| 57 |
$ "$PYTHON" hgwebdir.cgi > page3 |
| 58 |
|
| 59 |
$ grep -i error page1 page2 page3 |
| 60 |
[1] |