| OLD | NEW |
| 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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
| 8 final int _transferLength; | 8 final int _transferLength; |
| 9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
| 10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (_headersWritten) throw new StateError("Header already sent"); | 438 if (_headersWritten) throw new StateError("Header already sent"); |
| 439 _reasonPhrase = reasonPhrase; | 439 _reasonPhrase = reasonPhrase; |
| 440 } | 440 } |
| 441 | 441 |
| 442 Future<Socket> detachSocket() { | 442 Future<Socket> detachSocket() { |
| 443 if (_headersWritten) throw new StateError("Headers already sent"); | 443 if (_headersWritten) throw new StateError("Headers already sent"); |
| 444 _writeHeaders(); | 444 _writeHeaders(); |
| 445 var future = _httpRequest._httpConnection.detachSocket(); | 445 var future = _httpRequest._httpConnection.detachSocket(); |
| 446 // Close connection so the socket is 'free'. | 446 // Close connection so the socket is 'free'. |
| 447 close(); | 447 close(); |
| 448 done.catchError((_) { |
| 449 // Catch any error on done, as they automatically will be propegated to |
| 450 // the websocket. |
| 451 }); |
| 448 return future; | 452 return future; |
| 449 } | 453 } |
| 450 | 454 |
| 451 HttpConnectionInfo get connectionInfo => _httpRequest.connectionInfo; | 455 HttpConnectionInfo get connectionInfo => _httpRequest.connectionInfo; |
| 452 | 456 |
| 453 void _writeHeader() { | 457 void _writeHeader() { |
| 454 writeSP() => add([_CharCode.SP]); | 458 writeSP() => add([_CharCode.SP]); |
| 455 writeCRLF() => add([_CharCode.CR, _CharCode.LF]); | 459 writeCRLF() => add([_CharCode.CR, _CharCode.LF]); |
| 456 | 460 |
| 457 // Write status line. | 461 // Write status line. |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 | 1639 |
| 1636 | 1640 |
| 1637 class _RedirectInfo implements RedirectInfo { | 1641 class _RedirectInfo implements RedirectInfo { |
| 1638 const _RedirectInfo(int this.statusCode, | 1642 const _RedirectInfo(int this.statusCode, |
| 1639 String this.method, | 1643 String this.method, |
| 1640 Uri this.location); | 1644 Uri this.location); |
| 1641 final int statusCode; | 1645 final int statusCode; |
| 1642 final String method; | 1646 final String method; |
| 1643 final Uri location; | 1647 final Uri location; |
| 1644 } | 1648 } |
| OLD | NEW |