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/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
6 | 6 |
7 #include "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
8 #include "net/base/cert_verifier.h" | 8 #include "net/base/cert_verifier.h" |
9 #include "net/base/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(4096)); | 395 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(4096)); |
396 rv = sock->Read(buf, 4096, &callback); | 396 rv = sock->Read(buf, 4096, &callback); |
397 // We haven't written the request, so there should be no response yet. | 397 // We haven't written the request, so there should be no response yet. |
398 ASSERT_EQ(net::ERR_IO_PENDING, rv); | 398 ASSERT_EQ(net::ERR_IO_PENDING, rv); |
399 | 399 |
400 // Write the request. | 400 // Write the request. |
401 // The request is padded with a User-Agent header to a size that causes the | 401 // The request is padded with a User-Agent header to a size that causes the |
402 // memio circular buffer (4k bytes) in SSLClientSocketNSS to wrap around. | 402 // memio circular buffer (4k bytes) in SSLClientSocketNSS to wrap around. |
403 // This tests the fix for http://crbug.com/29815. | 403 // This tests the fix for http://crbug.com/29815. |
404 std::string request_text = "GET / HTTP/1.1\r\nUser-Agent: long browser name "; | 404 std::string request_text = "GET / HTTP/1.1\r\nUser-Agent: long browser name "; |
405 for (int i = 0; i < 3800; ++i) | 405 for (int i = 0; i < 3770; ++i) |
406 request_text.push_back('*'); | 406 request_text.push_back('*'); |
407 request_text.append("\r\n\r\n"); | 407 request_text.append("\r\n\r\n"); |
408 scoped_refptr<net::IOBuffer> request_buffer( | 408 scoped_refptr<net::IOBuffer> request_buffer( |
409 new net::StringIOBuffer(request_text)); | 409 new net::StringIOBuffer(request_text)); |
410 | 410 |
411 rv = sock->Write(request_buffer, request_text.size(), &callback2); | 411 rv = sock->Write(request_buffer, request_text.size(), &callback2); |
412 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); | 412 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); |
413 | 413 |
414 if (rv == net::ERR_IO_PENDING) | 414 if (rv == net::ERR_IO_PENDING) |
415 rv = callback2.WaitForResult(); | 415 rv = callback2.WaitForResult(); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // to being an error such as a certificate name mismatch, which is | 698 // to being an error such as a certificate name mismatch, which is |
699 // client-only, the exact index of the SSL connect end depends on how | 699 // client-only, the exact index of the SSL connect end depends on how |
700 // quickly the test server closes the underlying socket. If the test server | 700 // quickly the test server closes the underlying socket. If the test server |
701 // closes before the IO message loop pumps messages, there may be a 0-byte | 701 // closes before the IO message loop pumps messages, there may be a 0-byte |
702 // Read event in the NetLog due to TCPClientSocket picking up the EOF. As a | 702 // Read event in the NetLog due to TCPClientSocket picking up the EOF. As a |
703 // result, the SSL connect end event will be the second-to-last entry, | 703 // result, the SSL connect end event will be the second-to-last entry, |
704 // rather than the last entry. | 704 // rather than the last entry. |
705 EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1) || | 705 EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1) || |
706 LogContainsSSLConnectEndEvent(entries, -2)); | 706 LogContainsSSLConnectEndEvent(entries, -2)); |
707 } | 707 } |
OLD | NEW |