equal
deleted
inserted
replaced
66 count = int(self.fin.readline()) |
66 count = int(self.fin.readline()) |
67 |
67 |
68 def redirect(self): |
68 def redirect(self): |
69 pass |
69 pass |
70 |
70 |
71 def groupchunks(self, fh): |
|
72 return iter(lambda: fh.read(4096), '') |
|
73 |
|
74 def compresschunks(self, chunks): |
|
75 for chunk in chunks: |
|
76 yield chunk |
|
77 |
|
78 def sendresponse(self, v): |
71 def sendresponse(self, v): |
79 self.fout.write("%d\n" % len(v)) |
72 self.fout.write("%d\n" % len(v)) |
80 self.fout.write(v) |
73 self.fout.write(v) |
81 self.fout.flush() |
74 self.fout.flush() |
82 |
75 |
83 def sendstream(self, source): |
76 def sendstream(self, source): |
84 write = self.fout.write |
77 write = self.fout.write |
85 for chunk in source.gen: |
78 |
|
79 if source.reader: |
|
80 gen = iter(lambda: source.reader.read(4096), '') |
|
81 else: |
|
82 gen = source.gen |
|
83 |
|
84 for chunk in gen: |
86 write(chunk) |
85 write(chunk) |
87 self.fout.flush() |
86 self.fout.flush() |
88 |
87 |
89 def sendpushresponse(self, rsp): |
88 def sendpushresponse(self, rsp): |
90 self.sendresponse('') |
89 self.sendresponse('') |