comparison tests/test-clone-cgi @ 6922:1ec2d227a521

hgweb: fix WSGI iterators handling in CGI adapter (issue1254)
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 21 Aug 2008 10:55:24 +0200
parents
children 1af96b090116
comparison
equal deleted inserted replaced
6921:2cb708e25a5d 6922:1ec2d227a521
1 #!/bin/sh
2 # This is a test of the wire protocol over CGI-based hgweb.
3
4 echo % initialize repository
5 hg init test
6 cd test
7 echo a > a
8 hg ci -Ama
9 cd ..
10
11 cat >hgweb.cgi <<HGWEB
12 #!/usr/bin/env python
13 #
14 # An example CGI script to use hgweb, edit as necessary
15
16 import cgitb
17 cgitb.enable()
18
19 from mercurial import demandimport; demandimport.enable()
20 from mercurial.hgweb import hgweb
21 from mercurial.hgweb import wsgicgi
22
23 application = hgweb("test", "Empty test repository")
24 wsgicgi.launch(application)
25 HGWEB
26 chmod 755 hgweb.cgi
27
28 DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
29 GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
30 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
31 HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
32 HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
33 HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
34 HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
35 HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
36 HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
37 HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
38 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
39 PATH_INFO="/"; export PATH_INFO
40 PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
41 REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
42 REMOTE_PORT="44703"; export REMOTE_PORT
43 REQUEST_METHOD="GET"; export REQUEST_METHOD
44 REQUEST_URI="/test/"; export REQUEST_URI
45 SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
46 SCRIPT_NAME="/test"; export SCRIPT_NAME
47 SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
48 SCRIPT_URL="/test/"; export SCRIPT_URL
49 SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
50 SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
51 SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
52 SERVER_PORT="80"; export SERVER_PORT
53 SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
54 SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE
55 SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
56
57 echo % try hgweb request
58 QUERY_STRING="cmd=changegroup"; export QUERY_STRING
59 python hgweb.cgi >page1 2>&1 ; echo $?
60 python "$TESTDIR/md5sum.py" page1
61
62 exit 0