OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/build_time.h" | 10 #include "base/build_time.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 StatisticSelector statistic) const { | 160 StatisticSelector statistic) const { |
161 job_->RecordPacketStats(statistic); | 161 job_->RecordPacketStats(statistic); |
162 } | 162 } |
163 | 163 |
164 // TODO(darin): make sure the port blocking code is not lost | 164 // TODO(darin): make sure the port blocking code is not lost |
165 // static | 165 // static |
166 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, | 166 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, |
167 const std::string& scheme) { | 167 const std::string& scheme) { |
168 DCHECK(scheme == "http" || scheme == "https"); | 168 DCHECK(scheme == "http" || scheme == "https"); |
169 | 169 |
170 int port = request->url().IntPort(); | |
171 if (!IsPortAllowedByDefault(port) && !IsPortAllowedByOverride(port)) | |
172 return new URLRequestErrorJob(request, ERR_UNSAFE_PORT); | |
173 | |
174 if (!request->context() || | 170 if (!request->context() || |
175 !request->context()->http_transaction_factory()) { | 171 !request->context()->http_transaction_factory()) { |
176 NOTREACHED() << "requires a valid context"; | 172 NOTREACHED() << "requires a valid context"; |
177 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); | 173 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); |
178 } | 174 } |
179 | 175 |
180 TransportSecurityState::DomainState domain_state; | 176 TransportSecurityState::DomainState domain_state; |
181 if (scheme == "http" && | 177 if (scheme == "http" && |
182 request->context()->transport_security_state() && | 178 request->context()->transport_security_state() && |
183 request->context()->transport_security_state()->GetDomainState( | 179 request->context()->transport_security_state()->GetDomainState( |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 return override_response_headers_.get() ? | 1436 return override_response_headers_.get() ? |
1441 override_response_headers_ : | 1437 override_response_headers_ : |
1442 transaction_->GetResponseInfo()->headers; | 1438 transaction_->GetResponseInfo()->headers; |
1443 } | 1439 } |
1444 | 1440 |
1445 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1441 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1446 awaiting_callback_ = false; | 1442 awaiting_callback_ = false; |
1447 } | 1443 } |
1448 | 1444 |
1449 } // namespace net | 1445 } // namespace net |
OLD | NEW |