| 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 _HttpHeaders implements HttpHeaders { | 7 class _HttpHeaders implements HttpHeaders { |
| 8 _HttpHeaders(String this.protocolVersion) | 8 _HttpHeaders(String this.protocolVersion) |
| 9 : _headers = new Map<String, List<String>>(); | 9 : _headers = new Map<String, List<String>>(); |
| 10 | 10 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 protocolVersion == "1.1") { | 337 protocolVersion == "1.1") { |
| 338 contentLength = -1; | 338 contentLength = -1; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 void _finalize() { | 342 void _finalize() { |
| 343 _synchronize(); | 343 _synchronize(); |
| 344 _mutable = false; | 344 _mutable = false; |
| 345 } | 345 } |
| 346 | 346 |
| 347 _write(_BufferList buffer) { | 347 _write(BytesBuilder builder) { |
| 348 final COLONSP = const [_CharCode.COLON, _CharCode.SP]; | 348 final COLONSP = const [_CharCode.COLON, _CharCode.SP]; |
| 349 final COMMASP = const [_CharCode.COMMA, _CharCode.SP]; | 349 final COMMASP = const [_CharCode.COMMA, _CharCode.SP]; |
| 350 final CRLF = const [_CharCode.CR, _CharCode.LF]; | 350 final CRLF = const [_CharCode.CR, _CharCode.LF]; |
| 351 | 351 |
| 352 // Format headers. | 352 // Format headers. |
| 353 _headers.forEach((String name, List<String> values) { | 353 _headers.forEach((String name, List<String> values) { |
| 354 bool fold = _foldHeader(name); | 354 bool fold = _foldHeader(name); |
| 355 var nameData = name.codeUnits; | 355 var nameData = name.codeUnits; |
| 356 buffer.add(nameData); | 356 builder.add(nameData); |
| 357 buffer.add(const [_CharCode.COLON, _CharCode.SP]); | 357 builder.add(const [_CharCode.COLON, _CharCode.SP]); |
| 358 for (int i = 0; i < values.length; i++) { | 358 for (int i = 0; i < values.length; i++) { |
| 359 if (i > 0) { | 359 if (i > 0) { |
| 360 if (fold) { | 360 if (fold) { |
| 361 buffer.add(const [_CharCode.COMMA, _CharCode.SP]); | 361 builder.add(const [_CharCode.COMMA, _CharCode.SP]); |
| 362 } else { | 362 } else { |
| 363 buffer.add(const [_CharCode.CR, _CharCode.LF]); | 363 builder.add(const [_CharCode.CR, _CharCode.LF]); |
| 364 buffer.add(nameData); | 364 builder.add(nameData); |
| 365 buffer.add(const [_CharCode.COLON, _CharCode.SP]); | 365 builder.add(const [_CharCode.COLON, _CharCode.SP]); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 buffer.add(values[i].codeUnits); | 368 builder.add(values[i].codeUnits); |
| 369 } | 369 } |
| 370 buffer.add(const [_CharCode.CR, _CharCode.LF]); | 370 builder.add(const [_CharCode.CR, _CharCode.LF]); |
| 371 }); | 371 }); |
| 372 } | 372 } |
| 373 | 373 |
| 374 String toString() { | 374 String toString() { |
| 375 StringBuffer sb = new StringBuffer(); | 375 StringBuffer sb = new StringBuffer(); |
| 376 _headers.forEach((String name, List<String> values) { | 376 _headers.forEach((String name, List<String> values) { |
| 377 sb.write(name); | 377 sb.write(name); |
| 378 sb.write(": "); | 378 sb.write(": "); |
| 379 bool fold = _foldHeader(name); | 379 bool fold = _foldHeader(name); |
| 380 for (int i = 0; i < values.length; i++) { | 380 for (int i = 0; i < values.length; i++) { |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 | 771 |
| 772 String name; | 772 String name; |
| 773 String value; | 773 String value; |
| 774 DateTime expires; | 774 DateTime expires; |
| 775 int maxAge; | 775 int maxAge; |
| 776 String domain; | 776 String domain; |
| 777 String path; | 777 String path; |
| 778 bool httpOnly = false; | 778 bool httpOnly = false; |
| 779 bool secure = false; | 779 bool secure = false; |
| 780 } | 780 } |
| OLD | NEW |