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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 ":version", "HTTP/1.1", | 363 ":version", "HTTP/1.1", |
364 "proxy-authorization", "Basic Zm9vOmJhcg==", | 364 "proxy-authorization", "Basic Zm9vOmJhcg==", |
365 }; | 365 }; |
366 return ConstructSpdyPacket( | 366 return ConstructSpdyPacket( |
367 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); | 367 kSynStartHeader, NULL, 0, kConnectHeaders, arraysize(kConnectHeaders)/2); |
368 } | 368 } |
369 | 369 |
370 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. | 370 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. |
371 SpdyFrame* SpdyProxyClientSocketSpdy3Test::ConstructConnectReplyFrame() { | 371 SpdyFrame* SpdyProxyClientSocketSpdy3Test::ConstructConnectReplyFrame() { |
372 const char* const kStandardReplyHeaders[] = { | 372 const char* const kStandardReplyHeaders[] = { |
373 "status", "200 Connection Established", | 373 ":status", "200 Connection Established", |
374 "version", "HTTP/1.1" | 374 ":version", "HTTP/1.1" |
375 }; | 375 }; |
376 return ConstructSpdyControlFrame(NULL, | 376 return ConstructSpdyControlFrame(NULL, |
377 0, | 377 0, |
378 false, | 378 false, |
379 kStreamId, | 379 kStreamId, |
380 LOWEST, | 380 LOWEST, |
381 SYN_REPLY, | 381 SYN_REPLY, |
382 CONTROL_FLAG_NONE, | 382 CONTROL_FLAG_NONE, |
383 kStandardReplyHeaders, | 383 kStandardReplyHeaders, |
384 arraysize(kStandardReplyHeaders)); | 384 arraysize(kStandardReplyHeaders)); |
385 } | 385 } |
386 | 386 |
387 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. | 387 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT. |
388 SpdyFrame* | 388 SpdyFrame* |
389 SpdyProxyClientSocketSpdy3Test::ConstructConnectAuthReplyFrame() { | 389 SpdyProxyClientSocketSpdy3Test::ConstructConnectAuthReplyFrame() { |
390 const char* const kStandardReplyHeaders[] = { | 390 const char* const kStandardReplyHeaders[] = { |
391 "status", "407 Proxy Authentication Required", | 391 ":status", "407 Proxy Authentication Required", |
392 "version", "HTTP/1.1", | 392 ":version", "HTTP/1.1", |
393 "proxy-authenticate", "Basic realm=\"MyRealm1\"", | 393 "proxy-authenticate", "Basic realm=\"MyRealm1\"", |
394 }; | 394 }; |
395 | 395 |
396 return ConstructSpdyControlFrame(NULL, | 396 return ConstructSpdyControlFrame(NULL, |
397 0, | 397 0, |
398 false, | 398 false, |
399 kStreamId, | 399 kStreamId, |
400 LOWEST, | 400 LOWEST, |
401 SYN_REPLY, | 401 SYN_REPLY, |
402 CONTROL_FLAG_NONE, | 402 CONTROL_FLAG_NONE, |
403 kStandardReplyHeaders, | 403 kStandardReplyHeaders, |
404 arraysize(kStandardReplyHeaders)); | 404 arraysize(kStandardReplyHeaders)); |
405 } | 405 } |
406 | 406 |
407 // Constructs a SPDY SYN_REPLY frame with an HTTP 500 error. | 407 // Constructs a SPDY SYN_REPLY frame with an HTTP 500 error. |
408 SpdyFrame* | 408 SpdyFrame* |
409 SpdyProxyClientSocketSpdy3Test::ConstructConnectErrorReplyFrame() { | 409 SpdyProxyClientSocketSpdy3Test::ConstructConnectErrorReplyFrame() { |
410 const char* const kStandardReplyHeaders[] = { | 410 const char* const kStandardReplyHeaders[] = { |
411 "status", "500 Internal Server Error", | 411 ":status", "500 Internal Server Error", |
412 "version", "HTTP/1.1", | 412 ":version", "HTTP/1.1", |
413 }; | 413 }; |
414 | 414 |
415 return ConstructSpdyControlFrame(NULL, | 415 return ConstructSpdyControlFrame(NULL, |
416 0, | 416 0, |
417 false, | 417 false, |
418 kStreamId, | 418 kStreamId, |
419 LOWEST, | 419 LOWEST, |
420 SYN_REPLY, | 420 SYN_REPLY, |
421 CONTROL_FLAG_NONE, | 421 CONTROL_FLAG_NONE, |
422 kStandardReplyHeaders, | 422 kStandardReplyHeaders, |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 write_callback_.callback())); | 1309 write_callback_.callback())); |
1310 | 1310 |
1311 Run(2); | 1311 Run(2); |
1312 | 1312 |
1313 EXPECT_FALSE(sock_.get()); | 1313 EXPECT_FALSE(sock_.get()); |
1314 EXPECT_TRUE(read_callback.have_result()); | 1314 EXPECT_TRUE(read_callback.have_result()); |
1315 EXPECT_FALSE(write_callback_.have_result()); | 1315 EXPECT_FALSE(write_callback_.have_result()); |
1316 } | 1316 } |
1317 | 1317 |
1318 } // namespace net | 1318 } // namespace net |
OLD | NEW |