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

Side by Side Diff: runtime/bin/http_impl.dart

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 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 | « runtime/bin/file_impl.dart ('k') | runtime/bin/http_parser.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 class _HttpHeaders implements HttpHeaders { 5 class _HttpHeaders implements HttpHeaders {
6 _HttpHeaders() : _headers = new Map<String, List<String>>(); 6 _HttpHeaders() : _headers = new Map<String, List<String>>();
7 7
8 List<String> operator[](String name) { 8 List<String> operator[](String name) {
9 name = name.toLowerCase(); 9 name = name.toLowerCase();
10 return _headers[name]; 10 return _headers[name];
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } else { 186 } else {
187 if (pos > 0) { 187 if (pos > 0) {
188 _host = value.substring(0, pos); 188 _host = value.substring(0, pos);
189 } else { 189 } else {
190 _host = null; 190 _host = null;
191 } 191 }
192 if (pos + 1 == value.length) { 192 if (pos + 1 == value.length) {
193 _port = HttpClient.DEFAULT_HTTP_PORT; 193 _port = HttpClient.DEFAULT_HTTP_PORT;
194 } else { 194 } else {
195 try { 195 try {
196 _port = Math.parseInt(value.substring(pos + 1)); 196 _port = parseInt(value.substring(pos + 1));
197 } catch (FormatException e) { 197 } catch (FormatException e) {
198 _port = null; 198 _port = null;
199 } 199 }
200 } 200 }
201 _set("host", value); 201 _set("host", value);
202 } 202 }
203 } else if (name.toLowerCase() == "content-type") { 203 } else if (name.toLowerCase() == "content-type") {
204 _set("content-type", value); 204 _set("content-type", value);
205 } else { 205 } else {
206 name = name.toLowerCase(); 206 name = name.toLowerCase();
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 while (!done()) { 529 while (!done()) {
530 String name = parseAttributeName(); 530 String name = parseAttributeName();
531 String value = ""; 531 String value = "";
532 if (!done() && s[index] == "=") { 532 if (!done() && s[index] == "=") {
533 index++; // Skip the = character. 533 index++; // Skip the = character.
534 value = parseAttributeValue(); 534 value = parseAttributeValue();
535 } 535 }
536 if (name == "expires") { 536 if (name == "expires") {
537 expires = _HttpUtils.parseDate(value, strict: false); 537 expires = _HttpUtils.parseDate(value, strict: false);
538 } else if (name == "max-age") { 538 } else if (name == "max-age") {
539 maxAge = Math.parseInt(value); 539 maxAge = parseInt(value);
540 } else if (name == "domain") { 540 } else if (name == "domain") {
541 domain = value; 541 domain = value;
542 } else if (name == "path") { 542 } else if (name == "path") {
543 path = value; 543 path = value;
544 } else if (name == "httponly") { 544 } else if (name == "httponly") {
545 httpOnly = true; 545 httpOnly = true;
546 } else if (name == "secure") { 546 } else if (name == "secure") {
547 secure = true; 547 secure = true;
548 } 548 }
549 if (!done()) index++; // Skip the ; character 549 if (!done()) index++; // Skip the ; character
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 } 1681 }
1682 1682
1683 void _onResponseStart(int statusCode, String reasonPhrase, String version) { 1683 void _onResponseStart(int statusCode, String reasonPhrase, String version) {
1684 _statusCode = statusCode; 1684 _statusCode = statusCode;
1685 _reasonPhrase = reasonPhrase; 1685 _reasonPhrase = reasonPhrase;
1686 } 1686 }
1687 1687
1688 void _onHeaderReceived(String name, String value) { 1688 void _onHeaderReceived(String name, String value) {
1689 _headers.add(name, value); 1689 _headers.add(name, value);
1690 if (name == "content-length") { 1690 if (name == "content-length") {
1691 _contentLength = Math.parseInt(value); 1691 _contentLength = parseInt(value);
1692 } 1692 }
1693 } 1693 }
1694 1694
1695 void _onHeadersComplete() { 1695 void _onHeadersComplete() {
1696 _headers._mutable = false; 1696 _headers._mutable = false;
1697 _buffer = new _BufferList(); 1697 _buffer = new _BufferList();
1698 if (isRedirect && _connection.followRedirects) { 1698 if (isRedirect && _connection.followRedirects) {
1699 if (_connection._redirects == null || 1699 if (_connection._redirects == null ||
1700 _connection._redirects.length < _connection.maxRedirects) { 1700 _connection._redirects.length < _connection.maxRedirects) {
1701 // Check the location header. 1701 // Check the location header.
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 2166
2167 2167
2168 class _RedirectInfo implements RedirectInfo { 2168 class _RedirectInfo implements RedirectInfo {
2169 const _RedirectInfo(int this.statusCode, 2169 const _RedirectInfo(int this.statusCode,
2170 String this.method, 2170 String this.method,
2171 Uri this.location); 2171 Uri this.location);
2172 final int statusCode; 2172 final int statusCode;
2173 final String method; 2173 final String method;
2174 final Uri location; 2174 final Uri location;
2175 } 2175 }
OLDNEW
« no previous file with comments | « runtime/bin/file_impl.dart ('k') | runtime/bin/http_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698