| Index: sdk/lib/io/http_headers.dart
|
| diff --git a/sdk/lib/io/http_headers.dart b/sdk/lib/io/http_headers.dart
|
| index b2b522b3b3e900f84131bb909c9efb8d2feb9c02..272eada9f23ab359d949f4cf6fcc479acf447ece 100644
|
| --- a/sdk/lib/io/http_headers.dart
|
| +++ b/sdk/lib/io/http_headers.dart
|
| @@ -350,7 +350,7 @@ class _HttpHeaders implements HttpHeaders {
|
| var bufferPos = 0;
|
|
|
| void writeBuffer() {
|
| - sink.add(buffer.getRange(0, bufferPos));
|
| + sink.writeBytes(buffer.getRange(0, bufferPos));
|
| bufferPos = 0;
|
| }
|
|
|
| @@ -621,6 +621,9 @@ class _HeaderValue implements HeaderValue {
|
|
|
|
|
| class _ContentType extends _HeaderValue implements ContentType {
|
| + String _primaryType = "";
|
| + String _subType = "";
|
| +
|
| _ContentType(String primaryType,
|
| String subType,
|
| String charset,
|
| @@ -639,7 +642,7 @@ class _ContentType extends _HeaderValue implements ContentType {
|
| }
|
| }
|
|
|
| - _ContentType.fromString(String value) : super.fromString(value) {
|
| + _ContentType.fromString(String value) : super.fromString(value) {
|
| int index = _value.indexOf("/");
|
| if (index == -1 || index == (_value.length - 1)) {
|
| _primaryType = _value.trim().toLowerCase();
|
| @@ -656,8 +659,20 @@ class _ContentType extends _HeaderValue implements ContentType {
|
|
|
| String get charset => parameters["charset"];
|
|
|
| - String _primaryType = "";
|
| - String _subType = "";
|
| + Encoding get encoding {
|
| + if (charset == null ||
|
| + charset == "iso-8859-1" ||
|
| + charset == "iso_8859-1" ||
|
| + charset == "latin1") {
|
| + return Encoding.ISO_8859_1;
|
| + } else if (charset == "utf-8") {
|
| + return Encoding.UTF_8;
|
| + } else if (charset == "us-ascii") {
|
| + return Encoding.ASCII;
|
| + } else {
|
| + return null;
|
| + }
|
| + }
|
| }
|
|
|
|
|
|
|