]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commit - src/allmydata/test/test_util.py
One fix for bug #1154: webapi GETs with a 'Range' header broke new-downloader.
authorBrian Warner <warner@lothar.com>
Wed, 4 Aug 2010 18:45:49 +0000 (11:45 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 4 Aug 2010 18:45:49 +0000 (11:45 -0700)
commit8844655705e4fb7633f2fda3e77c0d7bd7b9cacd
treef9e1d2eb5ab42415c3465d56cb1ddbfd7c01154d
parent2bd87498498d7c44fbf928a3a6bb0bf58e63c0e8
One fix for bug #1154: webapi GETs with a 'Range' header broke new-downloader.

The Range header causes n.read() to be called with an offset= of type 'long',
which eventually got used in a Spans/DataSpans object's __len__ method.
Apparently python doesn't permit __len__() to return longs, only ints.
Rewrote Spans/DataSpans to use s.len() instead of len(s) aka s.__len__() .
Added a test in test_download. Note that test_web didn't catch this because
it uses mock FileNodes for speed: it's probably time to rewrite that.

There is still an unresolved error-recovery problem in #1154, so I'm not
closing the ticket quite yet.
src/allmydata/immutable/downloader/share.py
src/allmydata/test/test_download.py
src/allmydata/test/test_util.py
src/allmydata/util/spans.py