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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); | 1673 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); |
1674 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); | 1674 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
1675 session_deps.net_log = log.bound().net_log(); | 1675 session_deps.net_log = log.bound().net_log(); |
1676 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 1676 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
1677 | 1677 |
1678 // Since we have proxy, should try to establish tunnel. | 1678 // Since we have proxy, should try to establish tunnel. |
1679 MockWrite data_writes1[] = { | 1679 MockWrite data_writes1[] = { |
1680 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 1680 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
1681 "Host: www.google.com\r\n" | 1681 "Host: www.google.com\r\n" |
1682 "Proxy-Connection: keep-alive\r\n\r\n"), | 1682 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 1683 }; |
1683 | 1684 |
| 1685 MockWrite data_writes2[] = { |
1684 // After calling trans->RestartWithAuth(), this is the request we should | 1686 // After calling trans->RestartWithAuth(), this is the request we should |
1685 // be issuing -- the final header line contains the credentials. | 1687 // be issuing -- the final header line contains the credentials. |
1686 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 1688 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
1687 "Host: www.google.com\r\n" | 1689 "Host: www.google.com\r\n" |
1688 "Proxy-Connection: keep-alive\r\n" | 1690 "Proxy-Connection: keep-alive\r\n" |
1689 "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), | 1691 "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), |
1690 | 1692 |
1691 MockWrite("GET / HTTP/1.1\r\n" | 1693 MockWrite("GET / HTTP/1.1\r\n" |
1692 "Host: www.google.com\r\n" | 1694 "Host: www.google.com\r\n" |
1693 "Connection: keep-alive\r\n\r\n"), | 1695 "Connection: keep-alive\r\n\r\n"), |
1694 }; | 1696 }; |
1695 | 1697 |
1696 // The proxy responds to the connect with a 407, using a persistent | 1698 // The proxy responds to the connect with a 407, using a persistent |
1697 // connection. | 1699 // connection. |
1698 MockRead data_reads1[] = { | 1700 MockRead data_reads1[] = { |
1699 // No credentials. | 1701 // No credentials. |
1700 MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"), | 1702 MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"), |
1701 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), | 1703 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), |
1702 MockRead("Proxy-Connection: close\r\n\r\n"), | 1704 MockRead("Proxy-Connection: close\r\n\r\n"), |
| 1705 }; |
1703 | 1706 |
| 1707 MockRead data_reads2[] = { |
1704 MockRead("HTTP/1.1 200 Connection Established\r\n\r\n"), | 1708 MockRead("HTTP/1.1 200 Connection Established\r\n\r\n"), |
1705 | 1709 |
1706 MockRead("HTTP/1.1 200 OK\r\n"), | 1710 MockRead("HTTP/1.1 200 OK\r\n"), |
1707 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), | 1711 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), |
1708 MockRead("Content-Length: 5\r\n\r\n"), | 1712 MockRead("Content-Length: 5\r\n\r\n"), |
1709 MockRead(false, "hello"), | 1713 MockRead(false, "hello"), |
1710 }; | 1714 }; |
1711 | 1715 |
1712 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), | 1716 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
1713 data_writes1, arraysize(data_writes1)); | 1717 data_writes1, arraysize(data_writes1)); |
| 1718 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 1719 data_writes2, arraysize(data_writes2)); |
1714 session_deps.socket_factory.AddSocketDataProvider(&data1); | 1720 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1721 session_deps.socket_factory.AddSocketDataProvider(&data2); |
1715 SSLSocketDataProvider ssl(true, OK); | 1722 SSLSocketDataProvider ssl(true, OK); |
1716 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 1723 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
1717 | 1724 |
1718 TestOldCompletionCallback callback1; | 1725 TestOldCompletionCallback callback1; |
1719 | 1726 |
1720 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 1727 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
1721 | 1728 |
1722 int rv = trans->Start(&request, &callback1, log.bound()); | 1729 int rv = trans->Start(&request, &callback1, log.bound()); |
1723 EXPECT_EQ(ERR_IO_PENDING, rv); | 1730 EXPECT_EQ(ERR_IO_PENDING, rv); |
1724 | 1731 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 1924 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
1918 | 1925 |
1919 std::string response_data; | 1926 std::string response_data; |
1920 rv = ReadTransaction(trans.get(), &response_data); | 1927 rv = ReadTransaction(trans.get(), &response_data); |
1921 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 1928 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
1922 | 1929 |
1923 // Flush the idle socket before the HttpNetworkTransaction goes out of scope. | 1930 // Flush the idle socket before the HttpNetworkTransaction goes out of scope. |
1924 session->CloseAllConnections(); | 1931 session->CloseAllConnections(); |
1925 } | 1932 } |
1926 | 1933 |
| 1934 // Test the request-challenge-retry sequence for basic auth, over a connection |
| 1935 // that requires a restart when setting up an SSL tunnel. |
| 1936 TEST_F(HttpNetworkTransactionTest, BasicAuthHttpsProxyNoKeepAlive) { |
| 1937 HttpRequestInfo request; |
| 1938 request.method = "GET"; |
| 1939 request.url = GURL("https://www.google.com/"); |
| 1940 // when the no authentication data flag is set. |
| 1941 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
| 1942 |
| 1943 // Configure against https proxy server "myproxy:70". |
| 1944 SessionDependencies session_deps( |
| 1945 ProxyService::CreateFixed("https://myproxy:70")); |
| 1946 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
| 1947 session_deps.net_log = log.bound().net_log(); |
| 1948 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 1949 |
| 1950 // Since we have proxy, should try to establish tunnel. |
| 1951 MockWrite data_writes1[] = { |
| 1952 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 1953 "Host: www.google.com\r\n" |
| 1954 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 1955 }; |
| 1956 |
| 1957 MockWrite data_writes2[] = { |
| 1958 // After calling trans->RestartWithAuth(), this is the request we should |
| 1959 // be issuing -- the final header line contains the credentials. |
| 1960 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 1961 "Host: www.google.com\r\n" |
| 1962 "Proxy-Connection: keep-alive\r\n" |
| 1963 "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), |
| 1964 |
| 1965 MockWrite("GET / HTTP/1.1\r\n" |
| 1966 "Host: www.google.com\r\n" |
| 1967 "Connection: keep-alive\r\n\r\n"), |
| 1968 }; |
| 1969 |
| 1970 // The proxy responds to the connect with a 407, using a persistent |
| 1971 // connection. |
| 1972 MockRead data_reads1[] = { |
| 1973 // No credentials. |
| 1974 MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"), |
| 1975 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), |
| 1976 MockRead("Proxy-Connection: close\r\n\r\n"), |
| 1977 }; |
| 1978 |
| 1979 MockRead data_reads2[] = { |
| 1980 MockRead("HTTP/1.1 200 Connection Established\r\n\r\n"), |
| 1981 |
| 1982 MockRead("HTTP/1.1 200 OK\r\n"), |
| 1983 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), |
| 1984 MockRead("Content-Length: 5\r\n\r\n"), |
| 1985 MockRead(false, "hello"), |
| 1986 }; |
| 1987 |
| 1988 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 1989 data_writes1, arraysize(data_writes1)); |
| 1990 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 1991 data_writes2, arraysize(data_writes2)); |
| 1992 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 1993 session_deps.socket_factory.AddSocketDataProvider(&data2); |
| 1994 SSLSocketDataProvider proxy(true, OK); |
| 1995 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy); |
| 1996 SSLSocketDataProvider proxy2(true, OK); |
| 1997 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy2); |
| 1998 SSLSocketDataProvider server(true, OK); |
| 1999 session_deps.socket_factory.AddSSLSocketDataProvider(&server); |
| 2000 |
| 2001 TestOldCompletionCallback callback1; |
| 2002 |
| 2003 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 2004 |
| 2005 int rv = trans->Start(&request, &callback1, log.bound()); |
| 2006 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2007 |
| 2008 rv = callback1.WaitForResult(); |
| 2009 EXPECT_EQ(OK, rv); |
| 2010 net::CapturingNetLog::EntryList entries; |
| 2011 log.GetEntries(&entries); |
| 2012 size_t pos = ExpectLogContainsSomewhere( |
| 2013 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2014 NetLog::PHASE_NONE); |
| 2015 ExpectLogContainsSomewhere( |
| 2016 entries, pos, |
| 2017 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2018 NetLog::PHASE_NONE); |
| 2019 |
| 2020 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2021 ASSERT_TRUE(response != NULL); |
| 2022 ASSERT_FALSE(response->headers == NULL); |
| 2023 EXPECT_EQ(407, response->headers->response_code()); |
| 2024 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2025 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2026 |
| 2027 TestOldCompletionCallback callback2; |
| 2028 |
| 2029 rv = trans->RestartWithAuth(AuthCredentials(kFoo, kBar), &callback2); |
| 2030 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2031 |
| 2032 rv = callback2.WaitForResult(); |
| 2033 EXPECT_EQ(OK, rv); |
| 2034 |
| 2035 response = trans->GetResponseInfo(); |
| 2036 ASSERT_TRUE(response != NULL); |
| 2037 |
| 2038 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2039 EXPECT_EQ(200, response->headers->response_code()); |
| 2040 EXPECT_EQ(5, response->headers->GetContentLength()); |
| 2041 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2042 |
| 2043 // The password prompt info should not be set. |
| 2044 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 2045 |
| 2046 trans.reset(); |
| 2047 session->CloseAllConnections(); |
| 2048 } |
| 2049 |
| 2050 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2051 // proxy connection, when setting up an SSL tunnel. |
| 2052 TEST_F(HttpNetworkTransactionTest, BasicAuthHttpsProxyKeepAlive) { |
| 2053 HttpRequestInfo request; |
| 2054 request.method = "GET"; |
| 2055 request.url = GURL("https://www.google.com/"); |
| 2056 // Ensure that proxy authentication is attempted even |
| 2057 // when the no authentication data flag is set. |
| 2058 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2059 |
| 2060 // Configure against https proxy server "myproxy:70". |
| 2061 SessionDependencies session_deps( |
| 2062 ProxyService::CreateFixed("https://myproxy:70")); |
| 2063 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
| 2064 session_deps.net_log = log.bound().net_log(); |
| 2065 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 2066 |
| 2067 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 2068 |
| 2069 // Since we have proxy, should try to establish tunnel. |
| 2070 MockWrite data_writes1[] = { |
| 2071 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 2072 "Host: www.google.com\r\n" |
| 2073 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2074 |
| 2075 // After calling trans->RestartWithAuth(), this is the request we should |
| 2076 // be issuing -- the final header line contains the credentials. |
| 2077 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 2078 "Host: www.google.com\r\n" |
| 2079 "Proxy-Connection: keep-alive\r\n" |
| 2080 "Proxy-Authorization: Basic Zm9vOmJheg==\r\n\r\n"), |
| 2081 }; |
| 2082 |
| 2083 // The proxy responds to the connect with a 407, using a persistent |
| 2084 // connection. |
| 2085 MockRead data_reads1[] = { |
| 2086 // No credentials. |
| 2087 MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"), |
| 2088 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), |
| 2089 MockRead("Content-Length: 10\r\n\r\n"), |
| 2090 MockRead("0123456789"), |
| 2091 |
| 2092 // Wrong credentials (wrong password). |
| 2093 MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"), |
| 2094 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), |
| 2095 MockRead("Content-Length: 10\r\n\r\n"), |
| 2096 // No response body because the test stops reading here. |
| 2097 MockRead(false, ERR_UNEXPECTED), // Should not be reached. |
| 2098 }; |
| 2099 |
| 2100 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2101 data_writes1, arraysize(data_writes1)); |
| 2102 session_deps.socket_factory.AddSocketDataProvider(&data1); |
| 2103 SSLSocketDataProvider ssl(true, OK); |
| 2104 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
| 2105 |
| 2106 TestOldCompletionCallback callback1; |
| 2107 |
| 2108 int rv = trans->Start(&request, &callback1, log.bound()); |
| 2109 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2110 |
| 2111 rv = callback1.WaitForResult(); |
| 2112 EXPECT_EQ(OK, rv); |
| 2113 net::CapturingNetLog::EntryList entries; |
| 2114 log.GetEntries(&entries); |
| 2115 size_t pos = ExpectLogContainsSomewhere( |
| 2116 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2117 NetLog::PHASE_NONE); |
| 2118 ExpectLogContainsSomewhere( |
| 2119 entries, pos, |
| 2120 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2121 NetLog::PHASE_NONE); |
| 2122 |
| 2123 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2124 ASSERT_TRUE(response != NULL); |
| 2125 ASSERT_FALSE(response->headers == NULL); |
| 2126 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2127 EXPECT_EQ(407, response->headers->response_code()); |
| 2128 EXPECT_EQ(10, response->headers->GetContentLength()); |
| 2129 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2130 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2131 |
| 2132 TestOldCompletionCallback callback2; |
| 2133 |
| 2134 // Wrong password (should be "bar"). |
| 2135 rv = trans->RestartWithAuth(AuthCredentials(kFoo, kBaz), &callback2); |
| 2136 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2137 |
| 2138 rv = callback2.WaitForResult(); |
| 2139 EXPECT_EQ(OK, rv); |
| 2140 |
| 2141 response = trans->GetResponseInfo(); |
| 2142 ASSERT_TRUE(response != NULL); |
| 2143 ASSERT_FALSE(response->headers == NULL); |
| 2144 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2145 EXPECT_EQ(407, response->headers->response_code()); |
| 2146 EXPECT_EQ(10, response->headers->GetContentLength()); |
| 2147 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2148 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2149 |
| 2150 // Flush the idle socket before the NetLog and HttpNetworkTransaction go |
| 2151 // out of scope. |
| 2152 session->CloseAllConnections(); |
| 2153 } |
| 2154 |
| 2155 // Test the request-challenge-retry sequence for basic auth, through |
| 2156 // a SPDY proxy over a single SPDY session. |
| 2157 TEST_F(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { |
| 2158 HttpRequestInfo request; |
| 2159 request.method = "GET"; |
| 2160 request.url = GURL("https://www.google.com/"); |
| 2161 // when the no authentication data flag is set. |
| 2162 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2163 |
| 2164 // Configure against https proxy server "myproxy:70". |
| 2165 SessionDependencies session_deps( |
| 2166 ProxyService::CreateFixed("https://myproxy:70")); |
| 2167 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
| 2168 session_deps.net_log = log.bound().net_log(); |
| 2169 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
| 2170 |
| 2171 // Since we have proxy, should try to establish tunnel. |
| 2172 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyConnect(NULL, 0, 1)); |
| 2173 scoped_ptr<spdy::SpdyFrame> rst(ConstructSpdyRstStream(1, spdy::CANCEL)); |
| 2174 |
| 2175 // After calling trans->RestartWithAuth(), this is the request we should |
| 2176 // be issuing -- the final header line contains the credentials. |
| 2177 const char* const kAuthCredentials[] = { |
| 2178 "proxy-authorization", "Basic Zm9vOmJhcg==", |
| 2179 }; |
| 2180 scoped_ptr<spdy::SpdyFrame> connect2( |
| 2181 ConstructSpdyConnect(kAuthCredentials, arraysize(kAuthCredentials)/2, 3)); |
| 2182 // fetch https://www.google.com/ via HTTP |
| 2183 const char get[] = "GET / HTTP/1.1\r\n" |
| 2184 "Host: www.google.com\r\n" |
| 2185 "Connection: keep-alive\r\n\r\n"; |
| 2186 scoped_ptr<spdy::SpdyFrame> wrapped_get( |
| 2187 ConstructSpdyBodyFrame(3, get, strlen(get), false)); |
| 2188 |
| 2189 MockWrite spdy_writes[] = { |
| 2190 CreateMockWrite(*req, 0, true), |
| 2191 CreateMockWrite(*rst, 2, true), |
| 2192 CreateMockWrite(*connect2, 3), |
| 2193 CreateMockWrite(*wrapped_get, 5) |
| 2194 }; |
| 2195 |
| 2196 // The proxy responds to the connect with a 407, using a persistent |
| 2197 // connection. |
| 2198 const char* const kAuthChallenge[] = { |
| 2199 "status", "407 Proxy Authentication Required", |
| 2200 "version", "HTTP/1.1", |
| 2201 "proxy-authenticate", "Basic realm=\"MyRealm1\"", |
| 2202 }; |
| 2203 |
| 2204 scoped_ptr<spdy::SpdyFrame> conn_auth_resp( |
| 2205 ConstructSpdyControlFrame(NULL, |
| 2206 0, |
| 2207 false, |
| 2208 1, |
| 2209 LOWEST, |
| 2210 spdy::SYN_REPLY, |
| 2211 spdy::CONTROL_FLAG_NONE, |
| 2212 kAuthChallenge, |
| 2213 arraysize(kAuthChallenge))); |
| 2214 |
| 2215 scoped_ptr<spdy::SpdyFrame> conn_resp(ConstructSpdyGetSynReply(NULL, 0, 3)); |
| 2216 const char resp[] = "HTTP/1.1 200 OK\r\n" |
| 2217 "Content-Length: 5\r\n\r\n"; |
| 2218 |
| 2219 scoped_ptr<spdy::SpdyFrame> wrapped_get_resp( |
| 2220 ConstructSpdyBodyFrame(3, resp, strlen(resp), false)); |
| 2221 scoped_ptr<spdy::SpdyFrame> wrapped_body( |
| 2222 ConstructSpdyBodyFrame(3, "hello", 10, false)); |
| 2223 MockRead spdy_reads[] = { |
| 2224 CreateMockRead(*conn_auth_resp, 1, true), |
| 2225 CreateMockRead(*conn_resp, 4, true), |
| 2226 CreateMockRead(*wrapped_get_resp, 5, true), |
| 2227 CreateMockRead(*wrapped_body, 6, true), |
| 2228 MockRead(false, ERR_IO_PENDING), |
| 2229 }; |
| 2230 |
| 2231 scoped_refptr<OrderedSocketData> spdy_data( |
| 2232 new OrderedSocketData( |
| 2233 spdy_reads, arraysize(spdy_reads), |
| 2234 spdy_writes, arraysize(spdy_writes))); |
| 2235 session_deps.socket_factory.AddSocketDataProvider(spdy_data); |
| 2236 // Negotiate SPDY to the proxy |
| 2237 SSLSocketDataProvider proxy(true, OK); |
| 2238 proxy.next_proto_status = SSLClientSocket::kNextProtoNegotiated; |
| 2239 proxy.next_proto = "spdy/2"; |
| 2240 proxy.was_npn_negotiated = true; |
| 2241 session_deps.socket_factory.AddSSLSocketDataProvider(&proxy); |
| 2242 // Vanilla SSL to the server |
| 2243 SSLSocketDataProvider server(true, OK); |
| 2244 session_deps.socket_factory.AddSSLSocketDataProvider(&server); |
| 2245 |
| 2246 TestOldCompletionCallback callback1; |
| 2247 |
| 2248 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
| 2249 |
| 2250 int rv = trans->Start(&request, &callback1, log.bound()); |
| 2251 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2252 |
| 2253 rv = callback1.WaitForResult(); |
| 2254 EXPECT_EQ(OK, rv); |
| 2255 net::CapturingNetLog::EntryList entries; |
| 2256 log.GetEntries(&entries); |
| 2257 size_t pos = ExpectLogContainsSomewhere( |
| 2258 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2259 NetLog::PHASE_NONE); |
| 2260 ExpectLogContainsSomewhere( |
| 2261 entries, pos, |
| 2262 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2263 NetLog::PHASE_NONE); |
| 2264 |
| 2265 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2266 ASSERT_TRUE(response != NULL); |
| 2267 ASSERT_FALSE(response->headers == NULL); |
| 2268 EXPECT_EQ(407, response->headers->response_code()); |
| 2269 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2270 EXPECT_TRUE(response->auth_challenge.get() != NULL); |
| 2271 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2272 |
| 2273 TestOldCompletionCallback callback2; |
| 2274 |
| 2275 rv = trans->RestartWithAuth(AuthCredentials(kFoo, kBar), &callback2); |
| 2276 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2277 |
| 2278 rv = callback2.WaitForResult(); |
| 2279 EXPECT_EQ(OK, rv); |
| 2280 |
| 2281 response = trans->GetResponseInfo(); |
| 2282 ASSERT_TRUE(response != NULL); |
| 2283 |
| 2284 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2285 EXPECT_EQ(200, response->headers->response_code()); |
| 2286 EXPECT_EQ(5, response->headers->GetContentLength()); |
| 2287 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2288 |
| 2289 // The password prompt info should not be set. |
| 2290 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 2291 |
| 2292 trans.reset(); |
| 2293 session->CloseAllConnections(); |
| 2294 } |
| 2295 |
1927 // Test when a server (non-proxy) returns a 407 (proxy-authenticate). | 2296 // Test when a server (non-proxy) returns a 407 (proxy-authenticate). |
1928 // The request should fail with ERR_UNEXPECTED_PROXY_AUTH. | 2297 // The request should fail with ERR_UNEXPECTED_PROXY_AUTH. |
1929 TEST_F(HttpNetworkTransactionTest, UnexpectedProxyAuth) { | 2298 TEST_F(HttpNetworkTransactionTest, UnexpectedProxyAuth) { |
1930 HttpRequestInfo request; | 2299 HttpRequestInfo request; |
1931 request.method = "GET"; | 2300 request.method = "GET"; |
1932 request.url = GURL("http://www.google.com/"); | 2301 request.url = GURL("http://www.google.com/"); |
1933 request.load_flags = 0; | 2302 request.load_flags = 0; |
1934 | 2303 |
1935 // We are using a DIRECT connection (i.e. no proxy) for this session. | 2304 // We are using a DIRECT connection (i.e. no proxy) for this session. |
1936 SessionDependencies session_deps; | 2305 SessionDependencies session_deps; |
(...skipping 5438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7375 } | 7744 } |
7376 | 7745 |
7377 // GenerateAuthToken is a mighty big test. | 7746 // GenerateAuthToken is a mighty big test. |
7378 // It tests all permutation of GenerateAuthToken behavior: | 7747 // It tests all permutation of GenerateAuthToken behavior: |
7379 // - Synchronous and Asynchronous completion. | 7748 // - Synchronous and Asynchronous completion. |
7380 // - OK or error on completion. | 7749 // - OK or error on completion. |
7381 // - Direct connection, non-authenticating proxy, and authenticating proxy. | 7750 // - Direct connection, non-authenticating proxy, and authenticating proxy. |
7382 // - HTTP or HTTPS backend (to include proxy tunneling). | 7751 // - HTTP or HTTPS backend (to include proxy tunneling). |
7383 // - Non-authenticating and authenticating backend. | 7752 // - Non-authenticating and authenticating backend. |
7384 // | 7753 // |
7385 // In all, there are 44 reasonable permuations (for example, if there are | 7754 // In all, there are 44 reasonable permutations (for example, if there are |
7386 // problems generating an auth token for an authenticating proxy, we don't | 7755 // problems generating an auth token for an authenticating proxy, we don't |
7387 // need to test all permutations of the backend server). | 7756 // need to test all permutations of the backend server). |
7388 // | 7757 // |
7389 // The test proceeds by going over each of the configuration cases, and | 7758 // The test proceeds by going over each of the configuration cases, and |
7390 // potentially running up to three rounds in each of the tests. The TestConfig | 7759 // potentially running up to three rounds in each of the tests. The TestConfig |
7391 // specifies both the configuration for the test as well as the expectations | 7760 // specifies both the configuration for the test as well as the expectations |
7392 // for the results. | 7761 // for the results. |
7393 TEST_F(HttpNetworkTransactionTest, GenerateAuthToken) { | 7762 TEST_F(HttpNetworkTransactionTest, GenerateAuthToken) { |
7394 static const char kServer[] = "http://www.example.com"; | 7763 static const char kServer[] = "http://www.example.com"; |
7395 static const char kSecureServer[] = "https://www.example.com"; | 7764 static const char kSecureServer[] = "https://www.example.com"; |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8192 TEST_F(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 8561 TEST_F(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
8193 // This test ensures that the URL passed into the proxy is upgraded | 8562 // This test ensures that the URL passed into the proxy is upgraded |
8194 // to https when doing an Alternate Protocol upgrade. | 8563 // to https when doing an Alternate Protocol upgrade. |
8195 HttpStreamFactory::set_use_alternate_protocols(true); | 8564 HttpStreamFactory::set_use_alternate_protocols(true); |
8196 HttpStreamFactory::set_next_protos( | 8565 HttpStreamFactory::set_next_protos( |
8197 MakeNextProtos("http/1.1", "http1.1", "spdy/2", "spdy", NULL)); | 8566 MakeNextProtos("http/1.1", "http1.1", "spdy/2", "spdy", NULL)); |
8198 | 8567 |
8199 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); | 8568 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); |
8200 HttpAuthHandlerMock::Factory* auth_factory = | 8569 HttpAuthHandlerMock::Factory* auth_factory = |
8201 new HttpAuthHandlerMock::Factory(); | 8570 new HttpAuthHandlerMock::Factory(); |
8202 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 8571 HttpAuthHandlerMock* auth_handler1 = new HttpAuthHandlerMock(); |
8203 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 8572 auth_factory->AddMockHandler(auth_handler1, HttpAuth::AUTH_PROXY); |
| 8573 HttpAuthHandlerMock* auth_handler2 = new HttpAuthHandlerMock(); |
| 8574 auth_factory->AddMockHandler(auth_handler2, HttpAuth::AUTH_PROXY); |
8204 auth_factory->set_do_init_from_challenge(true); | 8575 auth_factory->set_do_init_from_challenge(true); |
8205 session_deps.http_auth_handler_factory.reset(auth_factory); | 8576 session_deps.http_auth_handler_factory.reset(auth_factory); |
8206 | 8577 |
8207 HttpRequestInfo request; | 8578 HttpRequestInfo request; |
8208 request.method = "GET"; | 8579 request.method = "GET"; |
8209 request.url = GURL("http://www.google.com"); | 8580 request.url = GURL("http://www.google.com"); |
8210 request.load_flags = 0; | 8581 request.load_flags = 0; |
8211 | 8582 |
8212 // First round goes unauthenticated through the proxy. | 8583 // First round goes unauthenticated through the proxy. |
8213 MockWrite data_writes_1[] = { | 8584 MockWrite data_writes_1[] = { |
(...skipping 11 matching lines...) Expand all Loading... |
8225 }; | 8596 }; |
8226 StaticSocketDataProvider data_1(data_reads_1, arraysize(data_reads_1), | 8597 StaticSocketDataProvider data_1(data_reads_1, arraysize(data_reads_1), |
8227 data_writes_1, arraysize(data_writes_1)); | 8598 data_writes_1, arraysize(data_writes_1)); |
8228 | 8599 |
8229 // Second round tries to tunnel to www.google.com due to the | 8600 // Second round tries to tunnel to www.google.com due to the |
8230 // Alternate-Protocol announcement in the first round. It fails due | 8601 // Alternate-Protocol announcement in the first round. It fails due |
8231 // to a proxy authentication challenge. | 8602 // to a proxy authentication challenge. |
8232 // After the failure, a tunnel is established to www.google.com using | 8603 // After the failure, a tunnel is established to www.google.com using |
8233 // Proxy-Authorization headers. There is then a SPDY request round. | 8604 // Proxy-Authorization headers. There is then a SPDY request round. |
8234 // | 8605 // |
8235 // NOTE: Despite the "Proxy-Connection: Close", these are done on the | |
8236 // same MockTCPClientSocket since the underlying HttpNetworkClientSocket | |
8237 // does a Disconnect and Connect on the same socket, rather than trying | |
8238 // to obtain a new one. | |
8239 // | |
8240 // NOTE: Originally, the proxy response to the second CONNECT request | 8606 // NOTE: Originally, the proxy response to the second CONNECT request |
8241 // simply returned another 407 so the unit test could skip the SSL connection | 8607 // simply returned another 407 so the unit test could skip the SSL connection |
8242 // establishment and SPDY framing issues. Alas, the | 8608 // establishment and SPDY framing issues. Alas, the |
8243 // retry-http-when-alternate-protocol fails logic kicks in, which was more | 8609 // retry-http-when-alternate-protocol fails logic kicks in, which was more |
8244 // complicated to set up expectations for than the SPDY session. | 8610 // complicated to set up expectations for than the SPDY session. |
8245 | 8611 |
8246 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 8612 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
8247 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 8613 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
8248 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true)); | 8614 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true)); |
8249 | 8615 |
8250 MockWrite data_writes_2[] = { | 8616 MockWrite data_writes_2[] = { |
8251 // First connection attempt without Proxy-Authorization. | 8617 // First connection attempt without Proxy-Authorization. |
8252 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 8618 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
8253 "Host: www.google.com\r\n" | 8619 "Host: www.google.com\r\n" |
8254 "Proxy-Connection: keep-alive\r\n" | 8620 "Proxy-Connection: keep-alive\r\n" |
8255 "\r\n"), | 8621 "\r\n"), |
| 8622 }; |
8256 | 8623 |
| 8624 MockWrite data_writes_3[] = { |
| 8625 // Non-alternate protocol job that will run in parallel |
| 8626 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" |
| 8627 "Host: www.google.com\r\n" |
| 8628 "Proxy-Connection: keep-alive\r\n" |
| 8629 "\r\n"), |
| 8630 }; |
| 8631 |
| 8632 MockWrite data_writes_4[] = { |
8257 // Second connection attempt with Proxy-Authorization. | 8633 // Second connection attempt with Proxy-Authorization. |
8258 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 8634 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
8259 "Host: www.google.com\r\n" | 8635 "Host: www.google.com\r\n" |
8260 "Proxy-Connection: keep-alive\r\n" | 8636 "Proxy-Connection: keep-alive\r\n" |
8261 "Proxy-Authorization: auth_token\r\n" | 8637 "Proxy-Authorization: auth_token\r\n" |
8262 "\r\n"), | 8638 "\r\n"), |
8263 | 8639 |
8264 // SPDY request | 8640 // SPDY request |
8265 CreateMockWrite(*req), | 8641 CreateMockWrite(*req), |
8266 }; | 8642 }; |
8267 const char kRejectConnectResponse[] = ("HTTP/1.1 407 Unauthorized\r\n" | 8643 const char kRejectConnectResponse[] = ("HTTP/1.1 407 Unauthorized\r\n" |
8268 "Proxy-Authenticate: Mock\r\n" | 8644 "Proxy-Authenticate: Mock\r\n" |
8269 "Proxy-Connection: close\r\n" | 8645 "Proxy-Connection: close\r\n" |
| 8646 "Content-Length: 0\r\n" |
8270 "\r\n"); | 8647 "\r\n"); |
8271 const char kAcceptConnectResponse[] = "HTTP/1.1 200 Connected\r\n\r\n"; | 8648 const char kAcceptConnectResponse[] = "HTTP/1.1 200 Connected\r\n\r\n"; |
8272 MockRead data_reads_2[] = { | 8649 MockRead data_reads_2[] = { |
8273 // First connection attempt fails | 8650 // First connection attempt fails |
8274 MockRead(false, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, 1), | 8651 MockRead(false, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, 1), |
8275 MockRead(true, kRejectConnectResponse, | 8652 MockRead(true, kRejectConnectResponse, |
8276 arraysize(kRejectConnectResponse) - 1, 1), | 8653 arraysize(kRejectConnectResponse) - 1, 1), |
| 8654 }; |
8277 | 8655 |
| 8656 // Hang forever so we can ensure the alt job wins |
| 8657 MockRead data_reads_3[] = { |
| 8658 MockRead(false, ERR_IO_PENDING), |
| 8659 }; |
| 8660 |
| 8661 MockRead data_reads_4[] = { |
8278 // Second connection attempt passes | 8662 // Second connection attempt passes |
8279 MockRead(true, kAcceptConnectResponse, | 8663 MockRead(true, kAcceptConnectResponse, |
8280 arraysize(kAcceptConnectResponse) -1, 4), | 8664 arraysize(kAcceptConnectResponse) -1, 1), |
8281 | 8665 |
8282 // SPDY response | 8666 // SPDY response |
8283 CreateMockRead(*resp.get(), 6), | 8667 CreateMockRead(*resp.get(), 3), |
8284 CreateMockRead(*data.get(), 6), | 8668 CreateMockRead(*data.get(), 3), |
8285 MockRead(true, 0, 0, 6), | 8669 MockRead(true, 0, 0, 4), |
8286 }; | 8670 }; |
8287 scoped_refptr<OrderedSocketData> data_2( | 8671 scoped_refptr<OrderedSocketData> data_2( |
8288 new OrderedSocketData(data_reads_2, arraysize(data_reads_2), | 8672 new OrderedSocketData(data_reads_2, arraysize(data_reads_2), |
8289 data_writes_2, arraysize(data_writes_2))); | 8673 data_writes_2, arraysize(data_writes_2))); |
| 8674 scoped_refptr<OrderedSocketData> data_3( |
| 8675 new OrderedSocketData(data_reads_3, arraysize(data_reads_3), |
| 8676 data_writes_3, arraysize(data_writes_3))); |
| 8677 // Hang forever so we can ensure the alt job wins |
| 8678 MockConnect conn_3(false, ERR_IO_PENDING); |
| 8679 data_3->set_connect_data(conn_3); |
| 8680 scoped_refptr<OrderedSocketData> data_4( |
| 8681 new OrderedSocketData(data_reads_4, arraysize(data_reads_4), |
| 8682 data_writes_4, arraysize(data_writes_4))); |
8290 | 8683 |
8291 SSLSocketDataProvider ssl(true, OK); | 8684 SSLSocketDataProvider ssl(true, OK); |
8292 ssl.next_proto_status = SSLClientSocket::kNextProtoNegotiated; | 8685 ssl.next_proto_status = SSLClientSocket::kNextProtoNegotiated; |
8293 ssl.next_proto = "spdy/2"; | 8686 ssl.next_proto = "spdy/2"; |
8294 ssl.was_npn_negotiated = true; | 8687 ssl.was_npn_negotiated = true; |
8295 | 8688 |
8296 MockConnect never_finishing_connect(false, ERR_IO_PENDING); | 8689 MockConnect never_finishing_connect(false, ERR_IO_PENDING); |
8297 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 8690 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
8298 NULL, 0, NULL, 0); | 8691 NULL, 0, NULL, 0); |
8299 hanging_non_alternate_protocol_socket.set_connect_data( | 8692 hanging_non_alternate_protocol_socket.set_connect_data( |
8300 never_finishing_connect); | 8693 never_finishing_connect); |
8301 | 8694 |
8302 session_deps.socket_factory.AddSocketDataProvider(&data_1); | 8695 session_deps.socket_factory.AddSocketDataProvider(&data_1); |
8303 session_deps.socket_factory.AddSocketDataProvider(data_2.get()); | 8696 session_deps.socket_factory.AddSocketDataProvider(data_2.get()); |
| 8697 session_deps.socket_factory.AddSocketDataProvider(data_3.get()); |
| 8698 session_deps.socket_factory.AddSocketDataProvider(data_4.get()); |
| 8699 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
8304 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 8700 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
8305 session_deps.socket_factory.AddSocketDataProvider( | 8701 session_deps.socket_factory.AddSocketDataProvider( |
8306 &hanging_non_alternate_protocol_socket); | 8702 &hanging_non_alternate_protocol_socket); |
8307 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 8703 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
8308 | 8704 |
8309 // First round should work and provide the Alternate-Protocol state. | 8705 // First round should work and provide the Alternate-Protocol state. |
8310 TestOldCompletionCallback callback_1; | 8706 TestOldCompletionCallback callback_1; |
8311 scoped_ptr<HttpTransaction> trans_1(new HttpNetworkTransaction(session)); | 8707 scoped_ptr<HttpTransaction> trans_1(new HttpNetworkTransaction(session)); |
8312 int rv = trans_1->Start(&request, &callback_1, BoundNetLog()); | 8708 int rv = trans_1->Start(&request, &callback_1, BoundNetLog()); |
8313 EXPECT_EQ(ERR_IO_PENDING, rv); | 8709 EXPECT_EQ(ERR_IO_PENDING, rv); |
(...skipping 10 matching lines...) Expand all Loading... |
8324 ASSERT_FALSE(response->auth_challenge.get() == NULL); | 8720 ASSERT_FALSE(response->auth_challenge.get() == NULL); |
8325 | 8721 |
8326 // Restart with auth. Tunnel should work and response received. | 8722 // Restart with auth. Tunnel should work and response received. |
8327 TestOldCompletionCallback callback_3; | 8723 TestOldCompletionCallback callback_3; |
8328 rv = trans_2->RestartWithAuth(AuthCredentials(kFoo, kBar), &callback_3); | 8724 rv = trans_2->RestartWithAuth(AuthCredentials(kFoo, kBar), &callback_3); |
8329 EXPECT_EQ(ERR_IO_PENDING, rv); | 8725 EXPECT_EQ(ERR_IO_PENDING, rv); |
8330 EXPECT_EQ(OK, callback_3.WaitForResult()); | 8726 EXPECT_EQ(OK, callback_3.WaitForResult()); |
8331 | 8727 |
8332 // After all that work, these two lines (or actually, just the scheme) are | 8728 // After all that work, these two lines (or actually, just the scheme) are |
8333 // what this test is all about. Make sure it happens correctly. | 8729 // what this test is all about. Make sure it happens correctly. |
8334 const GURL& request_url = auth_handler->request_url(); | 8730 const GURL& request_url = auth_handler2->request_url(); |
8335 EXPECT_EQ("https", request_url.scheme()); | 8731 EXPECT_EQ("https", request_url.scheme()); |
8336 EXPECT_EQ("www.google.com", request_url.host()); | 8732 EXPECT_EQ("www.google.com", request_url.host()); |
8337 | 8733 |
8338 HttpStreamFactory::set_next_protos(std::vector<std::string>()); | 8734 HttpStreamFactory::set_next_protos(std::vector<std::string>()); |
8339 HttpStreamFactory::set_use_alternate_protocols(false); | 8735 HttpStreamFactory::set_use_alternate_protocols(false); |
8340 } | 8736 } |
8341 | 8737 |
8342 // Test that if we cancel the transaction as the connection is completing, that | 8738 // Test that if we cancel the transaction as the connection is completing, that |
8343 // everything tears down correctly. | 8739 // everything tears down correctly. |
8344 TEST_F(HttpNetworkTransactionTest, SimpleCancel) { | 8740 TEST_F(HttpNetworkTransactionTest, SimpleCancel) { |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9297 StaticSocketDataProvider* data[] = { &data1, &data2 }; | 9693 StaticSocketDataProvider* data[] = { &data1, &data2 }; |
9298 | 9694 |
9299 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); | 9695 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); |
9300 | 9696 |
9301 EXPECT_EQ(OK, out.rv); | 9697 EXPECT_EQ(OK, out.rv); |
9302 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 9698 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
9303 EXPECT_EQ("hello world", out.response_data); | 9699 EXPECT_EQ("hello world", out.response_data); |
9304 } | 9700 } |
9305 | 9701 |
9306 } // namespace net | 9702 } // namespace net |
OLD | NEW |