| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(4096)); | 396 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(4096)); |
| 397 rv = sock->Read(buf, 4096, &callback); | 397 rv = sock->Read(buf, 4096, &callback); |
| 398 // We haven't written the request, so there should be no response yet. | 398 // We haven't written the request, so there should be no response yet. |
| 399 ASSERT_EQ(net::ERR_IO_PENDING, rv); | 399 ASSERT_EQ(net::ERR_IO_PENDING, rv); |
| 400 | 400 |
| 401 // Write the request. | 401 // Write the request. |
| 402 // The request is padded with a User-Agent header to a size that causes the | 402 // The request is padded with a User-Agent header to a size that causes the |
| 403 // memio circular buffer (4k bytes) in SSLClientSocketNSS to wrap around. | 403 // memio circular buffer (4k bytes) in SSLClientSocketNSS to wrap around. |
| 404 // This tests the fix for http://crbug.com/29815. | 404 // This tests the fix for http://crbug.com/29815. |
| 405 std::string request_text = "GET / HTTP/1.1\r\nUser-Agent: long browser name "; | 405 std::string request_text = "GET / HTTP/1.1\r\nUser-Agent: long browser name "; |
| 406 for (int i = 0; i < 3770; ++i) | 406 for (int i = 0; i < 3800; ++i) |
| 407 request_text.push_back('*'); | 407 request_text.push_back('*'); |
| 408 request_text.append("\r\n\r\n"); | 408 request_text.append("\r\n\r\n"); |
| 409 scoped_refptr<net::IOBuffer> request_buffer( | 409 scoped_refptr<net::IOBuffer> request_buffer( |
| 410 new net::StringIOBuffer(request_text)); | 410 new net::StringIOBuffer(request_text)); |
| 411 | 411 |
| 412 rv = sock->Write(request_buffer, request_text.size(), &callback2); | 412 rv = sock->Write(request_buffer, request_text.size(), &callback2); |
| 413 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); | 413 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); |
| 414 | 414 |
| 415 if (rv == net::ERR_IO_PENDING) | 415 if (rv == net::ERR_IO_PENDING) |
| 416 rv = callback2.WaitForResult(); | 416 rv = callback2.WaitForResult(); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 socket_factory_->CreateSSLClientSocket( | 735 socket_factory_->CreateSSLClientSocket( |
| 736 socket_handle, test_server.host_port_pair(), kDefaultSSLConfig, | 736 socket_handle, test_server.host_port_pair(), kDefaultSSLConfig, |
| 737 NULL, context)); | 737 NULL, context)); |
| 738 | 738 |
| 739 EXPECT_FALSE(ssl_socket->IsConnected()); | 739 EXPECT_FALSE(ssl_socket->IsConnected()); |
| 740 rv = ssl_socket->Connect(&callback); | 740 rv = ssl_socket->Connect(&callback); |
| 741 if (rv == net::ERR_IO_PENDING) | 741 if (rv == net::ERR_IO_PENDING) |
| 742 rv = callback.WaitForResult(); | 742 rv = callback.WaitForResult(); |
| 743 EXPECT_EQ(net::OK, rv); | 743 EXPECT_EQ(net::OK, rv); |
| 744 } | 744 } |
| OLD | NEW |