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

Side by Side Diff: lib/shelf_io.dart

Issue 2344893007: pkg/shelf: small fix to make analyzer happy (Closed)
Patch Set: Created 4 years, 3 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
« 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 /// A Shelf adapter for handling [HttpRequest] objects from `dart:io`. 5 /// A Shelf adapter for handling [HttpRequest] objects from `dart:io`.
6 /// 6 ///
7 /// One can provide an instance of [HttpServer] as the `requests` parameter in 7 /// One can provide an instance of [HttpServer] as the `requests` parameter in
8 /// [serveRequests]. 8 /// [serveRequests].
9 /// 9 ///
10 /// This adapter supports request hijacking; see [Request.hijack]. It also 10 /// This adapter supports request hijacking; see [Request.hijack]. It also
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 /// Creates a new [Request] from the provided [HttpRequest]. 110 /// Creates a new [Request] from the provided [HttpRequest].
111 Request _fromHttpRequest(HttpRequest request) { 111 Request _fromHttpRequest(HttpRequest request) {
112 var headers = <String, String>{}; 112 var headers = <String, String>{};
113 request.headers.forEach((k, v) { 113 request.headers.forEach((k, v) {
114 // Multiple header values are joined with commas. 114 // Multiple header values are joined with commas.
115 // See http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-21#page-22 115 // See http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-21#page-22
116 headers[k] = v.join(','); 116 headers[k] = v.join(',');
117 }); 117 });
118 118
119 onHijack(callback) { 119 void onHijack(callback) {
120 return request.response 120 request.response
121 .detachSocket(writeHeaders: false) 121 .detachSocket(writeHeaders: false)
122 .then((socket) => callback(socket, socket)); 122 .then((socket) => callback(socket, socket));
123 } 123 }
124 124
125 return new Request(request.method, request.requestedUri, 125 return new Request(request.method, request.requestedUri,
126 protocolVersion: request.protocolVersion, 126 protocolVersion: request.protocolVersion,
127 headers: headers, 127 headers: headers,
128 body: request, 128 body: request,
129 onHijack: onHijack); 129 onHijack: onHijack);
130 } 130 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 chain = new Chain.forTrace(stackTrace); 175 chain = new Chain.forTrace(stackTrace);
176 } 176 }
177 chain = chain 177 chain = chain
178 .foldFrames((frame) => frame.isCore || frame.package == 'shelf').terse; 178 .foldFrames((frame) => frame.isCore || frame.package == 'shelf').terse;
179 179
180 stderr.writeln('ERROR - ${new DateTime.now()}'); 180 stderr.writeln('ERROR - ${new DateTime.now()}');
181 stderr.writeln(message); 181 stderr.writeln(message);
182 stderr.writeln(chain); 182 stderr.writeln(chain);
183 return new Response.internalServerError(); 183 return new Response.internalServerError();
184 } 184 }
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