diff options
Diffstat (limited to 'proxy.py')
-rw-r--r-- | proxy.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -14,7 +14,7 @@ ENDPOINTS = [ #minimum entity size to start a paralel fetch MINIMAL_SIZE = 524288 -BLOCKSIZE_FETCH = 524288 +BLOCKSIZE_FETCH = 1048576 class Fetcher(asynchat.async_chat): def __init__(self, reader, proxy, url, header, range, content_length): @@ -93,7 +93,8 @@ class MultipleProxyReader(object): print "got body data at pos %s" % pos self.blocks[pos] = data - self.find_next_data() + while self.find_next_data(): + pass def handle_incoming_http_header(self, header): if self.header_sent: @@ -129,17 +130,19 @@ class MultipleProxyReader(object): self.next_endpoint = (self.next_endpoint+1) % len(ENDPOINTS) def find_next_data(self): + r = False print "expect at %s" % self.write_pos, self.blocks.keys() if self.write_pos in self.blocks.keys(): + r=True data = self.blocks.pop(self.write_pos) self.channel.push(data) self.write_pos += len(data) print "Send %s bytes" % len(data) - self.find_next_data() if self.write_pos + 1 >= self.content_length: print "done" self.channel.close_when_done() + return r class HTTPChannel(asynchat.async_chat): def __init__(self, server, sock, addr): |