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

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

Issue 1965833002: Remove the implicit add of Vary: Cookie on redirected requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Gavin's comment Created 4 years, 7 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
« no previous file with comments | « net/http/http_vary_data.cc ('k') | no next file » | 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "net/http/http_request_info.h" 7 #include "net/http/http_request_info.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 #include "net/http/http_vary_data.h" 9 #include "net/http/http_vary_data.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 TestTransaction b; 114 TestTransaction b;
115 b.Init("Foo: 1\r\nbaR: 2", "HTTP/1.1 200 OK\nVary: foo\nVary: bar\n\n"); 115 b.Init("Foo: 1\r\nbaR: 2", "HTTP/1.1 200 OK\nVary: foo\nVary: bar\n\n");
116 116
117 HttpVaryData v; 117 HttpVaryData v;
118 EXPECT_TRUE(v.Init(a.request, *a.response.get())); 118 EXPECT_TRUE(v.Init(a.request, *a.response.get()));
119 119
120 EXPECT_TRUE(v.MatchesRequest(b.request, *b.response.get())); 120 EXPECT_TRUE(v.MatchesRequest(b.request, *b.response.get()));
121 } 121 }
122 122
123 TEST(HttpVaryDataTest, ImplicitCookieForRedirect) { 123 TEST(HttpVaryDataTest, DoesntVaryByCookieForRedirect) {
124 TestTransaction a; 124 TestTransaction a;
125 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\n\n"); 125 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\n\n");
126 126
127 TestTransaction b;
128 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\n\n");
129
130 HttpVaryData v; 127 HttpVaryData v;
131 EXPECT_TRUE(v.Init(a.request, *a.response.get())); 128 EXPECT_FALSE(v.Init(a.request, *a.response.get()));
132
133 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
134 }
135
136 TEST(HttpVaryDataTest, ImplicitCookieForRedirect2) {
137 // This should be no different than the test above
138
139 TestTransaction a;
140 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\nVary: coOkie\n\n");
141
142 TestTransaction b;
143 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n");
144
145 HttpVaryData v;
146 EXPECT_TRUE(v.Init(a.request, *a.response.get()));
147
148 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
149 } 129 }
150 130
151 } // namespace net 131 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_vary_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698