34 > print('---- STATUS') |
34 > print('---- STATUS') |
35 > print(status) |
35 > print(status) |
36 > print('---- HEADERS') |
36 > print('---- HEADERS') |
37 > print([i for i in headers if i[0] != 'ETag']) |
37 > print([i for i in headers if i[0] != 'ETag']) |
38 > print('---- DATA') |
38 > print('---- DATA') |
|
39 > sys.stdout.flush() |
39 > return output.write |
40 > return output.write |
40 > |
41 > |
41 > env = { |
42 > env = { |
42 > 'wsgi.version': (1, 0), |
43 > 'wsgi.version': (1, 0), |
43 > 'wsgi.url_scheme': 'http', |
44 > 'wsgi.url_scheme': 'http', |
53 > 'SERVER_PORT': os.environ['HGPORT'], |
54 > 'SERVER_PORT': os.environ['HGPORT'], |
54 > 'SERVER_PROTOCOL': 'HTTP/1.0' |
55 > 'SERVER_PROTOCOL': 'HTTP/1.0' |
55 > } |
56 > } |
56 > |
57 > |
57 > def process(app): |
58 > def process(app): |
|
59 > try: |
|
60 > stdout = sys.stdout.buffer |
|
61 > except AttributeError: |
|
62 > stdout = sys.stdout |
58 > content = app(env, startrsp) |
63 > content = app(env, startrsp) |
59 > sys.stdout.write(output.getvalue()) |
64 > stdout.write(output.getvalue()) |
60 > sys.stdout.write(''.join(content)) |
65 > stdout.write(b''.join(content)) |
|
66 > stdout.flush() |
61 > getattr(content, 'close', lambda : None)() |
67 > getattr(content, 'close', lambda : None)() |
62 > print('---- ERRORS') |
68 > if errors.getvalue(): |
63 > print(errors.getvalue()) |
69 > print('---- ERRORS') |
|
70 > print(errors.getvalue()) |
|
71 > sys.stdout.flush() |
64 > |
72 > |
65 > output = stringio() |
73 > output = stringio() |
66 > env['QUERY_STRING'] = 'style=atom' |
74 > env['QUERY_STRING'] = 'style=atom' |
67 > process(hgweb(b'.', name=b'repo')) |
75 > process(hgweb(b'.', name=b'repo')) |
68 > |
76 > |