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