Chromium Code Reviews| Index: net/url_request/url_request_file_dir_job.cc |
| =================================================================== |
| --- net/url_request/url_request_file_dir_job.cc (revision 5946) |
| +++ net/url_request/url_request_file_dir_job.cc (working copy) |
| @@ -199,3 +199,24 @@ |
| } |
| } |
| +bool URLRequestFileDirJob::IsRedirectResponse( |
| + GURL* location, int* http_status_code) { |
| + // If the URL did not have a trailing slash, treat the response as a redirect |
| + // to the URL with a trailing slash appended. |
| + std::string path = request_->url().path(); |
| + if (path[path.size() - 1] != '/') { |
|
tony
2008/11/25 21:42:52
Does path always return at least '/' or do you nee
|
| + // This happens when we discovered the file is a directory, so needs a |
| + // slash at the end of the path. |
| + std::string new_path = path; |
| + new_path.push_back('/'); |
| + GURL::Replacements replacements; |
| + replacements.SetPathStr(new_path); |
| + |
| + *location = request_->url().ReplaceComponents(replacements); |
| + *http_status_code = 301; // simulate a permanent redirect |
| + return true; |
| + } |
| + |
| + return false; |
| +} |
| + |