| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; | 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; |
| 8 | 8 |
| 9 class _HttpIncoming extends Stream<List<int>> { | 9 class _HttpIncoming extends Stream<List<int>> { |
| 10 final int _transferLength; | 10 final int _transferLength; |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 Future writeHeaders({bool drainRequest: true, bool setOutgoing: true}) { | 933 Future writeHeaders({bool drainRequest: true, bool setOutgoing: true}) { |
| 934 Future write() { | 934 Future write() { |
| 935 try { | 935 try { |
| 936 outbound._writeHeader(); | 936 outbound._writeHeader(); |
| 937 } catch (_) { | 937 } catch (_) { |
| 938 // Headers too large. | 938 // Headers too large. |
| 939 return new Future.error(new HttpException( | 939 return new Future.error(new HttpException( |
| 940 "Headers size exceeded the of '$_OUTGOING_BUFFER_SIZE'" | 940 "Headers size exceeded the of '$_OUTGOING_BUFFER_SIZE'" |
| 941 " bytes")); | 941 " bytes")); |
| 942 } | 942 } |
| 943 return null; | |
| 944 } | 943 } |
| 945 if (headersWritten) return null; | 944 if (headersWritten) return null; |
| 946 headersWritten = true; | 945 headersWritten = true; |
| 947 Future drainFuture; | 946 Future drainFuture; |
| 948 bool isServerSide = outbound is _HttpResponse; | 947 bool isServerSide = outbound is _HttpResponse; |
| 949 bool gzip = false; | 948 bool gzip = false; |
| 950 if (isServerSide) { | 949 if (isServerSide) { |
| 951 var response = outbound; | 950 var response = outbound; |
| 952 if (response._httpRequest._httpServer.autoCompress && | 951 if (response._httpRequest._httpServer.autoCompress && |
| 953 outbound.bufferOutput && | 952 outbound.bufferOutput && |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1907 | 1906 |
| 1908 _ProxyCredentials _findProxyCredentials(_Proxy proxy, | 1907 _ProxyCredentials _findProxyCredentials(_Proxy proxy, |
| 1909 [_AuthenticationScheme scheme]) { | 1908 [_AuthenticationScheme scheme]) { |
| 1910 // Look for credentials. | 1909 // Look for credentials. |
| 1911 var it = _proxyCredentials.iterator; | 1910 var it = _proxyCredentials.iterator; |
| 1912 while (it.moveNext()) { | 1911 while (it.moveNext()) { |
| 1913 if (it.current.applies(proxy, scheme)) { | 1912 if (it.current.applies(proxy, scheme)) { |
| 1914 return it.current; | 1913 return it.current; |
| 1915 } | 1914 } |
| 1916 } | 1915 } |
| 1917 | |
| 1918 return null; | |
| 1919 } | 1916 } |
| 1920 | 1917 |
| 1921 void _removeCredentials(_Credentials cr) { | 1918 void _removeCredentials(_Credentials cr) { |
| 1922 int index = _credentials.indexOf(cr); | 1919 int index = _credentials.indexOf(cr); |
| 1923 if (index != -1) { | 1920 if (index != -1) { |
| 1924 _credentials.removeAt(index); | 1921 _credentials.removeAt(index); |
| 1925 } | 1922 } |
| 1926 } | 1923 } |
| 1927 | 1924 |
| 1928 void _removeProxyCredentials(_Credentials cr) { | 1925 void _removeProxyCredentials(_Credentials cr) { |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2819 const _RedirectInfo(this.statusCode, this.method, this.location); | 2816 const _RedirectInfo(this.statusCode, this.method, this.location); |
| 2820 } | 2817 } |
| 2821 | 2818 |
| 2822 String _getHttpVersion() { | 2819 String _getHttpVersion() { |
| 2823 var version = Platform.version; | 2820 var version = Platform.version; |
| 2824 // Only include major and minor version numbers. | 2821 // Only include major and minor version numbers. |
| 2825 int index = version.indexOf('.', version.indexOf('.') + 1); | 2822 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2826 version = version.substring(0, index); | 2823 version = version.substring(0, index); |
| 2827 return 'Dart/$version (dart:io)'; | 2824 return 'Dart/$version (dart:io)'; |
| 2828 } | 2825 } |
| OLD | NEW |