| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // requires auth (and not a proxy), because connecting to FTP via proxy | 75 // requires auth (and not a proxy), because connecting to FTP via proxy |
| 76 // effectively means the browser communicates via HTTP, and uses HTTP's | 76 // effectively means the browser communicates via HTTP, and uses HTTP's |
| 77 // Proxy-Authenticate protocol when proxy servers require auth. | 77 // Proxy-Authenticate protocol when proxy servers require auth. |
| 78 return server_auth_ && server_auth_->state == net::AUTH_STATE_NEED_AUTH; | 78 return server_auth_ && server_auth_->state == net::AUTH_STATE_NEED_AUTH; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void URLRequestFtpJob::GetAuthChallengeInfo( | 81 void URLRequestFtpJob::GetAuthChallengeInfo( |
| 82 scoped_refptr<net::AuthChallengeInfo>* result) { | 82 scoped_refptr<net::AuthChallengeInfo>* result) { |
| 83 DCHECK((server_auth_ != NULL) && | 83 DCHECK((server_auth_ != NULL) && |
| 84 (server_auth_->state == net::AUTH_STATE_NEED_AUTH)); | 84 (server_auth_->state == net::AUTH_STATE_NEED_AUTH)); |
| 85 scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo; | 85 scoped_refptr<net::AuthChallengeInfo> auth_info(new net::AuthChallengeInfo); |
| 86 auth_info->is_proxy = false; | 86 auth_info->is_proxy = false; |
| 87 auth_info->host_and_port = ASCIIToWide( | 87 auth_info->host_and_port = ASCIIToWide( |
| 88 net::GetHostAndPort(request_->url())); | 88 net::GetHostAndPort(request_->url())); |
| 89 auth_info->scheme = L""; | 89 auth_info->scheme = L""; |
| 90 auth_info->realm = L""; | 90 auth_info->realm = L""; |
| 91 result->swap(auth_info); | 91 result->swap(auth_info); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void URLRequestFtpJob::SetAuth(const string16& username, | 94 void URLRequestFtpJob::SetAuth(const string16& username, |
| 95 const string16& password) { | 95 const string16& password) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // URLRequest delegate via the message loop. | 236 // URLRequest delegate via the message loop. |
| 237 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 237 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 238 this, &URLRequestFtpJob::OnStartCompleted, rv)); | 238 this, &URLRequestFtpJob::OnStartCompleted, rv)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void URLRequestFtpJob::DestroyTransaction() { | 241 void URLRequestFtpJob::DestroyTransaction() { |
| 242 DCHECK(transaction_.get()); | 242 DCHECK(transaction_.get()); |
| 243 | 243 |
| 244 transaction_.reset(); | 244 transaction_.reset(); |
| 245 } | 245 } |
| OLD | NEW |