| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 393 | 393 | 
| 394   void writeln([Object obj = ""]) { | 394   void writeln([Object obj = ""]) { | 
| 395     write(obj); | 395     write(obj); | 
| 396     write("\n"); | 396     write("\n"); | 
| 397   } | 397   } | 
| 398 | 398 | 
| 399   void writeCharCode(int charCode) { | 399   void writeCharCode(int charCode) { | 
| 400     write(new String.fromCharCode(charCode)); | 400     write(new String.fromCharCode(charCode)); | 
| 401   } | 401   } | 
| 402 | 402 | 
| 403   void writeBytes(List<int> data) { | 403   void add(List<int> data) { | 
| 404     _writeHeaders(); | 404     _writeHeaders(); | 
| 405     if (data.length == 0) return; | 405     if (data.length == 0) return; | 
| 406     _ioSink.writeBytes(data); | 406     _ioSink.add(data); | 
|  | 407   } | 
|  | 408 | 
|  | 409   void addError(AsyncError error) { | 
|  | 410     _writeHeaders(); | 
|  | 411     _ioSink.addError(error); | 
| 407   } | 412   } | 
| 408 | 413 | 
| 409   Future<T> consume(Stream<List<int>> stream) { | 414   Future<T> consume(Stream<List<int>> stream) { | 
| 410     _writeHeaders(); | 415     _writeHeaders(); | 
| 411     return _ioSink.consume(stream); | 416     return _ioSink.consume(stream); | 
| 412   } | 417   } | 
| 413 | 418 | 
| 414   Future<T> addStream(Stream<List<int>> stream) { | 419   Future<T> addStream(Stream<List<int>> stream) { | 
| 415     _writeHeaders(); | 420     _writeHeaders(); | 
| 416     return _ioSink.writeStream(stream).then((_) => this); | 421     return _ioSink.writeStream(stream).then((_) => this); | 
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 620       _cookies.forEach((cookie) { | 625       _cookies.forEach((cookie) { | 
| 621         headers.add(HttpHeaders.SET_COOKIE, cookie); | 626         headers.add(HttpHeaders.SET_COOKIE, cookie); | 
| 622       }); | 627       }); | 
| 623     } | 628     } | 
| 624 | 629 | 
| 625     headers._finalize(); | 630     headers._finalize(); | 
| 626 | 631 | 
| 627     // Write headers. | 632     // Write headers. | 
| 628     headers._write(buffer); | 633     headers._write(buffer); | 
| 629     writeCRLF(); | 634     writeCRLF(); | 
| 630     _ioSink.writeBytes(buffer.readBytes()); | 635     _ioSink.add(buffer.readBytes()); | 
| 631   } | 636   } | 
| 632 | 637 | 
| 633   String _findReasonPhrase(int statusCode) { | 638   String _findReasonPhrase(int statusCode) { | 
| 634     if (_reasonPhrase != null) { | 639     if (_reasonPhrase != null) { | 
| 635       return _reasonPhrase; | 640       return _reasonPhrase; | 
| 636     } | 641     } | 
| 637 | 642 | 
| 638     switch (statusCode) { | 643     switch (statusCode) { | 
| 639       case HttpStatus.CONTINUE: return "Continue"; | 644       case HttpStatus.CONTINUE: return "Continue"; | 
| 640       case HttpStatus.SWITCHING_PROTOCOLS: return "Switching Protocols"; | 645       case HttpStatus.SWITCHING_PROTOCOLS: return "Switching Protocols"; | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 825         sb.write(cookies[i].value); | 830         sb.write(cookies[i].value); | 
| 826       } | 831       } | 
| 827       headers.add(HttpHeaders.COOKIE, sb.toString()); | 832       headers.add(HttpHeaders.COOKIE, sb.toString()); | 
| 828     } | 833     } | 
| 829 | 834 | 
| 830     headers._finalize(); | 835     headers._finalize(); | 
| 831 | 836 | 
| 832     // Write headers. | 837     // Write headers. | 
| 833     headers._write(buffer); | 838     headers._write(buffer); | 
| 834     writeCRLF(); | 839     writeCRLF(); | 
| 835     _ioSink.writeBytes(buffer.readBytes()); | 840     _ioSink.add(buffer.readBytes()); | 
| 836   } | 841   } | 
| 837 } | 842 } | 
| 838 | 843 | 
| 839 | 844 | 
| 840 // Transformer that transforms data to HTTP Chunked Encoding. | 845 // Transformer that transforms data to HTTP Chunked Encoding. | 
| 841 class _ChunkedTransformer extends StreamEventTransformer<List<int>, List<int>> { | 846 class _ChunkedTransformer extends StreamEventTransformer<List<int>, List<int>> { | 
| 842   void handleData(List<int> data, EventSink<List<int>> sink) { | 847   void handleData(List<int> data, EventSink<List<int>> sink) { | 
| 843     sink.add(_chunkHeader(data.length)); | 848     sink.add(_chunkHeader(data.length)); | 
| 844     if (data.length > 0) sink.add(data); | 849     if (data.length > 0) sink.add(data); | 
| 845     sink.add(_chunkFooter); | 850     sink.add(_chunkFooter); | 
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1674   void write(Object obj) => _socket.write(obj); | 1679   void write(Object obj) => _socket.write(obj); | 
| 1675 | 1680 | 
| 1676   void writeln([Object obj = ""]) => _socket.writeln(obj); | 1681   void writeln([Object obj = ""]) => _socket.writeln(obj); | 
| 1677 | 1682 | 
| 1678   void writeCharCode(int charCode) => _socket.writeCharCode(charCode); | 1683   void writeCharCode(int charCode) => _socket.writeCharCode(charCode); | 
| 1679 | 1684 | 
| 1680   void writeAll(Iterable objects, [String separator = ""]) { | 1685   void writeAll(Iterable objects, [String separator = ""]) { | 
| 1681     _socket.writeAll(objects, separator); | 1686     _socket.writeAll(objects, separator); | 
| 1682   } | 1687   } | 
| 1683 | 1688 | 
| 1684   void writeBytes(List<int> bytes) => _socket.writeBytes(bytes); | 1689   void add(List<int> bytes) => _socket.add(bytes); | 
|  | 1690 | 
|  | 1691   void addError(AsyncError error) => _socket.addError(error); | 
| 1685 | 1692 | 
| 1686   Future<Socket> consume(Stream<List<int>> stream) { | 1693   Future<Socket> consume(Stream<List<int>> stream) { | 
| 1687     return _socket.consume(stream); | 1694     return _socket.consume(stream); | 
| 1688   } | 1695   } | 
| 1689 | 1696 | 
| 1690   Future<Socket> addStream(Stream<List<int>> stream) { | 1697   Future<Socket> addStream(Stream<List<int>> stream) { | 
| 1691     return _socket.addStream(stream); | 1698     return _socket.addStream(stream); | 
| 1692   } | 1699   } | 
| 1693 | 1700 | 
| 1694   Future<Socket> writeStream(Stream<List<int>> stream) { | 1701   Future<Socket> writeStream(Stream<List<int>> stream) { | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1818 | 1825 | 
| 1819 | 1826 | 
| 1820 class _RedirectInfo implements RedirectInfo { | 1827 class _RedirectInfo implements RedirectInfo { | 
| 1821   const _RedirectInfo(int this.statusCode, | 1828   const _RedirectInfo(int this.statusCode, | 
| 1822                       String this.method, | 1829                       String this.method, | 
| 1823                       Uri this.location); | 1830                       Uri this.location); | 
| 1824   final int statusCode; | 1831   final int statusCode; | 
| 1825   final String method; | 1832   final String method; | 
| 1826   final Uri location; | 1833   final Uri location; | 
| 1827 } | 1834 } | 
| OLD | NEW | 
|---|