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

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

Issue 42197: Add command line switch "--new-ftp" for new portable... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 years, 9 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
« no previous file with comments | « net/url_request/url_request_context.h ('k') | net/url_request/url_request_new_ftp_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "net/base/auth.h" 13 #include "net/base/auth.h"
14 #include "net/base/escape.h"
14 #include "net/base/load_flags.h" 15 #include "net/base/load_flags.h"
15 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
16 #include "net/base/wininet_util.h" 17 #include "net/base/wininet_util.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
19 #include "net/url_request/url_request_error_job.h" 20 #include "net/url_request/url_request_error_job.h"
20 #include "net/base/escape.h" 21 #include "net/url_request/url_request_new_ftp_job.h"
21 22
22 using std::string; 23 using std::string;
23 24
24 using net::WinInetUtil; 25 using net::WinInetUtil;
25 26
26 // When building the directory listing, the period to wait before notifying 27 // When building the directory listing, the period to wait before notifying
27 // the parent class that we wrote the data. 28 // the parent class that we wrote the data.
28 #define kFtpBufferTimeMs 50 29 #define kFtpBufferTimeMs 50
29 30
30 static bool UnescapeAndValidatePath(const URLRequest* request, 31 static bool UnescapeAndValidatePath(const URLRequest* request,
(...skipping 15 matching lines...) Expand all
46 DCHECK(unescaped_path->find(std::string("\x00", 1)) == std::string::npos) << 47 DCHECK(unescaped_path->find(std::string("\x00", 1)) == std::string::npos) <<
47 "Path should not contain %00."; 48 "Path should not contain %00.";
48 return false; 49 return false;
49 } 50 }
50 return true; 51 return true;
51 } 52 }
52 53
53 // static 54 // static
54 URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request, 55 URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request,
55 const std::string &scheme) { 56 const std::string &scheme) {
57 // Checking whether we are using new or old FTP implementation.
58 if (request->context() && request->context()->ftp_transaction_factory())
59 return URLRequestNewFtpJob::Factory(request, scheme);
60
56 DCHECK(scheme == "ftp"); 61 DCHECK(scheme == "ftp");
57 62
58 if (request->url().has_port() && 63 if (request->url().has_port() &&
59 !net::IsPortAllowedByFtp(request->url().IntPort())) 64 !net::IsPortAllowedByFtp(request->url().IntPort()))
60 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT); 65 return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT);
61 66
62 return new URLRequestFtpJob(request); 67 return new URLRequestFtpJob(request);
63 } 68 }
64 69
65 URLRequestFtpJob::URLRequestFtpJob(URLRequest* request) 70 URLRequestFtpJob::URLRequestFtpJob(URLRequest* request)
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 replacements.SetPathStr(ftp_path); 528 replacements.SetPathStr(ftp_path);
524 529
525 *location = request_->url().ReplaceComponents(replacements); 530 *location = request_->url().ReplaceComponents(replacements);
526 *http_status_code = 301; // simulate a permanent redirect 531 *http_status_code = 301; // simulate a permanent redirect
527 return true; 532 return true;
528 } 533 }
529 } 534 }
530 535
531 return false; 536 return false;
532 } 537 }
OLDNEW
« no previous file with comments | « net/url_request/url_request_context.h ('k') | net/url_request/url_request_new_ftp_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698