Index: runtime/bin/vmservice/server.dart |
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart |
index 4e4c54ae2b9e4714f41b31964376179bd3147501..4075e8d427886d363b4b9c31aabeba5ad5c1c7be 100644 |
--- a/runtime/bin/vmservice/server.dart |
+++ b/runtime/bin/vmservice/server.dart |
@@ -157,12 +157,44 @@ class Server { |
return false; |
} |
- void _requestHandler(HttpRequest request) { |
+ Future _requestHandler(HttpRequest request) async { |
if (!_originCheck(request)) { |
// This is a cross origin attempt to connect |
request.response.close(); |
return; |
} |
+ if (request.method == 'PUT') { |
+ // PUT requests are forwarded to DevFS for processing. |
+ |
+ List fsNameList; |
+ List fsPathList; |
+ Object fsName; |
+ Object fsPath; |
+ |
+ try { |
+ // Extract the fs name and fs path from the request headers. |
+ fsNameList = request.headers['dev_fs_name']; |
+ fsPathList = request.headers['dev_fs_path']; |
+ fsName = fsNameList[0]; |
+ fsPath = fsPathList[0]; |
+ } catch (e) { /* ignore */ } |
+ |
+ String result; |
+ try { |
+ result = await _service.devfs.handlePutStream( |
+ fsName, |
+ fsPath, |
+ request.transform(GZIP.decoder)); |
+ } catch (e) { /* ignore */ } |
+ |
+ if (result != null) { |
+ request.response.headers.contentType = |
+ HttpRequestClient.jsonContentType; |
+ request.response.write(result); |
+ } |
+ request.response.close(); |
+ return; |
+ } |
if (request.method != 'GET') { |
// Not a GET request. Do nothing. |
request.response.close(); |