OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/url_request/url_request_ftp_job.h" | 5 #include "net/url_request/url_request_ftp_job.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <wininet.h> | 8 #include <wininet.h> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // static | 56 // static |
57 URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request, | 57 URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request, |
58 const std::string &scheme) { | 58 const std::string &scheme) { |
59 // Checking whether we are using new or old FTP implementation. | 59 // Checking whether we are using new or old FTP implementation. |
60 if (request->context() && request->context()->ftp_transaction_factory()) | 60 if (request->context() && request->context()->ftp_transaction_factory()) |
61 return URLRequestNewFtpJob::Factory(request, scheme); | 61 return URLRequestNewFtpJob::Factory(request, scheme); |
62 | 62 |
63 DCHECK(scheme == "ftp"); | 63 DCHECK(scheme == "ftp"); |
64 | 64 |
| 65 int port = request->url().IntPort(); |
| 66 |
65 if (request->url().has_port() && | 67 if (request->url().has_port() && |
66 !net::IsPortAllowedByFtp(request->url().IntPort())) | 68 !net::IsPortAllowedByFtp(port) && !net::IsPortAllowedByOverride(port)) |
67 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); | 69 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); |
68 | 70 |
69 return new URLRequestFtpJob(request); | 71 return new URLRequestFtpJob(request); |
70 } | 72 } |
71 | 73 |
72 URLRequestFtpJob::URLRequestFtpJob(URLRequest* request) | 74 URLRequestFtpJob::URLRequestFtpJob(URLRequest* request) |
73 : URLRequestInetJob(request), state_(START), is_directory_(false), | 75 : URLRequestInetJob(request), state_(START), is_directory_(false), |
74 dest_(NULL), dest_size_(0) { | 76 dest_(NULL), dest_size_(0) { |
75 } | 77 } |
76 | 78 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 replacements.SetPathStr(ftp_path); | 550 replacements.SetPathStr(ftp_path); |
549 | 551 |
550 *location = request_->url().ReplaceComponents(replacements); | 552 *location = request_->url().ReplaceComponents(replacements); |
551 *http_status_code = 301; // simulate a permanent redirect | 553 *http_status_code = 301; // simulate a permanent redirect |
552 return true; | 554 return true; |
553 } | 555 } |
554 } | 556 } |
555 | 557 |
556 return false; | 558 return false; |
557 } | 559 } |
OLD | NEW |