def challenge(self, environ, status, app_headers, forget_headers): """Return a 401 page unconditionally.""" headers = app_headers + forget_headers #remove content-length header headers = filter(lambda h: h[0].lower() != 'content-length', headers) # The HTTP status code and reason may not be the default ones: status_parts = self._HTTP_STATUS_PATTERN.search(status) reason = status_parts.group('reason') code = int(status_parts.group('code')) response = HTTPUnauthorized(headers=headers) response.title = reason response.code = code return response
def challenge(self, environ, status, app_headers, forget_headers): """Return a 401 page unconditionally.""" headers = app_headers + forget_headers #remove content-length header headers = filter(lambda h:h[0].lower() != 'content-length', headers) # The HTTP status code and reason may not be the default ones: status_parts = self._HTTP_STATUS_PATTERN.search(status) reason = status_parts.group('reason') code = int(status_parts.group('code')) response = HTTPUnauthorized(headers=headers) response.title = reason response.code = code return response