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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js

Issue 2182213006: [Devtools] Fix multi-line curl copy response when multi-part-form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed windows curl with multi-line Created 4 years, 4 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 | « third_party/WebKit/LayoutTests/platform/win/inspector/curl-command-expected.txt ('k') | 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 */ 1357 */
1358 _generateCurlCommand: function(request, platform) 1358 _generateCurlCommand: function(request, platform)
1359 { 1359 {
1360 var command = ["curl"]; 1360 var command = ["curl"];
1361 // These headers are derived from URL (except "version") and would be ad ded by cURL anyway. 1361 // These headers are derived from URL (except "version") and would be ad ded by cURL anyway.
1362 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1}; 1362 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1};
1363 1363
1364 function escapeStringWin(str) 1364 function escapeStringWin(str)
1365 { 1365 {
1366 /* Replace quote by double quote (but not by \") because it is 1366 /* Replace quote by double quote (but not by \") because it is
1367 recognized by both cmd.exe and MS Crt arguments parser. 1367 recognized by both cmd.exe and MS Crt arguments parser.
lushnikov 2016/07/27 20:16:18 Can we update this comment?
allada 2016/07/27 22:27:59 Done.
1368 1368
1369 Replace % by "%" because it could be expanded to an environment 1369 Replace % by "%" because it could be expanded to an environment
1370 variable value. So %% becomes "%""%". Even if an env variable "" 1370 variable value. So %% becomes "%""%". Even if an env variable ""
1371 (2 doublequotes) is declared, the cmd.exe will not 1371 (2 doublequotes) is declared, the cmd.exe will not
1372 substitute it with its value. 1372 substitute it with its value.
1373 1373
1374 Replace each backslash with double backslash to make sure 1374 Replace each backslash with double backslash to make sure
1375 MS Crt arguments parser won't collapse them. 1375 MS Crt arguments parser won't collapse them.
1376 1376
1377 Replace new line outside of quotes since cmd.exe doesn't let 1377 Replace new line outside of quotes since cmd.exe doesn't let
1378 to do it inside. 1378 to do it inside.
1379 */ 1379 */
1380 return "\"" + str.replace(/"/g, "\"\"") 1380 var encapsChars = /[\r\n]/.test(str) ? "^\"" : "\"";
lushnikov 2016/07/27 20:16:18 are you sure you want to have /[\r\n]/ and not /\r
allada 2016/07/27 22:27:59 This is simply checking to see if there are any ne
1381 .replace(/%/g, "\"%\"") 1381 return encapsChars + str.replace(/\\/g, "\\\\")
1382 .replace(/\\/g, "\\\\") 1382 .replace(/"/g, "\\\"")
1383 .replace(/[\r\n]+/g, "\"^$&\"") + "\""; 1383 .replace(/\^/g, "^^")
1384 .replace(/[^a-zA-Z0-9\s_\-:=+~'^\/.',?;()*`]/g, "^$ &")
1385 .replace(/%(?=[a-zA-Z0-9_])/g, "%^")
1386 .replace(/\r\n|[\n\r]/g, "^\n\n") + encapsChars;
1384 } 1387 }
1385 1388
1386 function escapeStringPosix(str) 1389 function escapeStringPosix(str)
1387 { 1390 {
1388 function escapeCharacter(x) 1391 function escapeCharacter(x)
1389 { 1392 {
1390 var code = x.charCodeAt(0); 1393 var code = x.charCodeAt(0);
1391 if (code < 256) { 1394 if (code < 256) {
1392 // Add leading zero when needed to not care about the next c haracter. 1395 // Add leading zero when needed to not care about the next c haracter.
1393 return code < 16 ? "\\x0" + code.toString(16) : "\\x" + code .toString(16); 1396 return code < 16 ? "\\x0" + code.toString(16) : "\\x" + code .toString(16);
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 return false; 1691 return false;
1689 return true; 1692 return true;
1690 } 1693 }
1691 1694
1692 WebInspector.NetworkLogView.EventTypes = { 1695 WebInspector.NetworkLogView.EventTypes = {
1693 RequestSelected: "RequestSelected", 1696 RequestSelected: "RequestSelected",
1694 SearchCountUpdated: "SearchCountUpdated", 1697 SearchCountUpdated: "SearchCountUpdated",
1695 SearchIndexUpdated: "SearchIndexUpdated", 1698 SearchIndexUpdated: "SearchIndexUpdated",
1696 UpdateRequest: "UpdateRequest" 1699 UpdateRequest: "UpdateRequest"
1697 }; 1700 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/inspector/curl-command-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698