Update V8 to version 4.6.55.
[chromium-blink-merge.git] / net / url_request / ftp_protocol_handler.cc
blob4c10124ceed561394fb91791304affe231f7b684
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
3 // found in the LICENSE file.
5 #include "net/url_request/ftp_protocol_handler.h"
7 #include "base/logging.h"
8 #include "net/base/net_errors.h"
9 #include "net/base/port_util.h"
10 #include "net/ftp/ftp_auth_cache.h"
11 #include "net/url_request/url_request.h"
12 #include "net/url_request/url_request_error_job.h"
13 #include "net/url_request/url_request_ftp_job.h"
14 #include "url/gurl.h"
16 namespace net {
18 FtpProtocolHandler::FtpProtocolHandler(
19 FtpTransactionFactory* ftp_transaction_factory)
20 : ftp_transaction_factory_(ftp_transaction_factory),
21 ftp_auth_cache_(new FtpAuthCache) {
22 DCHECK(ftp_transaction_factory_);
25 FtpProtocolHandler::~FtpProtocolHandler() {
28 URLRequestJob* FtpProtocolHandler::MaybeCreateJob(
29 URLRequest* request, NetworkDelegate* network_delegate) const {
30 DCHECK_EQ("ftp", request->url().scheme());
32 if (!IsPortAllowedForScheme(request->url().EffectiveIntPort(),
33 request->url().scheme())) {
34 return new URLRequestErrorJob(request, network_delegate, ERR_UNSAFE_PORT);
37 return new URLRequestFtpJob(request,
38 network_delegate,
39 ftp_transaction_factory_,
40 ftp_auth_cache_.get());
43 } // namespace net