equal
deleted
inserted
replaced
8 import cgi, cStringIO, zlib, urllib |
8 import cgi, cStringIO, zlib, urllib |
9 from mercurial import util, wireproto |
9 from mercurial import util, wireproto |
10 from common import HTTP_OK |
10 from common import HTTP_OK |
11 |
11 |
12 HGTYPE = 'application/mercurial-0.1' |
12 HGTYPE = 'application/mercurial-0.1' |
|
13 HGERRTYPE = 'application/hg-error' |
13 |
14 |
14 class webproto(object): |
15 class webproto(object): |
15 def __init__(self, req, ui): |
16 def __init__(self, req, ui): |
16 self.req = req |
17 self.req = req |
17 self.response = '' |
18 self.response = '' |
88 req.drain() |
89 req.drain() |
89 p.restore() |
90 p.restore() |
90 rsp = '0\n%s\n' % rsp.res |
91 rsp = '0\n%s\n' % rsp.res |
91 req.respond(HTTP_OK, HGTYPE, length=len(rsp)) |
92 req.respond(HTTP_OK, HGTYPE, length=len(rsp)) |
92 return [rsp] |
93 return [rsp] |
|
94 elif isinstance(rsp, wireproto.ooberror): |
|
95 rsp = rsp.message |
|
96 req.respond(HTTP_OK, HGERRTYPE, length=len(rsp)) |
|
97 return [rsp] |