##// END OF EJS Templates
Backed out changeset 4879468fa28f (incorrect Content-Length on Windows)
Dirkjan Ochtman -
r6796:943f066c default
parent child Browse files
Show More
@@ -169,20 +169,20 b' class hgweb(object):'
169 169
170 170 req.write(content)
171 171 del tmpl
172 return ''.join(content),
172 return req
173 173
174 174 except revlog.LookupError, err:
175 175 req.respond(HTTP_NOT_FOUND, ctype)
176 176 msg = str(err)
177 177 if 'manifest' not in msg:
178 178 msg = 'revision not found: %s' % err.name
179 return ''.join(tmpl('error', error=msg)),
179 req.write(tmpl('error', error=msg))
180 180 except (RepoError, revlog.RevlogError), inst:
181 181 req.respond(HTTP_SERVER_ERROR, ctype)
182 return ''.join(tmpl('error', error=str(inst))),
182 req.write(tmpl('error', error=str(inst)))
183 183 except ErrorResponse, inst:
184 184 req.respond(inst.code, ctype)
185 return ''.join(tmpl('error', error=inst.message)),
185 req.write(tmpl('error', error=inst.message))
186 186
187 187 def templater(self, req):
188 188
@@ -70,7 +70,8 b' class hgwebdir(object):'
70 70
71 71 def __call__(self, env, respond):
72 72 req = wsgirequest(env, respond)
73 return self.run_wsgi(req)
73 self.run_wsgi(req)
74 return req
74 75
75 76 def run_wsgi(self, req):
76 77
@@ -89,12 +90,14 b' class hgwebdir(object):'
89 90 fname = virtual[7:]
90 91 else:
91 92 fname = req.form['static'][0]
92 return staticfile(static, fname, req),
93 req.write(staticfile(static, fname, req))
94 return
93 95
94 96 # top-level index
95 97 elif not virtual:
96 98 req.respond(HTTP_OK, ctype)
97 return ''.join(self.makeindex(req, tmpl)),
99 req.write(self.makeindex(req, tmpl))
100 return
98 101
99 102 # nested indexes and hgwebs
100 103
@@ -105,7 +108,8 b' class hgwebdir(object):'
105 108 req.env['REPO_NAME'] = virtual
106 109 try:
107 110 repo = hg.repository(self.parentui, real)
108 return hgweb(repo).run_wsgi(req)
111 hgweb(repo).run_wsgi(req)
112 return
109 113 except IOError, inst:
110 114 msg = inst.strerror
111 115 raise ErrorResponse(HTTP_SERVER_ERROR, msg)
@@ -116,7 +120,8 b' class hgwebdir(object):'
116 120 subdir = virtual + '/'
117 121 if [r for r in repos if r.startswith(subdir)]:
118 122 req.respond(HTTP_OK, ctype)
119 return ''.join(self.makeindex(req, tmpl, subdir)),
123 req.write(self.makeindex(req, tmpl, subdir))
124 return
120 125
121 126 up = virtual.rfind('/')
122 127 if up < 0:
@@ -125,11 +130,11 b' class hgwebdir(object):'
125 130
126 131 # prefixes not found
127 132 req.respond(HTTP_NOT_FOUND, ctype)
128 return ''.join(tmpl("notfound", repo=virtual)),
133 req.write(tmpl("notfound", repo=virtual))
129 134
130 135 except ErrorResponse, err:
131 136 req.respond(err.code, ctype)
132 return ''.join(tmpl('error', error=err.message or '')),
137 req.write(tmpl('error', error=err.message or ''))
133 138 finally:
134 139 tmpl = None
135 140
@@ -43,17 +43,15 b' env = {'
43 43
44 44 output = StringIO()
45 45 env['QUERY_STRING'] = 'style=atom'
46 content = hgweb('.', name = 'repo')(env, startrsp)
47 sys.stdout.write(output.getvalue())
48 sys.stdout.write(''.join(content))
46 hgweb('.', name = 'repo')(env, startrsp)
47 print output.getvalue()
49 48 print '---- ERRORS'
50 49 print errors.getvalue()
51 50
52 51 output = StringIO()
53 52 env['QUERY_STRING'] = 'style=raw'
54 content = hgwebdir({'repo': '.'})(env, startrsp)
55 sys.stdout.write(output.getvalue())
56 sys.stdout.write(''.join(content))
53 hgwebdir({'repo': '.'})(env, startrsp)
54 print output.getvalue()
57 55 print '---- ERRORS'
58 56 print errors.getvalue()
59 57 EOF
@@ -35,6 +35,7 b' 200 Script output follows'
35 35 </entry>
36 36
37 37 </feed>
38
38 39 ---- ERRORS
39 40
40 41 ---- HEADERS
@@ -44,5 +45,6 b' 200 Script output follows'
44 45
45 46 repo/
46 47
48
47 49 ---- ERRORS
48 50
@@ -44,36 +44,32 b' env = {'
44 44 output = StringIO()
45 45 env['PATH_INFO'] = '/'
46 46 env['QUERY_STRING'] = 'style=atom'
47 content = hgweb('.', name = 'repo')(env, startrsp)
48 sys.stdout.write(output.getvalue())
49 sys.stdout.write(''.join(content))
47 hgweb('.', name = 'repo')(env, startrsp)
48 print output.getvalue()
50 49 print '---- ERRORS'
51 50 print errors.getvalue()
52 51
53 52 output = StringIO()
54 53 env['PATH_INFO'] = '/file/tip/'
55 54 env['QUERY_STRING'] = 'style=raw'
56 content = hgweb('.', name = 'repo')(env, startrsp)
57 sys.stdout.write(output.getvalue())
58 sys.stdout.write(''.join(content))
55 hgweb('.', name = 'repo')(env, startrsp)
56 print output.getvalue()
59 57 print '---- ERRORS'
60 58 print errors.getvalue()
61 59
62 60 output = StringIO()
63 61 env['PATH_INFO'] = '/'
64 62 env['QUERY_STRING'] = 'style=raw'
65 content = hgwebdir({'repo': '.'})(env, startrsp)
66 sys.stdout.write(output.getvalue())
67 sys.stdout.write(''.join(content))
63 hgwebdir({'repo': '.'})(env, startrsp)
64 print output.getvalue()
68 65 print '---- ERRORS'
69 66 print errors.getvalue()
70 67
71 68 output = StringIO()
72 69 env['PATH_INFO'] = '/repo/file/tip/'
73 70 env['QUERY_STRING'] = 'style=raw'
74 content = hgwebdir({'repo': '.'})(env, startrsp)
75 sys.stdout.write(output.getvalue())
76 sys.stdout.write(''.join(content))
71 hgwebdir({'repo': '.'})(env, startrsp)
72 print output.getvalue()
77 73 print '---- ERRORS'
78 74 print errors.getvalue()
79 75 EOF
@@ -35,6 +35,7 b' 200 Script output follows'
35 35 </entry>
36 36
37 37 </feed>
38
38 39 ---- ERRORS
39 40
40 41 ---- HEADERS
@@ -45,6 +46,7 b' 200 Script output follows'
45 46 -rw-r--r-- 4 bar
46 47
47 48
49
48 50 ---- ERRORS
49 51
50 52 ---- HEADERS
@@ -54,6 +56,7 b' 200 Script output follows'
54 56
55 57 /repo/
56 58
59
57 60 ---- ERRORS
58 61
59 62 ---- HEADERS
@@ -64,5 +67,6 b' 200 Script output follows'
64 67 -rw-r--r-- 4 bar
65 68
66 69
70
67 71 ---- ERRORS
68 72
General Comments 0
You need to be logged in to leave comments. Login now