Index: runtime/bin/vmservice/server.dart |
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart |
index 4e4c54ae2b9e4714f41b31964376179bd3147501..f7e81e30f6651243a7c11cb3504f490781d79653 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. |
+ |
+ Object fsNameList; |
rmacnak
2016/08/08 16:33:42
var or List: fsNameList[0] below is a static warni
Cutch
2016/08/08 17:22:05
Done.
|
+ Object 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 */ } |
rmacnak
2016/08/08 16:33:42
A write error (out of disk space) would end up her
Cutch
2016/08/08 17:22:05
DevFS currently doesn't report write errors or out
|
+ |
+ 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(); |