Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: sdk/lib/io/http_headers.dart

Issue 12383048: Improve support for HTTP 1.0 clients (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void remove(String name, Object value) { 44 void remove(String name, Object value) {
45 _checkMutable(); 45 _checkMutable();
46 name = name.toLowerCase(); 46 name = name.toLowerCase();
47 List<String> values = _headers[name]; 47 List<String> values = _headers[name];
48 if (values != null) { 48 if (values != null) {
49 int index = values.indexOf(value); 49 int index = values.indexOf(value);
50 if (index != -1) { 50 if (index != -1) {
51 values.removeRange(index, 1); 51 values.removeRange(index, 1);
52 } 52 }
53 if (values.length == 0) _headers.remove(name);
53 } 54 }
54 } 55 }
55 56
56 void removeAll(String name) { 57 void removeAll(String name) {
57 _checkMutable(); 58 _checkMutable();
58 name = name.toLowerCase(); 59 name = name.toLowerCase();
59 _headers.remove(name); 60 _headers.remove(name);
60 } 61 }
61 62
62 void forEach(void f(String name, List<String> values)) { 63 void forEach(void f(String name, List<String> values)) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 (_noFoldingHeaders != null && 316 (_noFoldingHeaders != null &&
316 _noFoldingHeaders.indexOf(name) != -1)) { 317 _noFoldingHeaders.indexOf(name) != -1)) {
317 return false; 318 return false;
318 } 319 }
319 return true; 320 return true;
320 } 321 }
321 322
322 void _finalize() { 323 void _finalize() {
323 // If the content length is not known make sure chunked transfer 324 // If the content length is not known make sure chunked transfer
324 // encoding is used for HTTP 1.1. 325 // encoding is used for HTTP 1.1.
325 if (contentLength < 0 && protocolVersion == "1.1") { 326 if (contentLength < 0) {
326 chunkedTransferEncoding = true; 327 if (protocolVersion == "1.0") {
328 persistentConnection = false;
329 } else {
330 chunkedTransferEncoding = true;
331 }
327 } 332 }
328 // If a Transfer-Encoding header field is present the 333 // If a Transfer-Encoding header field is present the
329 // Content-Length header MUST NOT be sent (RFC 2616 section 4.4). 334 // Content-Length header MUST NOT be sent (RFC 2616 section 4.4).
330 if (chunkedTransferEncoding && 335 if (chunkedTransferEncoding &&
331 contentLength >= 0 && 336 contentLength >= 0 &&
332 protocolVersion == "1.1") { 337 protocolVersion == "1.1") {
333 contentLength = -1; 338 contentLength = -1;
334 } 339 }
335 _mutable = false; 340 _mutable = false;
336 } 341 }
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 783
779 String name; 784 String name;
780 String value; 785 String value;
781 DateTime expires; 786 DateTime expires;
782 int maxAge; 787 int maxAge;
783 String domain; 788 String domain;
784 String path; 789 String path;
785 bool httpOnly = false; 790 bool httpOnly = false;
786 bool secure = false; 791 bool secure = false;
787 } 792 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698