| 1 | Fri Sep 3 18:03:52 CEST 2010 Bernard `Guyzmo` Pratz <bpratz{at}bearstech.com> |
|---|
| 2 | * Added range support to do_http() and inside get() |
|---|
| 3 | diff -rN old-tahoe-lafs/src/allmydata/scripts/common_http.py new-tahoe-lafs/src/allmydata/scripts/common_http.py |
|---|
| 4 | 30c30 |
|---|
| 5 | < def do_http(method, url, body=""): |
|---|
| 6 | --- |
|---|
| 7 | > def do_http(method, url, body="", headers={}): |
|---|
| 8 | 53a54,55 |
|---|
| 9 | > for header, value in headers.iteritems(): |
|---|
| 10 | > c.putheader(header, value) |
|---|
| 11 | diff -rN old-tahoe-lafs/src/allmydata/scripts/tahoe_get.py new-tahoe-lafs/src/allmydata/scripts/tahoe_get.py |
|---|
| 12 | 13a14 |
|---|
| 13 | > frange = None |
|---|
| 14 | 26,27c27,31 |
|---|
| 15 | < resp = do_http("GET", url) |
|---|
| 16 | < if resp.status in (200, 201,): |
|---|
| 17 | --- |
|---|
| 18 | > if frange: |
|---|
| 19 | > resp = do_http("GET", url, headers={'Range' : 'bytes=%d-%d' % (frange[0], frange[1])}) |
|---|
| 20 | > else: |
|---|
| 21 | > resp = do_http("GET", url) |
|---|
| 22 | > if resp.status in (200, 201, 206): |
|---|