| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <math.h> // ceil | 5 #include <math.h> // ceil |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "net/base/client_socket_factory.h" | 8 #include "net/base/client_socket_factory.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/ssl_client_socket.h" | 10 #include "net/base/ssl_client_socket.h" |
| (...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 "Connection: keep-alive\r\n\r\n"), | 1773 "Connection: keep-alive\r\n\r\n"), |
| 1774 }; | 1774 }; |
| 1775 | 1775 |
| 1776 MockRead data_reads1[] = { | 1776 MockRead data_reads1[] = { |
| 1777 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 1777 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 1778 // Negotiate and NTLM are often requested together. We only support NTLM. | 1778 // Negotiate and NTLM are often requested together. We only support NTLM. |
| 1779 MockRead("WWW-Authenticate: Negotiate\r\n"), | 1779 MockRead("WWW-Authenticate: Negotiate\r\n"), |
| 1780 MockRead("WWW-Authenticate: NTLM\r\n"), | 1780 MockRead("WWW-Authenticate: NTLM\r\n"), |
| 1781 MockRead("Connection: close\r\n"), | 1781 MockRead("Connection: close\r\n"), |
| 1782 MockRead("Content-Length: 42\r\n"), | 1782 MockRead("Content-Length: 42\r\n"), |
| 1783 MockRead("Content-Type: text/html\r\n"), | 1783 MockRead("Content-Type: text/html\r\n\r\n"), |
| 1784 MockRead("Proxy-Support: Session-Based-Authentication\r\n\r\n"), | |
| 1785 // Missing content -- won't matter, as connection will be reset. | 1784 // Missing content -- won't matter, as connection will be reset. |
| 1786 MockRead(false, net::ERR_UNEXPECTED), | 1785 MockRead(false, net::ERR_UNEXPECTED), |
| 1787 }; | 1786 }; |
| 1788 | 1787 |
| 1789 MockWrite data_writes2[] = { | 1788 MockWrite data_writes2[] = { |
| 1790 // After restarting with a null identity, this is the | 1789 // After restarting with a null identity, this is the |
| 1791 // request we should be issuing -- the final header line contains a Type | 1790 // request we should be issuing -- the final header line contains a Type |
| 1792 // 1 message. | 1791 // 1 message. |
| 1793 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 1792 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 1794 "Host: 172.22.68.17\r\n" | 1793 "Host: 172.22.68.17\r\n" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1814 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 1813 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 1815 MockRead("WWW-Authenticate: NTLM " | 1814 MockRead("WWW-Authenticate: NTLM " |
| 1816 "TlRMTVNTUAACAAAADAAMADgAAAAFgokCjGpMpPGlYKkAAAAAAAAAALo" | 1815 "TlRMTVNTUAACAAAADAAMADgAAAAFgokCjGpMpPGlYKkAAAAAAAAAALo" |
| 1817 "AugBEAAAABQEoCgAAAA9HAE8ATwBHAEwARQACAAwARwBPAE8ARwBMAE" | 1816 "AugBEAAAABQEoCgAAAA9HAE8ATwBHAEwARQACAAwARwBPAE8ARwBMAE" |
| 1818 "UAAQAaAEEASwBFAEUAUwBBAFIAQQAtAEMATwBSAFAABAAeAGMAbwByA" | 1817 "UAAQAaAEEASwBFAEUAUwBBAFIAQQAtAEMATwBSAFAABAAeAGMAbwByA" |
| 1819 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" | 1818 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" |
| 1820 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" | 1819 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" |
| 1821 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" | 1820 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" |
| 1822 "BtAAAAAAA=\r\n"), | 1821 "BtAAAAAAA=\r\n"), |
| 1823 MockRead("Content-Length: 42\r\n"), | 1822 MockRead("Content-Length: 42\r\n"), |
| 1824 MockRead("Content-Type: text/html\r\n"), | 1823 MockRead("Content-Type: text/html\r\n\r\n"), |
| 1825 MockRead("Proxy-Support: Session-Based-Authentication\r\n\r\n"), | |
| 1826 MockRead("You are not authorized to view this page\r\n"), | 1824 MockRead("You are not authorized to view this page\r\n"), |
| 1827 | 1825 |
| 1828 // Lastly we get the desired content. | 1826 // Lastly we get the desired content. |
| 1829 MockRead("HTTP/1.1 200 OK\r\n"), | 1827 MockRead("HTTP/1.1 200 OK\r\n"), |
| 1830 MockRead("Content-Type: text/html; charset=utf-8\r\n"), | 1828 MockRead("Content-Type: text/html; charset=utf-8\r\n"), |
| 1831 MockRead("Content-Length: 13\r\n\r\n"), | 1829 MockRead("Content-Length: 13\r\n\r\n"), |
| 1832 MockRead("Please Login\r\n"), | 1830 MockRead("Please Login\r\n"), |
| 1833 MockRead(false, net::OK), | 1831 MockRead(false, net::OK), |
| 1834 }; | 1832 }; |
| 1835 | 1833 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 "Connection: keep-alive\r\n\r\n"), | 1901 "Connection: keep-alive\r\n\r\n"), |
| 1904 }; | 1902 }; |
| 1905 | 1903 |
| 1906 MockRead data_reads1[] = { | 1904 MockRead data_reads1[] = { |
| 1907 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 1905 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 1908 // Negotiate and NTLM are often requested together. We only support NTLM. | 1906 // Negotiate and NTLM are often requested together. We only support NTLM. |
| 1909 MockRead("WWW-Authenticate: Negotiate\r\n"), | 1907 MockRead("WWW-Authenticate: Negotiate\r\n"), |
| 1910 MockRead("WWW-Authenticate: NTLM\r\n"), | 1908 MockRead("WWW-Authenticate: NTLM\r\n"), |
| 1911 MockRead("Connection: close\r\n"), | 1909 MockRead("Connection: close\r\n"), |
| 1912 MockRead("Content-Length: 42\r\n"), | 1910 MockRead("Content-Length: 42\r\n"), |
| 1913 MockRead("Content-Type: text/html\r\n"), | 1911 MockRead("Content-Type: text/html\r\n\r\n"), |
| 1914 MockRead("Proxy-Support: Session-Based-Authentication\r\n\r\n"), | |
| 1915 // Missing content -- won't matter, as connection will be reset. | 1912 // Missing content -- won't matter, as connection will be reset. |
| 1916 MockRead(false, net::ERR_UNEXPECTED), | 1913 MockRead(false, net::ERR_UNEXPECTED), |
| 1917 }; | 1914 }; |
| 1918 | 1915 |
| 1919 MockWrite data_writes2[] = { | 1916 MockWrite data_writes2[] = { |
| 1920 // After restarting with a null identity, this is the | 1917 // After restarting with a null identity, this is the |
| 1921 // request we should be issuing -- the final header line contains a Type | 1918 // request we should be issuing -- the final header line contains a Type |
| 1922 // 1 message. | 1919 // 1 message. |
| 1923 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 1920 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 1924 "Host: 172.22.68.17\r\n" | 1921 "Host: 172.22.68.17\r\n" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1944 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 1941 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 1945 MockRead("WWW-Authenticate: NTLM " | 1942 MockRead("WWW-Authenticate: NTLM " |
| 1946 "TlRMTVNTUAACAAAADAAMADgAAAAFgokCbVWUZezVGpAAAAAAAAAAALo" | 1943 "TlRMTVNTUAACAAAADAAMADgAAAAFgokCbVWUZezVGpAAAAAAAAAAALo" |
| 1947 "AugBEAAAABQEoCgAAAA9HAE8ATwBHAEwARQACAAwARwBPAE8ARwBMAE" | 1944 "AugBEAAAABQEoCgAAAA9HAE8ATwBHAEwARQACAAwARwBPAE8ARwBMAE" |
| 1948 "UAAQAaAEEASwBFAEUAUwBBAFIAQQAtAEMATwBSAFAABAAeAGMAbwByA" | 1945 "UAAQAaAEEASwBFAEUAUwBBAFIAQQAtAEMATwBSAFAABAAeAGMAbwByA" |
| 1949 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" | 1946 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" |
| 1950 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" | 1947 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" |
| 1951 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" | 1948 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" |
| 1952 "BtAAAAAAA=\r\n"), | 1949 "BtAAAAAAA=\r\n"), |
| 1953 MockRead("Content-Length: 42\r\n"), | 1950 MockRead("Content-Length: 42\r\n"), |
| 1954 MockRead("Content-Type: text/html\r\n"), | 1951 MockRead("Content-Type: text/html\r\n\r\n"), |
| 1955 MockRead("Proxy-Support: Session-Based-Authentication\r\n\r\n"), | |
| 1956 MockRead("You are not authorized to view this page\r\n"), | 1952 MockRead("You are not authorized to view this page\r\n"), |
| 1957 | 1953 |
| 1958 // Wrong password. | 1954 // Wrong password. |
| 1959 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 1955 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 1960 MockRead("WWW-Authenticate: Negotiate\r\n"), | 1956 MockRead("WWW-Authenticate: Negotiate\r\n"), |
| 1961 MockRead("WWW-Authenticate: NTLM\r\n"), | 1957 MockRead("WWW-Authenticate: NTLM\r\n"), |
| 1962 MockRead("Connection: close\r\n"), | 1958 MockRead("Connection: close\r\n"), |
| 1963 MockRead("Content-Length: 42\r\n"), | 1959 MockRead("Content-Length: 42\r\n"), |
| 1964 MockRead("Content-Type: text/html\r\n"), | 1960 MockRead("Content-Type: text/html\r\n\r\n"), |
| 1965 MockRead("Proxy-Support: Session-Based-Authentication\r\n\r\n"), | |
| 1966 // Missing content -- won't matter, as connection will be reset. | 1961 // Missing content -- won't matter, as connection will be reset. |
| 1967 MockRead(false, net::ERR_UNEXPECTED), | 1962 MockRead(false, net::ERR_UNEXPECTED), |
| 1968 }; | 1963 }; |
| 1969 | 1964 |
| 1970 MockWrite data_writes3[] = { | 1965 MockWrite data_writes3[] = { |
| 1971 // After restarting with a null identity, this is the | 1966 // After restarting with a null identity, this is the |
| 1972 // request we should be issuing -- the final header line contains a Type | 1967 // request we should be issuing -- the final header line contains a Type |
| 1973 // 1 message. | 1968 // 1 message. |
| 1974 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 1969 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 1975 "Host: 172.22.68.17\r\n" | 1970 "Host: 172.22.68.17\r\n" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1995 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 1990 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 1996 MockRead("WWW-Authenticate: NTLM " | 1991 MockRead("WWW-Authenticate: NTLM " |
| 1997 "TlRMTVNTUAACAAAADAAMADgAAAAFgokCL24VN8dgOR8AAAAAAAAAALo" | 1992 "TlRMTVNTUAACAAAADAAMADgAAAAFgokCL24VN8dgOR8AAAAAAAAAALo" |
| 1998 "AugBEAAAABQEoCgAAAA9HAE8ATwBHAEwARQACAAwARwBPAE8ARwBMAE" | 1993 "AugBEAAAABQEoCgAAAA9HAE8ATwBHAEwARQACAAwARwBPAE8ARwBMAE" |
| 1999 "UAAQAaAEEASwBFAEUAUwBBAFIAQQAtAEMATwBSAFAABAAeAGMAbwByA" | 1994 "UAAQAaAEEASwBFAEUAUwBBAFIAQQAtAEMATwBSAFAABAAeAGMAbwByA" |
| 2000 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" | 1995 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" |
| 2001 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" | 1996 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" |
| 2002 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" | 1997 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" |
| 2003 "BtAAAAAAA=\r\n"), | 1998 "BtAAAAAAA=\r\n"), |
| 2004 MockRead("Content-Length: 42\r\n"), | 1999 MockRead("Content-Length: 42\r\n"), |
| 2005 MockRead("Content-Type: text/html\r\n"), | 2000 MockRead("Content-Type: text/html\r\n\r\n"), |
| 2006 MockRead("Proxy-Support: Session-Based-Authentication\r\n\r\n"), | |
| 2007 MockRead("You are not authorized to view this page\r\n"), | 2001 MockRead("You are not authorized to view this page\r\n"), |
| 2008 | 2002 |
| 2009 // Lastly we get the desired content. | 2003 // Lastly we get the desired content. |
| 2010 MockRead("HTTP/1.1 200 OK\r\n"), | 2004 MockRead("HTTP/1.1 200 OK\r\n"), |
| 2011 MockRead("Content-Type: text/html; charset=utf-8\r\n"), | 2005 MockRead("Content-Type: text/html; charset=utf-8\r\n"), |
| 2012 MockRead("Content-Length: 13\r\n\r\n"), | 2006 MockRead("Content-Length: 13\r\n\r\n"), |
| 2013 MockRead("Please Login\r\n"), | 2007 MockRead("Please Login\r\n"), |
| 2014 MockRead(false, net::OK), | 2008 MockRead(false, net::OK), |
| 2015 }; | 2009 }; |
| 2016 | 2010 |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3042 EXPECT_EQ(OK, rv); | 3036 EXPECT_EQ(OK, rv); |
| 3043 | 3037 |
| 3044 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3038 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3045 | 3039 |
| 3046 EXPECT_FALSE(response == NULL); | 3040 EXPECT_FALSE(response == NULL); |
| 3047 EXPECT_EQ(100, response->headers->GetContentLength()); | 3041 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 3048 } | 3042 } |
| 3049 } | 3043 } |
| 3050 | 3044 |
| 3051 } // namespace net | 3045 } // namespace net |
| OLD | NEW |