diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-21 11:34:08 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-21 11:34:08 (GMT) |
commit | a0fbc612504f9022fa882aaf0963a5df53adf2cd (patch) | |
tree | a458707f252637c34a5be0f69e74288e6c26cfa6 | |
parent | 4d385d3b600f264e9c0619de5a847a6e40fd5fff (diff) |
Fix #1722.
-rw-r--r-- | documentnode.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/documentnode.py b/documentnode.py index 29769f7..ac6ac28 100644 --- a/documentnode.py +++ b/documentnode.py @@ -130,10 +130,8 @@ class DocumentNode: file_output_stream = cls.createInstance(interfaces.nsIFileOutputStream) file_output_stream.init(dest_file, -1, -1, 0) - # TODO: this is not reliable, sometimes reports 4096 - bytes_to_read = http_input_stream.available() - while bytes_to_read: - buf = str(http_input_stream.read(min(8192, bytes_to_read))) + buf = str(http_input_stream.read(8192)) + while buf: bytes_read = len(buf) print "bytes_read %i" % bytes_read bytes_to_write = bytes_read @@ -142,7 +140,7 @@ class DocumentNode: print "bytes_written %i" % bytes_written bytes_to_write -= bytes_written - bytes_to_read -= bytes_read + buf = str(http_input_stream.read(8192)) http_input_stream.close() file_output_stream.close() |