| Index: net/url_request/url_request_job_manager.cc
|
| ===================================================================
|
| --- net/url_request/url_request_job_manager.cc (revision 13871)
|
| +++ net/url_request/url_request_job_manager.cc (working copy)
|
| @@ -59,9 +59,8 @@
|
| if (!request->url().is_valid())
|
| return new URLRequestErrorJob(request, net::ERR_INVALID_URL);
|
|
|
| + // We do this here to avoid asking interceptors about unsupported schemes.
|
| const std::string& scheme = request->url().scheme(); // already lowercase
|
| -
|
| - // We do this here to avoid asking interceptors about unsupported schemes.
|
| if (!SupportsScheme(scheme))
|
| return new URLRequestErrorJob(request, net::ERR_UNKNOWN_URL_SCHEME);
|
|
|
| @@ -104,6 +103,47 @@
|
| return new URLRequestErrorJob(request, net::ERR_FAILED);
|
| }
|
|
|
| +URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
|
| + URLRequest* request,
|
| + const GURL& location) const {
|
| +#ifndef NDEBUG
|
| + DCHECK(IsAllowedThread());
|
| +#endif
|
| + if ((request->load_flags() & net::LOAD_DISABLE_INTERCEPT) ||
|
| + (request->status().status() == URLRequestStatus::CANCELED) ||
|
| + !request->url().is_valid() ||
|
| + !SupportsScheme(request->url().scheme()))
|
| + return NULL;
|
| +
|
| + InterceptorList::const_iterator i;
|
| + for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
|
| + URLRequestJob* job = (*i)->MaybeInterceptRedirect(request, location);
|
| + if (job)
|
| + return job;
|
| + }
|
| + return NULL;
|
| +}
|
| +
|
| +URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
|
| + URLRequest* request) const {
|
| +#ifndef NDEBUG
|
| + DCHECK(IsAllowedThread());
|
| +#endif
|
| + if ((request->load_flags() & net::LOAD_DISABLE_INTERCEPT) ||
|
| + (request->status().status() == URLRequestStatus::CANCELED) ||
|
| + !request->url().is_valid() ||
|
| + !SupportsScheme(request->url().scheme()))
|
| + return NULL;
|
| +
|
| + InterceptorList::const_iterator i;
|
| + for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
|
| + URLRequestJob* job = (*i)->MaybeInterceptResponse(request);
|
| + if (job)
|
| + return job;
|
| + }
|
| + return NULL;
|
| +}
|
| +
|
| bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const {
|
| // The set of registered factories may change on another thread.
|
| {
|
|
|