/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/HttpServer.py

Merge a recent bzr.dev (2172) and takes John's remarks into account.

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
            file = open(path, 'rb')
160
160
        except IOError:
161
161
            self.send_error(404, "File not found")
162
 
            return None
 
162
            return
163
163
 
164
164
        file_size = os.fstat(file.fileno())[6]
165
165
        tail, ranges = self.parse_ranges(ranges_header_value)
176
176
                    ranges_valid = False
177
177
                    break
178
178
        if not ranges_valid:
179
 
            # RFC2616 14-16 says that invalid Range headers
180
 
            # should be ignored and in that case, the whole file
181
 
            # should be returned as if no Range header was
182
 
            # present
183
 
            file.close() # Will be reopened by the following call
184
 
            return SimpleHTTPRequestHandler.do_GET(self)
 
179
            # RFC2616 14-16 says that invalid Range headers could
 
180
            # be ignored. If they are, the whole file should be
 
181
            # returned as though no Range header was present. If
 
182
            # they aren't, the server should return a 416 error.
 
183
            file.close()
 
184
            self.send_error(416, "Requested range not satisfiable")
 
185
            return
185
186
 
186
187
        if len(ranges) == 1:
187
188
            (start, end) = ranges[0]