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

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

Issue 10411057: Deprecate use of timezones. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix code using old api. Created 8 years, 7 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } catch (Exception e) { 84 } catch (Exception e) {
85 return null; 85 return null;
86 } 86 }
87 } 87 }
88 return null; 88 return null;
89 } 89 }
90 90
91 void set date(Date date) { 91 void set date(Date date) {
92 _checkMutable(); 92 _checkMutable();
93 // Format "Date" header with date in Greenwich Mean Time (GMT). 93 // Format "Date" header with date in Greenwich Mean Time (GMT).
94 String formatted = 94 String formatted = _HttpUtils.formatDate(expires.toUtc());
95 _HttpUtils.formatDate(expires.changeTimeZone(new TimeZone.utc()));
96 _set("date", formatted); 95 _set("date", formatted);
97 } 96 }
98 97
99 Date get expires() { 98 Date get expires() {
100 List<String> values = _headers["expires"]; 99 List<String> values = _headers["expires"];
101 if (values != null) { 100 if (values != null) {
102 try { 101 try {
103 return _HttpUtils.parseDate(values[0]); 102 return _HttpUtils.parseDate(values[0]);
104 } catch (Exception e) { 103 } catch (Exception e) {
105 return null; 104 return null;
106 } 105 }
107 } 106 }
108 return null; 107 return null;
109 } 108 }
110 109
111 void set expires(Date expires) { 110 void set expires(Date expires) {
112 _checkMutable(); 111 _checkMutable();
113 // Format "Expires" header with date in Greenwich Mean Time (GMT). 112 // Format "Expires" header with date in Greenwich Mean Time (GMT).
114 String formatted = 113 String formatted = _HttpUtils.formatDate(expires.toUtc());
115 _HttpUtils.formatDate(expires.changeTimeZone(new TimeZone.utc()));
116 _set("expires", formatted); 114 _set("expires", formatted);
117 } 115 }
118 116
119 ContentType get contentType() { 117 ContentType get contentType() {
120 var values = _headers["content-type"]; 118 var values = _headers["content-type"];
121 if (values != null) { 119 if (values != null) {
122 return new ContentType.fromString(values[0]); 120 return new ContentType.fromString(values[0]);
123 } else { 121 } else {
124 return new ContentType(); 122 return new ContentType();
125 } 123 }
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 1824
1827 1825
1828 class _RedirectInfo implements RedirectInfo { 1826 class _RedirectInfo implements RedirectInfo {
1829 const _RedirectInfo(int this.statusCode, 1827 const _RedirectInfo(int this.statusCode,
1830 String this.method, 1828 String this.method,
1831 Uri this.location); 1829 Uri this.location);
1832 final int statusCode; 1830 final int statusCode;
1833 final String method; 1831 final String method;
1834 final Uri location; 1832 final Uri location;
1835 } 1833 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698