Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: net/url_request/url_request_ftp_job.cc

Issue 13609002: fix a problem that android cannot download files with basic authentication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (!ftp_transaction_) 314 if (!ftp_transaction_)
315 return false; 315 return false;
316 316
317 // Note that we only have to worry about cases where an actual FTP server 317 // Note that we only have to worry about cases where an actual FTP server
318 // requires auth (and not a proxy), because connecting to FTP via proxy 318 // requires auth (and not a proxy), because connecting to FTP via proxy
319 // effectively means the browser communicates via HTTP, and uses HTTP's 319 // effectively means the browser communicates via HTTP, and uses HTTP's
320 // Proxy-Authenticate protocol when proxy servers require auth. 320 // Proxy-Authenticate protocol when proxy servers require auth.
321 return server_auth_ && server_auth_->state == AUTH_STATE_NEED_AUTH; 321 return server_auth_ && server_auth_->state == AUTH_STATE_NEED_AUTH;
322 } 322 }
323 323
324 bool URLRequestFtpJob::HasAuth() const {
325 return server_auth_ && server_auth_->state == AUTH_STATE_HAVE_AUTH;
326 }
327
324 void URLRequestFtpJob::GetAuthChallengeInfo( 328 void URLRequestFtpJob::GetAuthChallengeInfo(
325 scoped_refptr<AuthChallengeInfo>* result) { 329 scoped_refptr<AuthChallengeInfo>* result) {
326 DCHECK((server_auth_ != NULL) && 330 DCHECK((server_auth_ != NULL) &&
327 (server_auth_->state == AUTH_STATE_NEED_AUTH)); 331 (server_auth_->state == AUTH_STATE_NEED_AUTH));
328 scoped_refptr<AuthChallengeInfo> auth_info(new AuthChallengeInfo); 332 scoped_refptr<AuthChallengeInfo> auth_info(new AuthChallengeInfo);
329 auth_info->is_proxy = false; 333 auth_info->is_proxy = false;
330 auth_info->challenger = HostPortPair::FromURL(request_->url()); 334 auth_info->challenger = HostPortPair::FromURL(request_->url());
331 // scheme and realm are kept empty. 335 // scheme and realm are kept empty.
332 DCHECK(auth_info->scheme.empty()); 336 DCHECK(auth_info->scheme.empty());
333 DCHECK(auth_info->realm.empty()); 337 DCHECK(auth_info->realm.empty());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (rv == ERR_IO_PENDING) { 390 if (rv == ERR_IO_PENDING) {
387 read_in_progress_ = true; 391 read_in_progress_ = true;
388 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); 392 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
389 } else { 393 } else {
390 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 394 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
391 } 395 }
392 return false; 396 return false;
393 } 397 }
394 398
395 } // namespace net 399 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698