Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: sdk/lib/io/http_impl.dart

Issue 12300017: Throw an error when we redirect on a non-persistent connection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/http_redirect_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // The close queue handles graceful closing of HTTP connections. When 7 // The close queue handles graceful closing of HTTP connections. When
8 // a connection is added to the queue it will enter a wait state 8 // a connection is added to the queue it will enter a wait state
9 // waiting for all data written and possibly socket shutdown from 9 // waiting for all data written and possibly socket shutdown from
10 // peer. 10 // peer.
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 // Check for redirect loop 1352 // Check for redirect loop
1353 if (_connection._redirects != null) { 1353 if (_connection._redirects != null) {
1354 Uri redirectUrl = Uri.parse(location[0]); 1354 Uri redirectUrl = Uri.parse(location[0]);
1355 for (int i = 0; i < _connection._redirects.length; i++) { 1355 for (int i = 0; i < _connection._redirects.length; i++) {
1356 if (_connection._redirects[i].location.toString() == 1356 if (_connection._redirects[i].location.toString() ==
1357 redirectUrl.toString()) { 1357 redirectUrl.toString()) {
1358 throw new RedirectLoopException(_connection._redirects); 1358 throw new RedirectLoopException(_connection._redirects);
1359 } 1359 }
1360 } 1360 }
1361 } 1361 }
1362 if (!persistentConnection) {
1363 throw new RedirectException(
1364 "Non-persistent connections are currently not supported for "
1365 "redirects", _connection._redirects);
1366 }
1362 // Drain body and redirect. 1367 // Drain body and redirect.
1363 inputStream.onData = inputStream.read; 1368 inputStream.onData = inputStream.read;
1364 if (_statusCode == HttpStatus.SEE_OTHER && 1369 if (_statusCode == HttpStatus.SEE_OTHER &&
1365 _connection._method == "POST") { 1370 _connection._method == "POST") {
1366 _connection.redirect("GET"); 1371 _connection.redirect("GET");
1367 } else { 1372 } else {
1368 _connection.redirect(); 1373 _connection.redirect();
1369 } 1374 }
1370 } else { 1375 } else {
1371 throw new RedirectLimitExceededException(_connection._redirects); 1376 throw new RedirectLimitExceededException(_connection._redirects);
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 2330
2326 2331
2327 class _RedirectInfo implements RedirectInfo { 2332 class _RedirectInfo implements RedirectInfo {
2328 const _RedirectInfo(int this.statusCode, 2333 const _RedirectInfo(int this.statusCode,
2329 String this.method, 2334 String this.method,
2330 Uri this.location); 2335 Uri this.location);
2331 final int statusCode; 2336 final int statusCode;
2332 final String method; 2337 final String method;
2333 final Uri location; 2338 final Uri location;
2334 } 2339 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/http_redirect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698