| 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/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 0, | 321 0, |
| 322 net::ConvertRequestPriorityToSpdyPriority(LOWEST), | 322 net::ConvertRequestPriorityToSpdyPriority(LOWEST), |
| 323 spdy::CONTROL_FLAG_NONE, | 323 spdy::CONTROL_FLAG_NONE, |
| 324 false, | 324 false, |
| 325 spdy::INVALID, | 325 spdy::INVALID, |
| 326 NULL, | 326 NULL, |
| 327 0, | 327 0, |
| 328 spdy::DATA_FLAG_NONE | 328 spdy::DATA_FLAG_NONE |
| 329 }; | 329 }; |
| 330 const char* const kConnectHeaders[] = { | 330 const char* const kConnectHeaders[] = { |
| 331 "method", "CONNECT", | 331 ":method", "CONNECT", |
| 332 "url", kOriginHostPort, | 332 ":path", kOriginHostPort, |
| 333 "host", kOriginHost, | 333 ":host", kOriginHost, |
| 334 "user-agent", kUserAgent, | 334 "user-agent", kUserAgent, |
| 335 "version", "HTTP/1.1", | 335 ":version", "HTTP/1.1", |
| 336 }; | 336 }; |
| 337 return ConstructSpdyPacket( | 337 return ConstructSpdyPacket( |
| 338 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); | 338 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); |
| 339 } | 339 } |
| 340 | 340 |
| 341 // Constructs a SPDY SYN_STREAM frame for a CONNECT request which includes | 341 // Constructs a SPDY SYN_STREAM frame for a CONNECT request which includes |
| 342 // Proxy-Authorization headers. | 342 // Proxy-Authorization headers. |
| 343 spdy::SpdyFrame* | 343 spdy::SpdyFrame* |
| 344 SpdyProxyClientSocketSpdy3Test::ConstructConnectAuthRequestFrame() { | 344 SpdyProxyClientSocketSpdy3Test::ConstructConnectAuthRequestFrame() { |
| 345 const SpdyHeaderInfo kSynStartHeader = { | 345 const SpdyHeaderInfo kSynStartHeader = { |
| 346 spdy::SYN_STREAM, | 346 spdy::SYN_STREAM, |
| 347 kStreamId, | 347 kStreamId, |
| 348 0, | 348 0, |
| 349 net::ConvertRequestPriorityToSpdyPriority(LOWEST), | 349 net::ConvertRequestPriorityToSpdyPriority(LOWEST), |
| 350 spdy::CONTROL_FLAG_NONE, | 350 spdy::CONTROL_FLAG_NONE, |
| 351 false, | 351 false, |
| 352 spdy::INVALID, | 352 spdy::INVALID, |
| 353 NULL, | 353 NULL, |
| 354 0, | 354 0, |
| 355 spdy::DATA_FLAG_NONE | 355 spdy::DATA_FLAG_NONE |
| 356 }; | 356 }; |
| 357 const char* const kConnectHeaders[] = { | 357 const char* const kConnectHeaders[] = { |
| 358 "method", "CONNECT", | 358 ":method", "CONNECT", |
| 359 "url", kOriginHostPort, | 359 ":path", kOriginHostPort, |
| 360 "host", kOriginHost, | 360 ":host", kOriginHost, |
| 361 "user-agent", kUserAgent, | 361 "user-agent", kUserAgent, |
| 362 "version", "HTTP/1.1", | 362 ":version", "HTTP/1.1", |
| 363 "proxy-authorization", "Basic Zm9vOmJhcg==", | 363 "proxy-authorization", "Basic Zm9vOmJhcg==", |
| 364 }; | 364 }; |
| 365 return ConstructSpdyPacket( | 365 return ConstructSpdyPacket( |
| 366 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); | 366 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); |
| 367 } | 367 } |
| 368 | 368 |
| 369 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. | 369 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. |
| 370 spdy::SpdyFrame* SpdyProxyClientSocketSpdy3Test::ConstructConnectReplyFrame() { | 370 spdy::SpdyFrame* SpdyProxyClientSocketSpdy3Test::ConstructConnectReplyFrame() { |
| 371 const char* const kStandardReplyHeaders[] = { | 371 const char* const kStandardReplyHeaders[] = { |
| 372 "status", "200 Connection Established", | 372 "status", "200 Connection Established", |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 write_callback_.callback())); | 1308 write_callback_.callback())); |
| 1309 | 1309 |
| 1310 Run(2); | 1310 Run(2); |
| 1311 | 1311 |
| 1312 EXPECT_FALSE(sock_.get()); | 1312 EXPECT_FALSE(sock_.get()); |
| 1313 EXPECT_TRUE(read_callback.have_result()); | 1313 EXPECT_TRUE(read_callback.have_result()); |
| 1314 EXPECT_FALSE(write_callback_.have_result()); | 1314 EXPECT_FALSE(write_callback_.have_result()); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 } // namespace net | 1317 } // namespace net |
| OLD | NEW |