comparison tests/test-hgweb-no-request-uri @ 6945:2cfdabe235fb

hgweb: return content iterator instead of using write() callable This is a new version of 4879468fa28f (which was backed out in 943f066c0d58), with an extra line removed to fix problems with hg serve. hg's internal web server contains checking if the app isn't trying to write more bytes than specified by the Content-Length header. The first try still contained an old line that wrote the response, so the response was sent twice.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sat, 30 Aug 2008 17:13:23 +0200
parents 943f066c0d58
children 6c82beaaa11a
comparison
equal deleted inserted replaced
6944:7e5f3480c45b 6945:2cfdabe235fb
39 'SERVER_NAME': '127.0.0.1', 39 'SERVER_NAME': '127.0.0.1',
40 'SERVER_PORT': os.environ['HGPORT'], 40 'SERVER_PORT': os.environ['HGPORT'],
41 'SERVER_PROTOCOL': 'HTTP/1.0' 41 'SERVER_PROTOCOL': 'HTTP/1.0'
42 } 42 }
43 43
44 def process(app):
45 content = app(env, startrsp)
46 sys.stdout.write(output.getvalue())
47 sys.stdout.write(''.join(content))
48 print '---- ERRORS'
49 print errors.getvalue()
50
51
44 output = StringIO() 52 output = StringIO()
45 env['PATH_INFO'] = '/' 53 env['PATH_INFO'] = '/'
46 env['QUERY_STRING'] = 'style=atom' 54 env['QUERY_STRING'] = 'style=atom'
47 hgweb('.', name = 'repo')(env, startrsp) 55 process(hgweb('.', name = 'repo'))
48 print output.getvalue()
49 print '---- ERRORS'
50 print errors.getvalue()
51 56
52 output = StringIO() 57 output = StringIO()
53 env['PATH_INFO'] = '/file/tip/' 58 env['PATH_INFO'] = '/file/tip/'
54 env['QUERY_STRING'] = 'style=raw' 59 env['QUERY_STRING'] = 'style=raw'
55 hgweb('.', name = 'repo')(env, startrsp) 60 process(hgweb('.', name = 'repo'))
56 print output.getvalue()
57 print '---- ERRORS'
58 print errors.getvalue()
59 61
60 output = StringIO() 62 output = StringIO()
61 env['PATH_INFO'] = '/' 63 env['PATH_INFO'] = '/'
62 env['QUERY_STRING'] = 'style=raw' 64 env['QUERY_STRING'] = 'style=raw'
63 hgwebdir({'repo': '.'})(env, startrsp) 65 process(hgwebdir({'repo': '.'}))
64 print output.getvalue()
65 print '---- ERRORS'
66 print errors.getvalue()
67 66
68 output = StringIO() 67 output = StringIO()
69 env['PATH_INFO'] = '/repo/file/tip/' 68 env['PATH_INFO'] = '/repo/file/tip/'
70 env['QUERY_STRING'] = 'style=raw' 69 env['QUERY_STRING'] = 'style=raw'
71 hgwebdir({'repo': '.'})(env, startrsp) 70 process(hgwebdir({'repo': '.'}))
72 print output.getvalue()
73 print '---- ERRORS'
74 print errors.getvalue()
75 EOF 71 EOF
76 72
77 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//" 73 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//"