diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 23:54:01 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 23:54:01 +0000 |
commit | 3879bbe4318182fe38f6dc5244454665e0cf62ba (patch) | |
tree | 27c208b5947c8af4d1ea08ae696edf1b2a0cfb95 /net/url_request | |
parent | 8a7ad8bcfa38b3c1de9beb1e3cf9a896ccf4842f (diff) | |
download | chromium_src-3879bbe4318182fe38f6dc5244454665e0cf62ba.zip chromium_src-3879bbe4318182fe38f6dc5244454665e0cf62ba.tar.gz chromium_src-3879bbe4318182fe38f6dc5244454665e0cf62ba.tar.bz2 |
Don't accept the url "file:///" on windows (report an error).
See alternate solution here: http://codereview.chromium.org/27119
r=brettw
BUG=1474
Review URL: http://codereview.chromium.org/28102
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_file_job.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index baf94a2..e120aa6 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -73,8 +73,9 @@ URLRequestJob* URLRequestFileJob::Factory( URLRequest* request, const std::string& scheme) { FilePath file_path; if (net::FileURLToFilePath(request->url(), &file_path) && - file_util::EnsureEndsWithSeparator(&file_path)) - return new URLRequestFileDirJob(request, file_path); + file_util::EnsureEndsWithSeparator(&file_path) && + file_path.IsAbsolute()) + return new URLRequestFileDirJob(request, file_path); // Use a regular file request job for all non-directories (including invalid // file names). @@ -165,10 +166,14 @@ void URLRequestFileJob::DidResolve( return; int rv = net::OK; - if (!exists) { + // We use URLRequestFileJob to handle valid and invalid files as well as + // invalid directories. For a directory to be invalid, it must either not + // exist, or be "\" on Windows. (Windows resolves "\" to "C:\", thus + // reporting it as existent.) On POSIX, we don't count any existent + // directory as invalid. + if (!exists || file_info.is_directory) { rv = net::ERR_FILE_NOT_FOUND; } else { - DCHECK(!file_info.is_directory); int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | base::PLATFORM_FILE_ASYNC; |