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

Side by Side Diff: net/http/http_network_transaction.cc

Issue 1378613004: Set Token-Binding HTTP header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tb-tls-ext-new
Patch Set: rebase Created 5 years, 2 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
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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } else if (request_->method == "POST" || request_->method == "PUT") { 920 } else if (request_->method == "POST" || request_->method == "PUT") {
921 // An empty POST/PUT request still needs a content length. As for HEAD, 921 // An empty POST/PUT request still needs a content length. As for HEAD,
922 // IE and Safari also add a content length header. Presumably it is to 922 // IE and Safari also add a content length header. Presumably it is to
923 // support sending a HEAD request to an URL that only expects to be sent a 923 // support sending a HEAD request to an URL that only expects to be sent a
924 // POST or some other method that normally would have a message body. 924 // POST or some other method that normally would have a message body.
925 // Firefox (40.0) does not send the header, and RFC 7230 & 7231 925 // Firefox (40.0) does not send the header, and RFC 7230 & 7231
926 // specify that it should not be sent due to undefined behavior. 926 // specify that it should not be sent due to undefined behavior.
927 request_headers_.SetHeader(HttpRequestHeaders::kContentLength, "0"); 927 request_headers_.SetHeader(HttpRequestHeaders::kContentLength, "0");
928 } 928 }
929 929
930 // Add Token binding header, if needed.
931 std::string token_binding_header;
932 if (stream_->GetTokenBindingMessageHeader(&token_binding_header) == OK &&
933 token_binding_header != "") {
934 request_headers_.SetHeader(HttpRequestHeaders::kSecTokenBinding,
935 token_binding_header);
936 }
937
930 // Honor load flags that impact proxy caches. 938 // Honor load flags that impact proxy caches.
931 if (request_->load_flags & LOAD_BYPASS_CACHE) { 939 if (request_->load_flags & LOAD_BYPASS_CACHE) {
932 request_headers_.SetHeader(HttpRequestHeaders::kPragma, "no-cache"); 940 request_headers_.SetHeader(HttpRequestHeaders::kPragma, "no-cache");
933 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "no-cache"); 941 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "no-cache");
934 } else if (request_->load_flags & LOAD_VALIDATE_CACHE) { 942 } else if (request_->load_flags & LOAD_VALIDATE_CACHE) {
935 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "max-age=0"); 943 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "max-age=0");
936 } 944 }
937 945
938 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY)) 946 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY))
939 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader( 947 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader(
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 DCHECK(stream_request_); 1680 DCHECK(stream_request_);
1673 1681
1674 // Since the transaction can restart with auth credentials, it may create a 1682 // Since the transaction can restart with auth credentials, it may create a
1675 // stream more than once. Accumulate all of the connection attempts across 1683 // stream more than once. Accumulate all of the connection attempts across
1676 // those streams by appending them to the vector: 1684 // those streams by appending them to the vector:
1677 for (const auto& attempt : stream_request_->connection_attempts()) 1685 for (const auto& attempt : stream_request_->connection_attempts())
1678 connection_attempts_.push_back(attempt); 1686 connection_attempts_.push_back(attempt);
1679 } 1687 }
1680 1688
1681 } // namespace net 1689 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698