##// END OF EJS Templates
Fixed call to ui.warn()...
Fixed call to ui.warn() -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Fixed call to ui.warn() manifest hash: 3b82298c61822aaa41b4d9b579ec94a968a4b610 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCvqpMW7P1GVgWeRoRAotJAKCKG1BH2RKobak9ebapjViN8cQI1ACgisqU jghqrq9978lFUA9zjA/N2eE= =g65B -----END PGP SIGNATURE-----

File last commit:

r372:4b0f562c default
r480:430a1066 default
Show More
httprangereader.py
24 lines | 762 B | text/x-python | PythonLexer
# httprangereader.py - just what it says
#
# Copyright 2005 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
import byterange, urllib2
class httprangereader:
def __init__(self, url):
self.url = url
self.pos = 0
def seek(self, pos):
self.pos = pos
def read(self, bytes=None):
opener = urllib2.build_opener(byterange.HTTPRangeHandler())
urllib2.install_opener(opener)
req = urllib2.Request(self.url)
end = ''
if bytes: end = self.pos + bytes
req.add_header('Range', 'bytes=%d-%s' % (self.pos, end))
f = urllib2.urlopen(req)
return f.read()