~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/HTTPTestUtil.py

  • Committer: John Arbash Meinel
  • Date: 2007-06-28 23:18:09 UTC
  • mfrom: (2562 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2566.
  • Revision ID: john@arbash-meinel.com-20070628231809-pqbt7puoqj8bl07b
[merge] bzr.dev 2562

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        return self.get_single_range(file, file_size, start, end)
163
163
 
164
164
 
 
165
class SingleOnlyRangeRequestHandler(TestingHTTPRequestHandler):
 
166
    """Only reply to simple range requests, errors out on multiple"""
 
167
 
 
168
    def get_multiple_ranges(self, file, file_size, ranges):
 
169
        """Refuses the multiple ranges request"""
 
170
        if len(ranges) > 1:
 
171
            file.close()
 
172
            self.send_error(416, "Requested range not satisfiable")
 
173
            return
 
174
        (start, end) = ranges[0]
 
175
        return self.get_single_range(file, file_size, start, end)
 
176
 
 
177
 
165
178
class NoRangeRequestHandler(TestingHTTPRequestHandler):
166
179
    """Ignore range requests without notice"""
167
180
 
380
393
    def send_header_auth_reqed(self):
381
394
        tcs = self.server.test_case_server
382
395
        header = 'Digest realm="%s", ' % tcs.auth_realm
383
 
        header += 'nonce="%s", algorithm=%s, qop=auth' % (tcs.auth_nonce, 'MD5')
 
396
        header += 'nonce="%s", algorithm="%s", qop="auth"' % (tcs.auth_nonce,
 
397
                                                              'MD5')
384
398
        self.send_header(tcs.auth_header_sent,header)
385
399
 
386
400