Skip to content
Snippets Groups Projects
Commit e8efcc8f authored by Mads Kiilerich's avatar Mads Kiilerich
Browse files

hgweb.cgi: fix internal WSGI emulation (issue3804)

The internal WSGI emulation in wsgicgi.py was not fully WSGI compliant and
assumed that all responses sent a body. With 3fbdbeab38cc that caused a real
bug when using hgweb.cgi.

wsgicgi.py will now make sure headers always are sent, using the pattern from
PEP 333 and similar to how it is done in c007e5c54b16.
parent 12de5332
No related branches found
No related tags found
No related merge requests found
......@@ -77,5 +77,7 @@
try:
for chunk in content:
write(chunk)
if not headers_sent:
write('') # send headers now if body was empty
finally:
getattr(content, 'close', lambda : None)()
......@@ -29,3 +29,11 @@
$ python hgweb.cgi >page1 2>&1
$ python "$TESTDIR/md5sum.py" page1
1f424bb22ec05c3c6bc866b6e67efe43 page1
make sure headers are sent even when there is no body
$ QUERY_STRING="cmd=listkeys&namespace=nosuchnamespace" python hgweb.cgi
Status: 200 Script output follows\r (esc)
Content-Type: application/mercurial-0.1\r (esc)
Content-Length: 0\r (esc)
\r (esc)
......@@ -1376,10 +1376,13 @@
$ . "$TESTDIR/cgienv"
$ PATH_INFO=/bookmarks; export PATH_INFO
$ QUERY_STRING='style=raw'
$ python hgweb.cgi
$ python hgweb.cgi | grep -v ETag:
Status: 200 Script output follows\r (esc)
Content-Type: text/plain; charset=ascii\r (esc)
\r (esc)
listbookmarks hides secret bookmarks
$ PATH_INFO=/; export PATH_INFO
$ QUERY_STRING='cmd=listkeys&namespace=bookmarks'
$ python hgweb.cgi
......@@ -1380,9 +1383,13 @@
listbookmarks hides secret bookmarks
$ PATH_INFO=/; export PATH_INFO
$ QUERY_STRING='cmd=listkeys&namespace=bookmarks'
$ python hgweb.cgi
Status: 200 Script output follows\r (esc)
Content-Type: application/mercurial-0.1\r (esc)
Content-Length: 0\r (esc)
\r (esc)
search works with filtering
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment