53
53
"""Hand the request off to a smart server instance."""
54
backing = transport.get_transport_from_path(
54
backing = transport.get_transport(
55
55
self.server.test_case_server._home_dir)
56
56
chroot_server = chroot.ChrootServer(backing)
57
57
chroot_server.start_server()
59
t = transport.get_transport_from_url(chroot_server.get_url())
59
t = transport.get_transport(chroot_server.get_url())
60
60
self.do_POST_inner(t)
62
62
chroot_server.stop_server()
153
153
return self._adjust_url(base, relpath)
155
155
def get_secondary_transport(self, relpath=None):
156
t = transport.get_transport_from_url(self.get_secondary_url(relpath))
156
t = transport.get_transport(self.get_secondary_url(relpath))
157
157
self.assertTrue(t.is_readonly())
257
257
return self._adjust_url(base, relpath)
259
259
def get_old_transport(self, relpath=None):
260
t = transport.get_transport_from_url(self.get_old_url(relpath))
260
t = transport.get_transport(self.get_old_url(relpath))
261
261
self.assertTrue(t.is_readonly())
266
266
return self._adjust_url(base, relpath)
268
268
def get_new_transport(self, relpath=None):
269
t = transport.get_transport_from_url(self.get_new_url(relpath))
269
t = transport.get_transport(self.get_new_url(relpath))
270
270
self.assertTrue(t.is_readonly())
284
284
# - auth_header_recv: the header received containing auth
285
285
# - auth_error_code: the error code to indicate auth required
287
def _require_authentication(self):
288
# Note that we must update test_case_server *before*
289
# sending the error or the client may try to read it
290
# before we have sent the whole error back.
291
tcs = self.server.test_case_server
292
tcs.auth_required_errors += 1
293
self.send_response(tcs.auth_error_code)
294
self.send_header_auth_reqed()
295
# We do not send a body
296
self.send_header('Content-Length', '0')
300
287
def do_GET(self):
301
288
if self.authorized():
302
289
return http_server.TestingHTTPRequestHandler.do_GET(self)
304
return self._require_authentication()
307
if self.authorized():
308
return http_server.TestingHTTPRequestHandler.do_HEAD(self)
310
return self._require_authentication()
291
# Note that we must update test_case_server *before*
292
# sending the error or the client may try to read it
293
# before we have sent the whole error back.
294
tcs = self.server.test_case_server
295
tcs.auth_required_errors += 1
296
self.send_response(tcs.auth_error_code)
297
self.send_header_auth_reqed()
298
# We do not send a body
299
self.send_header('Content-Length', '0')
313
304
class BasicAuthRequestHandler(AuthRequestHandler):