OLD | NEW |
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 <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 4921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4932 ConstructSpdyConnect(kAuthCredentials, arraysize(kAuthCredentials)/2, 3)); | 4932 ConstructSpdyConnect(kAuthCredentials, arraysize(kAuthCredentials)/2, 3)); |
4933 // fetch https://www.google.com/ via HTTP | 4933 // fetch https://www.google.com/ via HTTP |
4934 const char get[] = "GET / HTTP/1.1\r\n" | 4934 const char get[] = "GET / HTTP/1.1\r\n" |
4935 "Host: www.google.com\r\n" | 4935 "Host: www.google.com\r\n" |
4936 "Connection: keep-alive\r\n\r\n"; | 4936 "Connection: keep-alive\r\n\r\n"; |
4937 scoped_ptr<SpdyFrame> wrapped_get( | 4937 scoped_ptr<SpdyFrame> wrapped_get( |
4938 ConstructSpdyBodyFrame(3, get, strlen(get), false)); | 4938 ConstructSpdyBodyFrame(3, get, strlen(get), false)); |
4939 | 4939 |
4940 MockWrite spdy_writes[] = { | 4940 MockWrite spdy_writes[] = { |
4941 CreateMockWrite(*req, 1, ASYNC), | 4941 CreateMockWrite(*req, 1, ASYNC), |
4942 CreateMockWrite(*connect2, 4), | 4942 CreateMockWrite(*rst, 4, ASYNC), |
4943 CreateMockWrite(*rst, 5, ASYNC), | 4943 CreateMockWrite(*connect2, 5), |
4944 CreateMockWrite(*wrapped_get, 8) | 4944 CreateMockWrite(*wrapped_get, 8) |
4945 }; | 4945 }; |
4946 | 4946 |
4947 // The proxy responds to the connect with a 407, using a persistent | 4947 // The proxy responds to the connect with a 407, using a persistent |
4948 // connection. | 4948 // connection. |
4949 const char* const kAuthChallenge[] = { | 4949 const char* const kAuthChallenge[] = { |
4950 ":status", "407 Proxy Authentication Required", | 4950 ":status", "407 Proxy Authentication Required", |
4951 ":version", "HTTP/1.1", | 4951 ":version", "HTTP/1.1", |
4952 "proxy-authenticate", "Basic realm=\"MyRealm1\"", | 4952 "proxy-authenticate", "Basic realm=\"MyRealm1\"", |
4953 }; | 4953 }; |
(...skipping 5196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10150 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10150 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
10151 MessageLoop::current()->RunAllPending(); | 10151 MessageLoop::current()->RunAllPending(); |
10152 data2->RunFor(3); | 10152 data2->RunFor(3); |
10153 | 10153 |
10154 ASSERT_TRUE(callback2.have_result()); | 10154 ASSERT_TRUE(callback2.have_result()); |
10155 EXPECT_EQ(OK, callback2.WaitForResult()); | 10155 EXPECT_EQ(OK, callback2.WaitForResult()); |
10156 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10156 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
10157 } | 10157 } |
10158 | 10158 |
10159 } // namespace net | 10159 } // namespace net |
OLD | NEW |