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

Side by Side Diff: runtime/bin/vmservice/server.dart

Issue 1357023004: Catch unexpected http uri error in service isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 vmservice_io; 5 part of vmservice_io;
6 6
7 class WebSocketClient extends Client { 7 class WebSocketClient extends Client {
8 static const int PARSE_ERROR_CODE = 4000; 8 static const int PARSE_ERROR_CODE = 4000;
9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001;
10 static const int NOT_MAP_ERROR_CODE = 4002; 10 static const int NOT_MAP_ERROR_CODE = 4002;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 var resource = Resource.resources[path]; 139 var resource = Resource.resources[path];
140 if (resource != null) { 140 if (resource != null) {
141 // Serving up a static resource (e.g. .css, .html, .png). 141 // Serving up a static resource (e.g. .css, .html, .png).
142 request.response.headers.contentType = 142 request.response.headers.contentType =
143 ContentType.parse(resource.mimeType); 143 ContentType.parse(resource.mimeType);
144 request.response.add(resource.data); 144 request.response.add(resource.data);
145 request.response.close(); 145 request.response.close();
146 return; 146 return;
147 } 147 }
148 // HTTP based service request. 148 // HTTP based service request.
149 var client = new HttpRequestClient(request, _service); 149 try {
150 var message = new Message.fromUri(client, request.uri); 150 var client = new HttpRequestClient(request, _service);
151 client.onMessage(null, message); 151 var message = new Message.fromUri(client, request.uri);
152 client.onMessage(null, message);
153 } catch (e) {
154 print('Unexpected error processing HTTP request uri: '
155 '${request.uri}\n$e\n');
156 rethrow;
157 }
158
152 } 159 }
153 160
154 Future startup() { 161 Future startup() {
155 if (_server != null) { 162 if (_server != null) {
156 // Already running. 163 // Already running.
157 return new Future.value(this); 164 return new Future.value(this);
158 } 165 }
159 166
160 // Startup HTTP server. 167 // Startup HTTP server.
161 return HttpServer.bind(_ip, _port).then((s) { 168 return HttpServer.bind(_ip, _port).then((s) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); 214 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
208 _notifyServerState("", 0); 215 _notifyServerState("", 0);
209 return this; 216 return this;
210 }); 217 });
211 } 218 }
212 219
213 } 220 }
214 221
215 void _notifyServerState(String ip, int port) 222 void _notifyServerState(String ip, int port)
216 native "VMServiceIO_NotifyServerState"; 223 native "VMServiceIO_NotifyServerState";
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