Index: runtime/bin/vmservice/server.dart |
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart |
index e659758fd4bd7c37d61580004c0d22c5646636ae..d4aa5aa49a31f2658e5f68267d9b739dee764ae4 100644 |
--- a/runtime/bin/vmservice/server.dart |
+++ b/runtime/bin/vmservice/server.dart |
@@ -4,7 +4,8 @@ |
part of vmservice_io; |
-final bool silentObservatory = const bool.fromEnvironment('SILENT_OBSERVATORY'); |
+final bool silentObservatory = |
+ const bool.fromEnvironment('SILENT_OBSERVATORY'); |
void serverPrint(String s) { |
if (silentObservatory) { |
@@ -62,7 +63,7 @@ class WebSocketClient extends Client { |
} |
try { |
if (result is String || result is Uint8List) { |
- socket.add(result); // String or binary message. |
+ socket.add(result); // String or binary message. |
} else { |
// String message as external Uint8List. |
assert(result is List); |
@@ -84,13 +85,14 @@ class WebSocketClient extends Client { |
} |
} |
+ |
class HttpRequestClient extends Client { |
static ContentType jsonContentType = |
new ContentType("application", "json", charset: "utf-8"); |
final HttpRequest request; |
HttpRequestClient(this.request, VMService service) |
- : super(service, sendEvents: false); |
+ : super(service, sendEvents:false); |
disconnect() { |
request.response.close(); |
@@ -110,7 +112,7 @@ class HttpRequestClient extends Client { |
response.write(result); |
} else { |
assert(result is List); |
- Uint8List cstring = result[0]; // Already in UTF-8. |
+ Uint8List cstring = result[0]; // Already in UTF-8. |
response.add(cstring); |
} |
response.close(); |
@@ -167,7 +169,7 @@ class Server { |
if ((uri.port == _server.port) && |
((uri.host == _server.address.address) || |
- (uri.host == _server.address.host))) { |
+ (uri.host == _server.address.host))) { |
return true; |
} |
@@ -215,9 +217,8 @@ class Server { |
return null; |
} |
// Construct the actual request path by chopping off the auth token. |
- return (requestPathSegments[1] == '') |
- ? ROOT_REDIRECT_PATH |
- : '/${requestPathSegments.sublist(1).join('/')}'; |
+ return (requestPathSegments[1] == '') ? |
+ ROOT_REDIRECT_PATH : '/${requestPathSegments.sublist(1).join('/')}'; |
} |
Future _requestHandler(HttpRequest request) async { |
@@ -260,13 +261,16 @@ class Server { |
fsPath = fsPathList[0]; |
} |
} |
- } catch (e) {/* ignore */} |
+ } catch (e) { /* ignore */ } |
String result; |
try { |
result = await _service.devfs.handlePutStream( |
- fsName, fsPath, fsUri, request.transform(GZIP.decoder)); |
- } catch (e) {/* ignore */} |
+ fsName, |
+ fsPath, |
+ fsUri, |
+ request.transform(GZIP.decoder)); |
+ } catch (e) { /* ignore */ } |
if (result != null) { |
request.response.headers.contentType = |
@@ -290,7 +294,8 @@ class Server { |
} |
if (path == WEBSOCKET_PATH) { |
- WebSocketTransformer.upgrade(request).then((WebSocket webSocket) { |
+ WebSocketTransformer.upgrade(request).then( |
+ (WebSocket webSocket) { |
new WebSocketClient(webSocket, _service); |
}); |
return; |
@@ -299,7 +304,8 @@ class Server { |
Asset asset = assets[path]; |
if (asset != null) { |
// Serving up a static asset (e.g. .css, .html, .png). |
- request.response.headers.contentType = ContentType.parse(asset.mimeType); |
+ request.response.headers.contentType = |
+ ContentType.parse(asset.mimeType); |
request.response.add(asset.data); |
request.response.close(); |
return; |
@@ -311,7 +317,7 @@ class Server { |
client.onMessage(null, message); |
} catch (e) { |
serverPrint('Unexpected error processing HTTP request uri: ' |
- '${request.uri}\n$e\n'); |
+ '${request.uri}\n$e\n'); |
rethrow; |
} |
} |
@@ -393,6 +399,8 @@ class Server { |
return this; |
}); |
} |
+ |
} |
-void _notifyServerState(String uri) native "VMServiceIO_NotifyServerState"; |
+void _notifyServerState(String uri) |
+ native "VMServiceIO_NotifyServerState"; |