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

Side by Side Diff: Source/devtools/front_end/NetworkPanel.js

Issue 26237002: Removing сolon from cURL command header. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 this._highlightedNode = node; 1365 this._highlightedNode = node;
1366 }, 1366 },
1367 1367
1368 /** 1368 /**
1369 * @param {WebInspector.NetworkRequest} request 1369 * @param {WebInspector.NetworkRequest} request
1370 * @return {string} 1370 * @return {string}
1371 */ 1371 */
1372 _generateCurlCommand: function(request) 1372 _generateCurlCommand: function(request)
1373 { 1373 {
1374 var command = ["curl"]; 1374 var command = ["curl"];
1375 var ignoredHeaders = {}; 1375 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1};
aandrey 2013/10/21 12:35:55 could you plz also add a brief comment into the co
SeRya 2013/10/21 13:05:55 Done.
1376 1376
1377 function escapeStringWin(str) 1377 function escapeStringWin(str)
1378 { 1378 {
1379 /* Replace quote by double quote (but not by \") because it is 1379 /* Replace quote by double quote (but not by \") because it is
1380 recognized by both cmd.exe and MS Crt arguments parser. 1380 recognized by both cmd.exe and MS Crt arguments parser.
1381 1381
1382 Replace % by "%" because it could be expanded to an environment 1382 Replace % by "%" because it could be expanded to an environment
1383 variable value. So %% becomes "%""%". Even if an env variable "" 1383 variable value. So %% becomes "%""%". Even if an env variable ""
1384 (2 doublequotes) is declared, the cmd.exe will not 1384 (2 doublequotes) is declared, the cmd.exe will not
1385 substitute it with its value. 1385 substitute it with its value.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 var escapeString = WebInspector.isWin() ? escapeStringWin : escapeString Posix; 1427 var escapeString = WebInspector.isWin() ? escapeStringWin : escapeString Posix;
1428 1428
1429 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&")); 1429 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&"));
1430 1430
1431 var inferredMethod = "GET"; 1431 var inferredMethod = "GET";
1432 var data = []; 1432 var data = [];
1433 var requestContentType = request.requestContentType(); 1433 var requestContentType = request.requestContentType();
1434 if (requestContentType && requestContentType.startsWith("application/x-w ww-form-urlencoded") && request.requestFormData) { 1434 if (requestContentType && requestContentType.startsWith("application/x-w ww-form-urlencoded") && request.requestFormData) {
1435 data.push("--data"); 1435 data.push("--data");
1436 data.push(escapeString(request.requestFormData)); 1436 data.push(escapeString(request.requestFormData));
1437 ignoredHeaders["Content-Length"] = true; 1437 ignoredHeaders["content-length"] = true;
1438 inferredMethod = "POST"; 1438 inferredMethod = "POST";
1439 } else if (request.requestFormData) { 1439 } else if (request.requestFormData) {
1440 data.push("--data-binary"); 1440 data.push("--data-binary");
1441 data.push(escapeString(request.requestFormData)); 1441 data.push(escapeString(request.requestFormData));
1442 ignoredHeaders["Content-Length"] = true; 1442 ignoredHeaders["content-length"] = true;
1443 inferredMethod = "POST"; 1443 inferredMethod = "POST";
1444 } 1444 }
1445 1445
1446 if (request.requestMethod !== inferredMethod) { 1446 if (request.requestMethod !== inferredMethod) {
1447 command.push("-X"); 1447 command.push("-X");
1448 command.push(request.requestMethod); 1448 command.push(request.requestMethod);
1449 } 1449 }
1450 1450
1451 for (var i = 0; i < request.requestHeaders.length; i++) { 1451 for (var i = 0; i < request.requestHeaders.length; i++) {
1452 var header = request.requestHeaders[i]; 1452 var header = request.requestHeaders[i];
1453 if (header.name in ignoredHeaders) 1453 var name = header.name.replace(/^:/, ""); // Translate SPDY v3 heade rs to HTTP headers.
1454 if (name.toLowerCase() in ignoredHeaders)
1454 continue; 1455 continue;
1455 command.push("-H"); 1456 command.push("-H");
1456 command.push(escapeString(header.name + ": " + header.value)); 1457 command.push(escapeString(name + ": " + header.value));
1457 } 1458 }
1458 command = command.concat(data); 1459 command = command.concat(data);
1459 command.push("--compressed"); 1460 command.push("--compressed");
1460 return command.join(" "); 1461 return command.join(" ");
1461 }, 1462 },
1462 1463
1463 __proto__: WebInspector.View.prototype 1464 __proto__: WebInspector.View.prototype
1464 } 1465 }
1465 1466
1466 /** 1467 /**
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 2570 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2570 { 2571 {
2571 var aValue = a._request[propertyName]; 2572 var aValue = a._request[propertyName];
2572 var bValue = b._request[propertyName]; 2573 var bValue = b._request[propertyName];
2573 if (aValue > bValue) 2574 if (aValue > bValue)
2574 return revert ? -1 : 1; 2575 return revert ? -1 : 1;
2575 if (bValue > aValue) 2576 if (bValue > aValue)
2576 return revert ? 1 : -1; 2577 return revert ? 1 : -1;
2577 return 0; 2578 return 0;
2578 } 2579 }
OLDNEW
« no previous file with comments | « 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