Chromium Code Reviews| Index: runtime/bin/http_impl.dart |
| =================================================================== |
| --- runtime/bin/http_impl.dart (revision 5451) |
| +++ runtime/bin/http_impl.dart (working copy) |
| @@ -626,7 +626,13 @@ |
| _server.onConnection = onConnection; |
| } |
| - void close() => _server.close(); |
| + void close() { |
| + _server.close(); |
| + for (_HttpConnection connection in _connections) { |
| + connection._socket.close(); |
| + } |
| + } |
| + |
| int get port() => _server.port; |
| void set onError(void handler(String errorMessage)) { |
| @@ -887,6 +893,7 @@ |
| _httpParser.headersComplete = () => _onHeadersComplete(); |
| _httpParser.dataReceived = (data) => _onDataReceived(data); |
| _httpParser.dataEnd = () => _onDataEnd(); |
| + onDisconnect = _onDisconnected; |
| } |
| HttpClientRequest open(String method, String uri) { |
| @@ -917,6 +924,7 @@ |
| } |
| void _onDataEnd() { |
| + onDisconnect = null; |
| if (_response.headers["connection"] == "close") { |
| _socket.close(); |
| } else { |
| @@ -935,6 +943,14 @@ |
| _onResponse = handler; |
| } |
| + void _onDisconnected() { |
|
Søren Gjesse
2012/03/14 09:26:59
We probably need to handle this slightly different
Anders Johnsen
2012/03/14 09:34:43
My initial understanding was that _onDataEnd was c
Søren Gjesse
2012/03/14 10:03:30
You are right this should be fixed in the HTTP par
Anders Johnsen
2012/03/14 10:08:54
Want me to make it a part of this cl, or is it som
|
| + if (_onErrorCallback !== null) { |
| + _onErrorCallback( |
| + new HttpException("Client disconnected before response was sent.")); |
|
Søren Gjesse
2012/03/14 09:26:59
"was sent" should probably be "was received".
Anders Johnsen
2012/03/14 09:34:43
Done.
|
| + } |
| + } |
| + |
| + |
| Function _onRequest; |
| Function _onResponse; |