| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_new_ftp_job.h" | 5 #include "net/url_request/url_request_new_ftp_job.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 URLRequestNewFtpJob::~URLRequestNewFtpJob() { | 75 URLRequestNewFtpJob::~URLRequestNewFtpJob() { |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 URLRequestJob* URLRequestNewFtpJob::Factory(URLRequest* request, | 79 URLRequestJob* URLRequestNewFtpJob::Factory(URLRequest* request, |
| 80 const std::string& scheme) { | 80 const std::string& scheme) { |
| 81 DCHECK_EQ(scheme, "ftp"); | 81 DCHECK_EQ(scheme, "ftp"); |
| 82 | 82 |
| 83 int port = request->url().IntPort(); |
| 83 if (request->url().has_port() && | 84 if (request->url().has_port() && |
| 84 !net::IsPortAllowedByFtp(request->url().IntPort())) | 85 !net::IsPortAllowedByFtp(port) && !net::IsPortAllowedByOverride(port)) |
| 85 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); | 86 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); |
| 86 | 87 |
| 87 DCHECK(request->context()); | 88 DCHECK(request->context()); |
| 88 DCHECK(request->context()->ftp_transaction_factory()); | 89 DCHECK(request->context()->ftp_transaction_factory()); |
| 89 return new URLRequestNewFtpJob(request); | 90 return new URLRequestNewFtpJob(request); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void URLRequestNewFtpJob::Start() { | 93 void URLRequestNewFtpJob::Start() { |
| 93 DCHECK(!transaction_.get()); | 94 DCHECK(!transaction_.get()); |
| 94 request_info_.url = request_->url(); | 95 request_info_.url = request_->url(); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 400 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 400 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); | 401 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); |
| 401 } | 402 } |
| 402 | 403 |
| 403 void URLRequestNewFtpJob::DestroyTransaction() { | 404 void URLRequestNewFtpJob::DestroyTransaction() { |
| 404 DCHECK(transaction_.get()); | 405 DCHECK(transaction_.get()); |
| 405 | 406 |
| 406 transaction_.reset(); | 407 transaction_.reset(); |
| 407 response_info_ = NULL; | 408 response_info_ = NULL; |
| 408 } | 409 } |
| OLD | NEW |