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

Side by Side Diff: pkg/shelf/lib/src/request.dart

Issue 219113004: pkg/shelf: fix for UnmodifiableMapView collision in bleeding edge dart:collection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library shelf.request; 5 library shelf.request;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:collection/wrappers.dart'; 10 // TODO(kevmoo): use UnmodifiableMapView from SDK once 1.4 ships
11 import 'package:collection/wrappers.dart' as pc;
11 import 'package:path/path.dart' as p; 12 import 'package:path/path.dart' as p;
12 13
13 import 'message.dart'; 14 import 'message.dart';
14 import 'util.dart'; 15 import 'util.dart';
15 16
16 /// Represents an HTTP request to be processed by a Shelf application. 17 /// Represents an HTTP request to be processed by a Shelf application.
17 class Request extends Message { 18 class Request extends Message {
18 /// The remainder of the [requestedUri] path designating the virtual 19 /// The remainder of the [requestedUri] path designating the virtual
19 /// "location" of the request's target within the handler. 20 /// "location" of the request's target within the handler.
20 /// 21 ///
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (!headers.containsKey('if-modified-since')) return null; 63 if (!headers.containsKey('if-modified-since')) return null;
63 _ifModifiedSinceCache = parseHttpDate(headers['if-modified-since']); 64 _ifModifiedSinceCache = parseHttpDate(headers['if-modified-since']);
64 return _ifModifiedSinceCache; 65 return _ifModifiedSinceCache;
65 } 66 }
66 DateTime _ifModifiedSinceCache; 67 DateTime _ifModifiedSinceCache;
67 68
68 Request(this.pathInfo, String queryString, this.method, 69 Request(this.pathInfo, String queryString, this.method,
69 this.scriptName, this.protocolVersion, this.requestedUri, 70 this.scriptName, this.protocolVersion, this.requestedUri,
70 Map<String, String> headers, {Stream<List<int>> body}) 71 Map<String, String> headers, {Stream<List<int>> body})
71 : this.queryString = queryString == null ? '' : queryString, 72 : this.queryString = queryString == null ? '' : queryString,
72 super(new UnmodifiableMapView(new HashMap.from(headers)), 73 super(new pc.UnmodifiableMapView(new HashMap.from(headers)),
73 body == null ? new Stream.fromIterable([]) : body) { 74 body == null ? new Stream.fromIterable([]) : body) {
74 if (method.isEmpty) throw new ArgumentError('method cannot be empty.'); 75 if (method.isEmpty) throw new ArgumentError('method cannot be empty.');
75 76
76 if (scriptName.isNotEmpty && !scriptName.startsWith('/')) { 77 if (scriptName.isNotEmpty && !scriptName.startsWith('/')) {
77 throw new ArgumentError('scriptName must be empty or start with "/".'); 78 throw new ArgumentError('scriptName must be empty or start with "/".');
78 } 79 }
79 80
80 if (scriptName == '/') { 81 if (scriptName == '/') {
81 throw new ArgumentError( 82 throw new ArgumentError(
82 'scriptName can never be "/". It should be empty instead.'); 83 'scriptName can never be "/". It should be empty instead.');
(...skipping 15 matching lines...) Expand all
98 /// Convenience property to access [pathInfo] data as a [List]. 99 /// Convenience property to access [pathInfo] data as a [List].
99 List<String> get pathSegments { 100 List<String> get pathSegments {
100 var segs = p.url.split(pathInfo); 101 var segs = p.url.split(pathInfo);
101 if (segs.length > 0) { 102 if (segs.length > 0) {
102 assert(segs.first == p.url.separator); 103 assert(segs.first == p.url.separator);
103 segs.removeAt(0); 104 segs.removeAt(0);
104 } 105 }
105 return segs; 106 return segs;
106 } 107 }
107 } 108 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698