--- a/mercurial/hgweb/protocol.py Fri Jul 16 23:02:46 2010 +0200
+++ b/mercurial/hgweb/protocol.py Fri Jul 16 18:16:15 2010 +0200
@@ -28,6 +28,16 @@
else:
data[k] = self.req.form[k][0]
return [data[k] for k in keys]
+ def getfile(self, fp):
+ length = int(self.req.env['CONTENT_LENGTH'])
+ for s in util.filechunkiter(self.req, limit=length):
+ fp.write(s)
+ def redirect(self):
+ self.oldio = sys.stdout, sys.stderr
+ sys.stderr = sys.stdout = cStringIO.StringIO()
+ def respond(self, s):
+ self.req.respond(HTTP_OK, HGTYPE, length=len(s))
+ self.response = s
def sendchangegroup(self, cg):
self.req.respond(HTTP_OK, HGTYPE)
z = zlib.compressobj()
@@ -41,16 +51,6 @@
self.req.respond(HTTP_OK, HGTYPE)
for chunk in source:
self.req.write(chunk)
- def respond(self, s):
- self.req.respond(HTTP_OK, HGTYPE, length=len(s))
- self.response = s
- def getfile(self, fp):
- length = int(self.req.env['CONTENT_LENGTH'])
- for s in util.filechunkiter(self.req, limit=length):
- fp.write(s)
- def redirect(self):
- self.oldio = sys.stdout, sys.stderr
- sys.stderr = sys.stdout = cStringIO.StringIO()
def respondpush(self, ret):
val = sys.stdout.getvalue()
sys.stdout, sys.stderr = self.oldio
--- a/mercurial/sshserver.py Fri Jul 16 23:02:46 2010 +0200
+++ b/mercurial/sshserver.py Fri Jul 16 18:16:15 2010 +0200
@@ -49,6 +49,16 @@
def getarg(self, name):
return self.getargs(name)[0]
+ def getfile(self, fpout):
+ self.respond('')
+ count = int(self.fin.readline())
+ while count:
+ fpout.write(self.fin.read(count))
+ count = int(self.fin.readline())
+
+ def redirect(self):
+ pass
+
def respond(self, v):
self.fout.write("%d\n" % len(v))
self.fout.write(v)
@@ -68,16 +78,6 @@
self.fout.write(chunk)
self.fout.flush()
- def getfile(self, fpout):
- self.respond('')
- count = int(self.fin.readline())
- while count:
- fpout.write(self.fin.read(count))
- count = int(self.fin.readline())
-
- def redirect(self):
- pass
-
def respondpush(self, ret):
self.respond('')
self.respond(str(ret))