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; |
943 } | 944 } |
944 if (headersWritten) return null; | 945 if (headersWritten) return null; |
945 headersWritten = true; | 946 headersWritten = true; |
946 Future drainFuture; | 947 Future drainFuture; |
947 bool isServerSide = outbound is _HttpResponse; | 948 bool isServerSide = outbound is _HttpResponse; |
948 bool gzip = false; | 949 bool gzip = false; |
949 if (isServerSide) { | 950 if (isServerSide) { |
950 var response = outbound; | 951 var response = outbound; |
951 if (response._httpRequest._httpServer.autoCompress && | 952 if (response._httpRequest._httpServer.autoCompress && |
952 outbound.bufferOutput && | 953 outbound.bufferOutput && |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 | 1903 |
1903 _ProxyCredentials _findProxyCredentials(_Proxy proxy, | 1904 _ProxyCredentials _findProxyCredentials(_Proxy proxy, |
1904 [_AuthenticationScheme scheme]) { | 1905 [_AuthenticationScheme scheme]) { |
1905 // Look for credentials. | 1906 // Look for credentials. |
1906 var it = _proxyCredentials.iterator; | 1907 var it = _proxyCredentials.iterator; |
1907 while (it.moveNext()) { | 1908 while (it.moveNext()) { |
1908 if (it.current.applies(proxy, scheme)) { | 1909 if (it.current.applies(proxy, scheme)) { |
1909 return it.current; | 1910 return it.current; |
1910 } | 1911 } |
1911 } | 1912 } |
| 1913 |
| 1914 return null; |
1912 } | 1915 } |
1913 | 1916 |
1914 void _removeCredentials(_Credentials cr) { | 1917 void _removeCredentials(_Credentials cr) { |
1915 int index = _credentials.indexOf(cr); | 1918 int index = _credentials.indexOf(cr); |
1916 if (index != -1) { | 1919 if (index != -1) { |
1917 _credentials.removeAt(index); | 1920 _credentials.removeAt(index); |
1918 } | 1921 } |
1919 } | 1922 } |
1920 | 1923 |
1921 void _removeProxyCredentials(_Credentials cr) { | 1924 void _removeProxyCredentials(_Credentials cr) { |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 const _RedirectInfo(this.statusCode, this.method, this.location); | 2819 const _RedirectInfo(this.statusCode, this.method, this.location); |
2817 } | 2820 } |
2818 | 2821 |
2819 String _getHttpVersion() { | 2822 String _getHttpVersion() { |
2820 var version = Platform.version; | 2823 var version = Platform.version; |
2821 // Only include major and minor version numbers. | 2824 // Only include major and minor version numbers. |
2822 int index = version.indexOf('.', version.indexOf('.') + 1); | 2825 int index = version.indexOf('.', version.indexOf('.') + 1); |
2823 version = version.substring(0, index); | 2826 version = version.substring(0, index); |
2824 return 'Dart/$version (dart:io)'; | 2827 return 'Dart/$version (dart:io)'; |
2825 } | 2828 } |
OLD | NEW |