# HG changeset patch # User Alexander Boyd # Date 1339290804 21600 # Node ID a2d6e336e9ccfec9e90ad859f55197403debece1 # Parent 15159abc5ab68050e9a19cc1c74240a937dd1a85 statichttprepo: don't send Range header when requesting entire file When requesting files using statichttprepo.httprangereader, a request for the entire file is sent with a Range: bytes=0- header. This causes problems with web servers such as Cherokee that return an HTTP 416 when an empty file is requested in this way, which in turn cause some repository clone attempts to fail. This patch omits the Range header when the entire file is being requested, which fixes the problem. diff -r 15159abc5ab6 -r a2d6e336e9cc mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py Wed Jun 06 21:17:20 2012 -0500 +++ b/mercurial/statichttprepo.py Sat Jun 09 19:13:24 2012 -0600 @@ -26,7 +26,8 @@ end = '' if bytes: end = self.pos + bytes - 1 - req.add_header('Range', 'bytes=%d-%s' % (self.pos, end)) + if self.pos or end: + req.add_header('Range', 'bytes=%d-%s' % (self.pos, end)) try: f = self.opener.open(req)