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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 308923002: When a connection is upgraded, don't return it as idle. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/http_detach_socket_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 5b991260bf79d6a5e8286244ec0efaf05cd3cc2a..720a4075660bb5c5246fc2652041d34e419d4f3f 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -262,6 +262,13 @@ class _HttpClientResponse
{Function onError,
void onDone(),
bool cancelOnError}) {
+ if (_incoming.upgraded) {
+ // If upgraded, the connection is already 'removed' form the client.
+ // Since listening to upgraded data is 'bogus', simply close and
+ // return empty stream subscription.
+ _httpRequest._httpClientConnection.destroy();
+ return new Stream.fromIterable([]).listen(null, onDone: onDone);
+ }
var stream = _incoming;
if (headers.value(HttpHeaders.CONTENT_ENCODING) == "gzip") {
stream = stream.transform(GZIP.decoder);
@@ -1359,6 +1366,11 @@ class _HttpClientConnection {
.then((incoming) {
_currentUri = null;
incoming.dataDone.then((closing) {
+ if (incoming.upgraded) {
+ _httpClient._connectionClosed(this);
+ startTimer();
+ return;
+ }
if (closed) return;
if (!closing &&
!_dispose &&
« no previous file with comments | « no previous file | tests/standalone/io/http_detach_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698