| OLD | NEW |
| 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 class _HttpHeaders implements HttpHeaders { | 7 class _HttpHeaders implements HttpHeaders { |
| 8 _HttpHeaders() : _headers = new Map<String, List<String>>(); | 8 _HttpHeaders() : _headers = new Map<String, List<String>>(); |
| 9 | 9 |
| 10 List<String> operator[](String name) { | 10 List<String> operator[](String name) { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 317 |
| 318 void writeBuffer() { | 318 void writeBuffer() { |
| 319 connection._writeFrom(buffer, 0, bufferPos); | 319 connection._writeFrom(buffer, 0, bufferPos); |
| 320 bufferPos = 0; | 320 bufferPos = 0; |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Format headers. | 323 // Format headers. |
| 324 _headers.forEach((String name, List<String> values) { | 324 _headers.forEach((String name, List<String> values) { |
| 325 bool fold = _foldHeader(name); | 325 bool fold = _foldHeader(name); |
| 326 List<int> nameData; | 326 List<int> nameData; |
| 327 nameData = name.charCodes; | 327 nameData = name.codeUnits; |
| 328 int nameDataLen = nameData.length; | 328 int nameDataLen = nameData.length; |
| 329 if (nameDataLen + 2 > bufferSize - bufferPos) writeBuffer(); | 329 if (nameDataLen + 2 > bufferSize - bufferPos) writeBuffer(); |
| 330 buffer.setRange(bufferPos, nameDataLen, nameData); | 330 buffer.setRange(bufferPos, nameDataLen, nameData); |
| 331 bufferPos += nameDataLen; | 331 bufferPos += nameDataLen; |
| 332 buffer[bufferPos++] = _CharCode.COLON; | 332 buffer[bufferPos++] = _CharCode.COLON; |
| 333 buffer[bufferPos++] = _CharCode.SP; | 333 buffer[bufferPos++] = _CharCode.SP; |
| 334 for (int i = 0; i < values.length; i++) { | 334 for (int i = 0; i < values.length; i++) { |
| 335 List<int> data = values[i].charCodes; | 335 List<int> data = values[i].codeUnits; |
| 336 int dataLen = data.length; | 336 int dataLen = data.length; |
| 337 // Worst case here is writing the name, value and 6 additional bytes. | 337 // Worst case here is writing the name, value and 6 additional bytes. |
| 338 if (nameDataLen + dataLen + 6 > bufferSize - bufferPos) writeBuffer(); | 338 if (nameDataLen + dataLen + 6 > bufferSize - bufferPos) writeBuffer(); |
| 339 if (i > 0) { | 339 if (i > 0) { |
| 340 if (fold) { | 340 if (fold) { |
| 341 buffer[bufferPos++] = _CharCode.COMMA; | 341 buffer[bufferPos++] = _CharCode.COMMA; |
| 342 buffer[bufferPos++] = _CharCode.SP; | 342 buffer[bufferPos++] = _CharCode.SP; |
| 343 } else { | 343 } else { |
| 344 buffer[bufferPos++] = _CharCode.CR; | 344 buffer[bufferPos++] = _CharCode.CR; |
| 345 buffer[bufferPos++] = _CharCode.LF; | 345 buffer[bufferPos++] = _CharCode.LF; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 String name; | 684 String name; |
| 685 String value; | 685 String value; |
| 686 DateTime expires; | 686 DateTime expires; |
| 687 int maxAge; | 687 int maxAge; |
| 688 String domain; | 688 String domain; |
| 689 String path; | 689 String path; |
| 690 bool httpOnly = false; | 690 bool httpOnly = false; |
| 691 bool secure = false; | 691 bool secure = false; |
| 692 } | 692 } |
| OLD | NEW |