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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « sdk/lib/io/file_impl.dart ('k') | 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) 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 _set("content-type", contentType.toString()); 181 _set("content-type", contentType.toString());
182 } 182 }
183 183
184 void _add(String name, Object value) { 184 void _add(String name, Object value) {
185 var lowerCaseName = name.toLowerCase(); 185 var lowerCaseName = name.toLowerCase();
186 // TODO(sgjesse): Add immutable state throw HttpException is immutable. 186 // TODO(sgjesse): Add immutable state throw HttpException is immutable.
187 if (lowerCaseName == "content-length") { 187 if (lowerCaseName == "content-length") {
188 if (value is int) { 188 if (value is int) {
189 contentLength = value; 189 contentLength = value;
190 } else if (value is String) { 190 } else if (value is String) {
191 contentLength = parseInt(value); 191 contentLength = int.parse(value);
192 } else { 192 } else {
193 throw new HttpException("Unexpected type for header named $name"); 193 throw new HttpException("Unexpected type for header named $name");
194 } 194 }
195 } else if (lowerCaseName == "transfer-encoding") { 195 } else if (lowerCaseName == "transfer-encoding") {
196 if (value == "chunked") { 196 if (value == "chunked") {
197 chunkedTransferEncoding = true; 197 chunkedTransferEncoding = true;
198 } else { 198 } else {
199 _addValue(lowerCaseName, value); 199 _addValue(lowerCaseName, value);
200 } 200 }
201 } else if (lowerCaseName == "date") { 201 } else if (lowerCaseName == "date") {
(...skipping 28 matching lines...) Expand all
230 } else { 230 } else {
231 if (pos > 0) { 231 if (pos > 0) {
232 _host = value.substring(0, pos); 232 _host = value.substring(0, pos);
233 } else { 233 } else {
234 _host = null; 234 _host = null;
235 } 235 }
236 if (pos + 1 == value.length) { 236 if (pos + 1 == value.length) {
237 _port = HttpClient.DEFAULT_HTTP_PORT; 237 _port = HttpClient.DEFAULT_HTTP_PORT;
238 } else { 238 } else {
239 try { 239 try {
240 _port = parseInt(value.substring(pos + 1)); 240 _port = int.parse(value.substring(pos + 1));
241 } on FormatException catch (e) { 241 } on FormatException catch (e) {
242 _port = null; 242 _port = null;
243 } 243 }
244 } 244 }
245 } 245 }
246 _set("host", value); 246 _set("host", value);
247 } else if (lowerCaseName == "content-type") { 247 } else if (lowerCaseName == "content-type") {
248 _set("content-type", value); 248 _set("content-type", value);
249 } else { 249 } else {
250 _addValue(lowerCaseName, value); 250 _addValue(lowerCaseName, value);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 while (!done()) { 623 while (!done()) {
624 String name = parseAttributeName(); 624 String name = parseAttributeName();
625 String value = ""; 625 String value = "";
626 if (!done() && s[index] == "=") { 626 if (!done() && s[index] == "=") {
627 index++; // Skip the = character. 627 index++; // Skip the = character.
628 value = parseAttributeValue(); 628 value = parseAttributeValue();
629 } 629 }
630 if (name == "expires") { 630 if (name == "expires") {
631 expires = _HttpUtils.parseCookieDate(value); 631 expires = _HttpUtils.parseCookieDate(value);
632 } else if (name == "max-age") { 632 } else if (name == "max-age") {
633 maxAge = parseInt(value); 633 maxAge = int.parse(value);
634 } else if (name == "domain") { 634 } else if (name == "domain") {
635 domain = value; 635 domain = value;
636 } else if (name == "path") { 636 } else if (name == "path") {
637 path = value; 637 path = value;
638 } else if (name == "httponly") { 638 } else if (name == "httponly") {
639 httpOnly = true; 639 httpOnly = true;
640 } else if (name == "secure") { 640 } else if (name == "secure") {
641 secure = true; 641 secure = true;
642 } 642 }
643 if (!done()) index++; // Skip the ; character 643 if (!done()) index++; // Skip the ; character
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 683
684 String name; 684 String name;
685 String value; 685 String value;
686 Date expires; 686 Date 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 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698