Index: net/url_request/url_request_http_job.cc |
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc |
index 06214e63d21fcd065d60b8af0bf314c8eb819e3f..a4c156975832734b36c52bc02165d61be281b0e0 100644 |
--- a/net/url_request/url_request_http_job.cc |
+++ b/net/url_request/url_request_http_job.cc |
@@ -172,8 +172,7 @@ URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, |
const std::string& scheme) { |
DCHECK(scheme == "http" || scheme == "https"); |
- if (!request->context() || |
- !request->context()->http_transaction_factory()) { |
+ if (!request->context()->http_transaction_factory()) { |
NOTREACHED() << "requires a valid context"; |
return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); |
} |
@@ -294,7 +293,7 @@ void URLRequestHttpJob::DestroyTransaction() { |
} |
void URLRequestHttpJob::StartTransaction() { |
- if (request_->context() && request_->context()->network_delegate()) { |
+ if (request_->context()->network_delegate()) { |
int rv = request_->context()->network_delegate()->NotifyBeforeSendHeaders( |
request_, notify_before_headers_sent_callback_, |
&request_info_.extra_headers); |
@@ -332,7 +331,7 @@ void URLRequestHttpJob::StartTransactionInternal() { |
int rv; |
- if (request_->context() && request_->context()->network_delegate()) { |
+ if (request_->context()->network_delegate()) { |
request_->context()->network_delegate()->NotifySendHeaders( |
request_, request_info_.extra_headers); |
} |
@@ -341,7 +340,6 @@ void URLRequestHttpJob::StartTransactionInternal() { |
rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); |
auth_credentials_ = AuthCredentials(); |
} else { |
- DCHECK(request_->context()); |
DCHECK(request_->context()->http_transaction_factory()); |
rv = request_->context()->http_transaction_factory()->CreateTransaction( |
@@ -435,19 +433,17 @@ void URLRequestHttpJob::AddExtraHeaders() { |
} |
const URLRequestContext* context = request_->context(); |
- if (context) { |
- // Only add default Accept-Language and Accept-Charset if the request |
- // didn't have them specified. |
- if (!context->accept_language().empty()) { |
- request_info_.extra_headers.SetHeaderIfMissing( |
- HttpRequestHeaders::kAcceptLanguage, |
- context->accept_language()); |
- } |
- if (!context->accept_charset().empty()) { |
- request_info_.extra_headers.SetHeaderIfMissing( |
- HttpRequestHeaders::kAcceptCharset, |
- context->accept_charset()); |
- } |
+ // Only add default Accept-Language and Accept-Charset if the request |
+ // didn't have them specified. |
+ if (!context->accept_language().empty()) { |
+ request_info_.extra_headers.SetHeaderIfMissing( |
+ HttpRequestHeaders::kAcceptLanguage, |
+ context->accept_language()); |
+ } |
+ if (!context->accept_charset().empty()) { |
+ request_info_.extra_headers.SetHeaderIfMissing( |
+ HttpRequestHeaders::kAcceptCharset, |
+ context->accept_charset()); |
} |
} |
@@ -460,8 +456,7 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() { |
if (!request_) |
return; |
- CookieStore* cookie_store = |
- request_->context()->cookie_store(); |
+ CookieStore* cookie_store = request_->context()->cookie_store(); |
if (cookie_store && !(request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES)) { |
net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster(); |
if (cookie_monster) { |
@@ -650,7 +645,7 @@ void URLRequestHttpJob::ProcessStrictTransportSecurityHeader() { |
// Only accept strict transport security headers on HTTPS connections that |
// have no certificate errors. |
if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status) || |
- !ctx || !ctx->transport_security_state()) { |
+ !ctx->transport_security_state()) { |
return; |
} |
@@ -687,7 +682,7 @@ void URLRequestHttpJob::ProcessPublicKeyPinsHeader() { |
// Only accept public key pins headers on HTTPS connections that have no |
// certificate errors. |
if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status) || |
- !ctx || !ctx->transport_security_state()) { |
+ !ctx->transport_security_state()) { |
return; |
} |
@@ -750,7 +745,7 @@ void URLRequestHttpJob::OnStartCompleted(int result) { |
if (result == OK) { |
scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); |
- if (context && context->network_delegate()) { |
+ if (context->network_delegate()) { |
// Note that |this| may not be deleted until |
// |on_headers_received_callback_| or |
// |NetworkDelegate::URLRequestDestroyed()| has been called. |
@@ -876,11 +871,9 @@ void URLRequestHttpJob::Start() { |
referrer.spec()); |
} |
- if (request_->context()) { |
- request_info_.extra_headers.SetHeaderIfMissing( |
- HttpRequestHeaders::kUserAgent, |
- request_->context()->GetUserAgent(request_->url())); |
- } |
+ request_info_.extra_headers.SetHeaderIfMissing( |
+ HttpRequestHeaders::kUserAgent, |
+ request_->context()->GetUserAgent(request_->url())); |
AddExtraHeaders(); |
AddCookieHeaderAndStart(); |