| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class _HttpHeaders implements HttpHeaders { | 5 class _HttpHeaders implements HttpHeaders { |
| 6 _HttpHeaders() : _headers = new Map<String, List<String>>(); | 6 _HttpHeaders() : _headers = new Map<String, List<String>>(); |
| 7 | 7 |
| 8 List<String> operator[](String name) { | 8 List<String> operator[](String name) { |
| 9 name = name.toLowerCase(); | 9 name = name.toLowerCase(); |
| 10 return _headers[name]; | 10 return _headers[name]; |
| (...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 String _host; | 1969 String _host; |
| 1970 int _port; | 1970 int _port; |
| 1971 Socket _socket; | 1971 Socket _socket; |
| 1972 Date _returnTime; | 1972 Date _returnTime; |
| 1973 } | 1973 } |
| 1974 | 1974 |
| 1975 class _ProxyConfiguration { | 1975 class _ProxyConfiguration { |
| 1976 static const String PROXY_PREFIX = "PROXY "; | 1976 static const String PROXY_PREFIX = "PROXY "; |
| 1977 static const String DIRECT_PREFIX = "DIRECT"; | 1977 static const String DIRECT_PREFIX = "DIRECT"; |
| 1978 | 1978 |
| 1979 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { | 1979 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { |
| 1980 if (configuration == null) { | 1980 if (configuration == null) { |
| 1981 throw new HttpException("Invalid proxy configuration $configuration"); | 1981 throw new HttpException("Invalid proxy configuration $configuration"); |
| 1982 } | 1982 } |
| 1983 List<String> list = configuration.split(";"); | 1983 List<String> list = configuration.split(";"); |
| 1984 list.forEach((String proxy) { | 1984 list.forEach((String proxy) { |
| 1985 proxy = proxy.trim(); | 1985 proxy = proxy.trim(); |
| 1986 if (!proxy.isEmpty()) { | 1986 if (!proxy.isEmpty()) { |
| 1987 if (proxy.startsWith(PROXY_PREFIX)) { | 1987 if (proxy.startsWith(PROXY_PREFIX)) { |
| 1988 int colon = proxy.indexOf(":"); | 1988 int colon = proxy.indexOf(":"); |
| 1989 if (colon == -1 || colon == 0 || colon == proxy.length - 1) { | 1989 if (colon == -1 || colon == 0 || colon == proxy.length - 1) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2003 } | 2003 } |
| 2004 proxies.add(new _Proxy(host, port)); | 2004 proxies.add(new _Proxy(host, port)); |
| 2005 } else if (proxy.trim() == DIRECT_PREFIX) { | 2005 } else if (proxy.trim() == DIRECT_PREFIX) { |
| 2006 proxies.add(new _Proxy.direct()); | 2006 proxies.add(new _Proxy.direct()); |
| 2007 } else { | 2007 } else { |
| 2008 throw new HttpException("Invalid proxy configuration $configuration"); | 2008 throw new HttpException("Invalid proxy configuration $configuration"); |
| 2009 } | 2009 } |
| 2010 } | 2010 } |
| 2011 }); | 2011 }); |
| 2012 } | 2012 } |
| 2013 |
| 2013 const _ProxyConfiguration.direct() | 2014 const _ProxyConfiguration.direct() |
| 2014 : proxies = const [const _Proxy.direct()]; | 2015 : proxies = const [const _Proxy.direct()]; |
| 2015 | 2016 |
| 2016 final List<_Proxy> proxies; | 2017 final List<_Proxy> proxies; |
| 2017 } | 2018 } |
| 2018 | 2019 |
| 2019 class _Proxy { | 2020 class _Proxy { |
| 2020 const _Proxy(this.host, this.port) : isDirect = false; | 2021 const _Proxy(this.host, this.port) : isDirect = false; |
| 2021 const _Proxy.direct() : host = null, port = null, isDirect = true; | 2022 const _Proxy.direct() : host = null, port = null, isDirect = true; |
| 2022 | 2023 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 | 2273 |
| 2273 | 2274 |
| 2274 class _RedirectInfo implements RedirectInfo { | 2275 class _RedirectInfo implements RedirectInfo { |
| 2275 const _RedirectInfo(int this.statusCode, | 2276 const _RedirectInfo(int this.statusCode, |
| 2276 String this.method, | 2277 String this.method, |
| 2277 Uri this.location); | 2278 Uri this.location); |
| 2278 final int statusCode; | 2279 final int statusCode; |
| 2279 final String method; | 2280 final String method; |
| 2280 final Uri location; | 2281 final Uri location; |
| 2281 } | 2282 } |
| OLD | NEW |