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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 if (location == null || location.length > 1) { | 1186 if (location == null || location.length > 1) { |
1187 throw new RedirectException("Invalid redirect", | 1187 throw new RedirectException("Invalid redirect", |
1188 _connection._redirects); | 1188 _connection._redirects); |
1189 } | 1189 } |
1190 // Check for redirect loop | 1190 // Check for redirect loop |
1191 if (_connection._redirects != null) { | 1191 if (_connection._redirects != null) { |
1192 Uri redirectUrl = new Uri.fromString(location[0]); | 1192 Uri redirectUrl = new Uri.fromString(location[0]); |
1193 for (int i = 0; i < _connection._redirects.length; i++) { | 1193 for (int i = 0; i < _connection._redirects.length; i++) { |
1194 if (_connection._redirects[i].location.toString() == | 1194 if (_connection._redirects[i].location.toString() == |
1195 redirectUrl.toString()) { | 1195 redirectUrl.toString()) { |
1196 throw new RedirectLoop(_connection._redirects); | 1196 throw new RedirectLoopException(_connection._redirects); |
1197 } | 1197 } |
1198 } | 1198 } |
1199 } | 1199 } |
1200 // Drain body and redirect. | 1200 // Drain body and redirect. |
1201 inputStream.onData = inputStream.read; | 1201 inputStream.onData = inputStream.read; |
1202 inputStream.onClosed = _connection.redirect; | 1202 inputStream.onClosed = _connection.redirect; |
1203 } else { | 1203 } else { |
1204 throw new RedirectLimitExceeded(_connection._redirects); | 1204 throw new RedirectLimitExceededException(_connection._redirects); |
1205 } | 1205 } |
1206 } else if (_connection._onResponse != null) { | 1206 } else if (_connection._onResponse != null) { |
1207 _connection._onResponse(this); | 1207 _connection._onResponse(this); |
1208 } | 1208 } |
1209 } | 1209 } |
1210 | 1210 |
1211 void _onDataReceived(List<int> data) { | 1211 void _onDataReceived(List<int> data) { |
1212 _buffer.add(data); | 1212 _buffer.add(data); |
1213 if (_inputStream != null) _inputStream._dataReceived(); | 1213 if (_inputStream != null) _inputStream._dataReceived(); |
1214 } | 1214 } |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 | 1631 |
1632 | 1632 |
1633 class _RedirectInfo implements RedirectInfo { | 1633 class _RedirectInfo implements RedirectInfo { |
1634 const _RedirectInfo(int this.statusCode, | 1634 const _RedirectInfo(int this.statusCode, |
1635 String this.method, | 1635 String this.method, |
1636 Uri this.location); | 1636 Uri this.location); |
1637 final int statusCode; | 1637 final int statusCode; |
1638 final String method; | 1638 final String method; |
1639 final Uri location; | 1639 final Uri location; |
1640 } | 1640 } |
OLD | NEW |