| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 0, | 331 0, |
| 332 DATA_FLAG_NONE | 332 DATA_FLAG_NONE |
| 333 }; | 333 }; |
| 334 const char* const kConnectHeaders[] = { | 334 const char* const kConnectHeaders[] = { |
| 335 ":method", "CONNECT", | 335 ":method", "CONNECT", |
| 336 ":path", kOriginHostPort, | 336 ":path", kOriginHostPort, |
| 337 ":host", kOriginHost, | 337 ":host", kOriginHost, |
| 338 "user-agent", kUserAgent, | 338 "user-agent", kUserAgent, |
| 339 ":version", "HTTP/1.1", | 339 ":version", "HTTP/1.1", |
| 340 }; | 340 }; |
| 341 return ConstructSpdyPacket( | 341 return ConstructSpdyFrame( |
| 342 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); | 342 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); |
| 343 } | 343 } |
| 344 | 344 |
| 345 // Constructs a SPDY SYN_STREAM frame for a CONNECT request which includes | 345 // Constructs a SPDY SYN_STREAM frame for a CONNECT request which includes |
| 346 // Proxy-Authorization headers. | 346 // Proxy-Authorization headers. |
| 347 SpdyFrame* | 347 SpdyFrame* |
| 348 SpdyProxyClientSocketSpdy3Test::ConstructConnectAuthRequestFrame() { | 348 SpdyProxyClientSocketSpdy3Test::ConstructConnectAuthRequestFrame() { |
| 349 const SpdyHeaderInfo kSynStartHeader = { | 349 const SpdyHeaderInfo kSynStartHeader = { |
| 350 SYN_STREAM, | 350 SYN_STREAM, |
| 351 kStreamId, | 351 kStreamId, |
| 352 0, | 352 0, |
| 353 net::ConvertRequestPriorityToSpdyPriority(LOWEST, 3), | 353 net::ConvertRequestPriorityToSpdyPriority(LOWEST, 3), |
| 354 0, | 354 0, |
| 355 CONTROL_FLAG_NONE, | 355 CONTROL_FLAG_NONE, |
| 356 false, | 356 false, |
| 357 RST_STREAM_INVALID, | 357 RST_STREAM_INVALID, |
| 358 NULL, | 358 NULL, |
| 359 0, | 359 0, |
| 360 DATA_FLAG_NONE | 360 DATA_FLAG_NONE |
| 361 }; | 361 }; |
| 362 const char* const kConnectHeaders[] = { | 362 const char* const kConnectHeaders[] = { |
| 363 ":method", "CONNECT", | 363 ":method", "CONNECT", |
| 364 ":path", kOriginHostPort, | 364 ":path", kOriginHostPort, |
| 365 ":host", kOriginHost, | 365 ":host", kOriginHost, |
| 366 "user-agent", kUserAgent, | 366 "user-agent", kUserAgent, |
| 367 ":version", "HTTP/1.1", | 367 ":version", "HTTP/1.1", |
| 368 "proxy-authorization", "Basic Zm9vOmJhcg==", | 368 "proxy-authorization", "Basic Zm9vOmJhcg==", |
| 369 }; | 369 }; |
| 370 return ConstructSpdyPacket( | 370 return ConstructSpdyFrame( |
| 371 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); | 371 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); |
| 372 } | 372 } |
| 373 | 373 |
| 374 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. | 374 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. |
| 375 SpdyFrame* SpdyProxyClientSocketSpdy3Test::ConstructConnectReplyFrame() { | 375 SpdyFrame* SpdyProxyClientSocketSpdy3Test::ConstructConnectReplyFrame() { |
| 376 const char* const kStandardReplyHeaders[] = { | 376 const char* const kStandardReplyHeaders[] = { |
| 377 ":status", "200 Connection Established", | 377 ":status", "200 Connection Established", |
| 378 ":version", "HTTP/1.1" | 378 ":version", "HTTP/1.1" |
| 379 }; | 379 }; |
| 380 return ConstructSpdyControlFrame(NULL, | 380 return ConstructSpdyControlFrame(NULL, |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 write_callback_.callback())); | 1410 write_callback_.callback())); |
| 1411 | 1411 |
| 1412 Run(2); | 1412 Run(2); |
| 1413 | 1413 |
| 1414 EXPECT_FALSE(sock_.get()); | 1414 EXPECT_FALSE(sock_.get()); |
| 1415 EXPECT_TRUE(read_callback.have_result()); | 1415 EXPECT_TRUE(read_callback.have_result()); |
| 1416 EXPECT_FALSE(write_callback_.have_result()); | 1416 EXPECT_FALSE(write_callback_.have_result()); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 } // namespace net | 1419 } // namespace net |
| OLD | NEW |