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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 4206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4217 new HttpNetworkTransaction(CreateSession(&session_deps))); | 4217 new HttpNetworkTransaction(CreateSession(&session_deps))); |
4218 | 4218 |
4219 // Setup some state (which we expect ResetStateForRestart() will clear). | 4219 // Setup some state (which we expect ResetStateForRestart() will clear). |
4220 trans->read_buf_ = new IOBuffer(15); | 4220 trans->read_buf_ = new IOBuffer(15); |
4221 trans->read_buf_len_ = 15; | 4221 trans->read_buf_len_ = 15; |
4222 trans->request_headers_.SetHeader("Authorization", "NTLM"); | 4222 trans->request_headers_.SetHeader("Authorization", "NTLM"); |
4223 | 4223 |
4224 // Setup state in response_ | 4224 // Setup state in response_ |
4225 HttpResponseInfo* response = &trans->response_; | 4225 HttpResponseInfo* response = &trans->response_; |
4226 response->auth_challenge = new AuthChallengeInfo(); | 4226 response->auth_challenge = new AuthChallengeInfo(); |
4227 response->ssl_info.cert_status = -15; | 4227 response->ssl_info.cert_status = static_cast<CertStatus>(-1); // Nonsensical. |
4228 response->response_time = base::Time::Now(); | 4228 response->response_time = base::Time::Now(); |
4229 response->was_cached = true; // (Wouldn't ever actually be true...) | 4229 response->was_cached = true; // (Wouldn't ever actually be true...) |
4230 | 4230 |
4231 { // Setup state for response_.vary_data | 4231 { // Setup state for response_.vary_data |
4232 HttpRequestInfo request; | 4232 HttpRequestInfo request; |
4233 std::string temp("HTTP/1.1 200 OK\nVary: foo, bar\n\n"); | 4233 std::string temp("HTTP/1.1 200 OK\nVary: foo, bar\n\n"); |
4234 std::replace(temp.begin(), temp.end(), '\n', '\0'); | 4234 std::replace(temp.begin(), temp.end(), '\n', '\0'); |
4235 scoped_refptr<HttpResponseHeaders> headers(new HttpResponseHeaders(temp)); | 4235 scoped_refptr<HttpResponseHeaders> headers(new HttpResponseHeaders(temp)); |
4236 request.extra_headers.SetHeader("Foo", "1"); | 4236 request.extra_headers.SetHeader("Foo", "1"); |
4237 request.extra_headers.SetHeader("bar", "23"); | 4237 request.extra_headers.SetHeader("bar", "23"); |
(...skipping 4657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8895 EXPECT_TRUE(response->was_fetched_via_spdy); | 8895 EXPECT_TRUE(response->was_fetched_via_spdy); |
8896 EXPECT_TRUE(response->was_npn_negotiated); | 8896 EXPECT_TRUE(response->was_npn_negotiated); |
8897 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 8897 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
8898 EXPECT_EQ("hello!", response_data); | 8898 EXPECT_EQ("hello!", response_data); |
8899 | 8899 |
8900 HttpStreamFactory::set_next_protos(""); | 8900 HttpStreamFactory::set_next_protos(""); |
8901 HttpStreamFactory::set_use_alternate_protocols(false); | 8901 HttpStreamFactory::set_use_alternate_protocols(false); |
8902 } | 8902 } |
8903 | 8903 |
8904 } // namespace net | 8904 } // namespace net |
OLD | NEW |