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

Side by Side Diff: runtime/bin/http_impl.dart

Issue 10908121: Do not close sockets for http connection fully before we are (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/standalone.status » ('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) 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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 if (_request != null && _request._streamErrorHandler != null) { 1343 if (_request != null && _request._streamErrorHandler != null) {
1344 _request._streamErrorHandler(e); 1344 _request._streamErrorHandler(e);
1345 } 1345 }
1346 if (_response != null && _response._streamErrorHandler != null) { 1346 if (_response != null && _response._streamErrorHandler != null) {
1347 _response._streamErrorHandler(e); 1347 _response._streamErrorHandler(e);
1348 } 1348 }
1349 } 1349 }
1350 1350
1351 // If currently not processing any request just close the socket. 1351 // If currently not processing any request just close the socket.
1352 if (_httpParser.isIdle) { 1352 if (_httpParser.isIdle) {
1353 _destroy(); 1353 _socket.outputStream.onClosed = () {
1354 if (onClosed != null && e == null) { 1354 _destroy();
1355 // Don't call onClosed if onError has been called. 1355 if (onClosed != null && e == null) {
1356 onClosed(); 1356 // Don't call onClosed if onError has been called.
1357 } 1357 onClosed();
1358 }
1359 };
1358 return; 1360 return;
1359 } 1361 }
1360 1362
1361 // Processing a request. 1363 // Processing a request.
1362 if (e == null) { 1364 if (e == null) {
1363 // Indicate connection close to the HTTP parser. 1365 // Indicate connection close to the HTTP parser.
1364 _httpParser.connectionClosed(); 1366 _httpParser.connectionClosed();
1365 } 1367 }
1366 } 1368 }
1367 1369
(...skipping 28 matching lines...) Expand all
1396 } 1398 }
1397 1399
1398 void _onDataEnd(bool close) { 1400 void _onDataEnd(bool close) {
1399 _request._onDataEnd(); 1401 _request._onDataEnd();
1400 } 1402 }
1401 1403
1402 void _responseDone() { 1404 void _responseDone() {
1403 // If the connection is closing then close the output stream to 1405 // If the connection is closing then close the output stream to
1404 // fully close the socket. 1406 // fully close the socket.
1405 if (_closing) { 1407 if (_closing) {
1406 _socket.close(); 1408 _socket.outputStream.onClosed = () {
1409 _socket.close();
1410 };
1407 } 1411 }
1408 _response = null; 1412 _response = null;
1409 } 1413 }
1410 1414
1411 HttpServer _server; 1415 HttpServer _server;
1412 HttpRequest _request; 1416 HttpRequest _request;
1413 HttpResponse _response; 1417 HttpResponse _response;
1414 1418
1415 // Callbacks. 1419 // Callbacks.
1416 Function onRequestReceived; 1420 Function onRequestReceived;
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 2170
2167 2171
2168 class _RedirectInfo implements RedirectInfo { 2172 class _RedirectInfo implements RedirectInfo {
2169 const _RedirectInfo(int this.statusCode, 2173 const _RedirectInfo(int this.statusCode,
2170 String this.method, 2174 String this.method,
2171 Uri this.location); 2175 Uri this.location);
2172 final int statusCode; 2176 final int statusCode;
2173 final String method; 2177 final String method;
2174 final Uri location; 2178 final Uri location;
2175 } 2179 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698