| OLD | NEW |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (!_originCheck(request)) { | 183 if (!_originCheck(request)) { |
| 184 // This is a cross origin attempt to connect | 184 // This is a cross origin attempt to connect |
| 185 request.response.close(); | 185 request.response.close(); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 if (request.method == 'PUT') { | 188 if (request.method == 'PUT') { |
| 189 // PUT requests are forwarded to DevFS for processing. | 189 // PUT requests are forwarded to DevFS for processing. |
| 190 | 190 |
| 191 List fsNameList; | 191 List fsNameList; |
| 192 List fsPathList; | 192 List fsPathList; |
| 193 List fsPathBase64List; |
| 193 Object fsName; | 194 Object fsName; |
| 194 Object fsPath; | 195 Object fsPath; |
| 195 | 196 |
| 196 try { | 197 try { |
| 197 // Extract the fs name and fs path from the request headers. | 198 // Extract the fs name and fs path from the request headers. |
| 198 fsNameList = request.headers['dev_fs_name']; | 199 fsNameList = request.headers['dev_fs_name']; |
| 200 fsName = fsNameList[0]; |
| 201 |
| 199 fsPathList = request.headers['dev_fs_path']; | 202 fsPathList = request.headers['dev_fs_path']; |
| 200 fsName = fsNameList[0]; | 203 fsPathBase64List = request.headers['dev_fs_path_b64']; |
| 201 fsPath = fsPathList[0]; | 204 // If the 'dev_fs_path_b64' header field was sent, use that instead. |
| 205 if ((fsPathBase64List != null) && (fsPathBase64List.length > 0)) { |
| 206 fsPath = UTF8.decode(BASE64.decode(fsPathBase64List[0])); |
| 207 } else { |
| 208 fsPath = fsPathList[0]; |
| 209 } |
| 202 } catch (e) { /* ignore */ } | 210 } catch (e) { /* ignore */ } |
| 203 | 211 |
| 204 String result; | 212 String result; |
| 205 try { | 213 try { |
| 206 result = await _service.devfs.handlePutStream( | 214 result = await _service.devfs.handlePutStream( |
| 207 fsName, | 215 fsName, |
| 208 fsPath, | 216 fsPath, |
| 209 request.transform(GZIP.decoder)); | 217 request.transform(GZIP.decoder)); |
| 210 } catch (e) { /* ignore */ } | 218 } catch (e) { /* ignore */ } |
| 211 | 219 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 _notifyServerState("", 0); | 324 _notifyServerState("", 0); |
| 317 onServerAddressChange(null); | 325 onServerAddressChange(null); |
| 318 return this; | 326 return this; |
| 319 }); | 327 }); |
| 320 } | 328 } |
| 321 | 329 |
| 322 } | 330 } |
| 323 | 331 |
| 324 void _notifyServerState(String ip, int port) | 332 void _notifyServerState(String ip, int port) |
| 325 native "VMServiceIO_NotifyServerState"; | 333 native "VMServiceIO_NotifyServerState"; |
| OLD | NEW |