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

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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 this._highlightedNode = node; 1374 this._highlightedNode = node;
1375 }, 1375 },
1376 1376
1377 /** 1377 /**
1378 * @param {WebInspector.NetworkRequest} request 1378 * @param {WebInspector.NetworkRequest} request
1379 * @return {string} 1379 * @return {string}
1380 */ 1380 */
1381 _generateCurlCommand: function(request) 1381 _generateCurlCommand: function(request)
1382 { 1382 {
1383 var command = ["curl"]; 1383 var command = ["curl"];
1384 var ignoredHeaders = {}; 1384 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1};
aandrey 2013/10/11 09:11:11 why?
SeRya 2013/10/21 12:22:46 That headers are derived from URL (except for "ver
1385 1385
1386 function escapeStringWin(str) 1386 function escapeStringWin(str)
1387 { 1387 {
1388 /* Replace quote by double quote (but not by \") because it is 1388 /* Replace quote by double quote (but not by \") because it is
1389 recognized by both cmd.exe and MS Crt arguments parser. 1389 recognized by both cmd.exe and MS Crt arguments parser.
1390 1390
1391 Replace % by "%" because it could be expanded to an environment 1391 Replace % by "%" because it could be expanded to an environment
1392 variable value. So %% becomes "%""%". Even if an env variable "" 1392 variable value. So %% becomes "%""%". Even if an env variable ""
1393 (2 doublequotes) is declared, the cmd.exe will not 1393 (2 doublequotes) is declared, the cmd.exe will not
1394 substitute it with its value. 1394 substitute it with its value.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 var escapeString = WebInspector.isWin() ? escapeStringWin : escapeString Posix; 1436 var escapeString = WebInspector.isWin() ? escapeStringWin : escapeString Posix;
1437 1437
1438 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&")); 1438 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&"));
1439 1439
1440 var inferredMethod = "GET"; 1440 var inferredMethod = "GET";
1441 var data = []; 1441 var data = [];
1442 var requestContentType = request.requestContentType(); 1442 var requestContentType = request.requestContentType();
1443 if (requestContentType && requestContentType.startsWith("application/x-w ww-form-urlencoded") && request.requestFormData) { 1443 if (requestContentType && requestContentType.startsWith("application/x-w ww-form-urlencoded") && request.requestFormData) {
1444 data.push("--data"); 1444 data.push("--data");
1445 data.push(escapeString(request.requestFormData)); 1445 data.push(escapeString(request.requestFormData));
1446 ignoredHeaders["Content-Length"] = true; 1446 ignoredHeaders["content-length"] = true;
1447 inferredMethod = "POST"; 1447 inferredMethod = "POST";
1448 } else if (request.requestFormData) { 1448 } else if (request.requestFormData) {
1449 data.push("--data-binary"); 1449 data.push("--data-binary");
1450 data.push(escapeString(request.requestFormData)); 1450 data.push(escapeString(request.requestFormData));
1451 ignoredHeaders["Content-Length"] = true; 1451 ignoredHeaders["content-length"] = true;
1452 inferredMethod = "POST"; 1452 inferredMethod = "POST";
1453 } 1453 }
1454 1454
1455 if (request.requestMethod !== inferredMethod) { 1455 if (request.requestMethod !== inferredMethod) {
1456 command.push("-X"); 1456 command.push("-X");
1457 command.push(request.requestMethod); 1457 command.push(request.requestMethod);
1458 } 1458 }
1459 1459
1460 for (var i = 0; i < request.requestHeaders.length; i++) { 1460 for (var i = 0; i < request.requestHeaders.length; i++) {
1461 var header = request.requestHeaders[i]; 1461 var header = request.requestHeaders[i];
1462 if (header.name in ignoredHeaders) 1462 var name = header.name.replace(/^:/, ''); // Translate SPDY v3 heade rs to HTTP headers.
aandrey 2013/10/11 09:11:11 '' -> ""
SeRya 2013/10/21 12:22:46 Done.
1463 if (name.toLowerCase() in ignoredHeaders)
1463 continue; 1464 continue;
1464 command.push("-H"); 1465 command.push("-H");
1465 command.push(escapeString(header.name + ": " + header.value)); 1466 command.push(escapeString(name + ": " + header.value));
1466 } 1467 }
1467 command = command.concat(data); 1468 command = command.concat(data);
1468 command.push("--compressed"); 1469 command.push("--compressed");
1469 return command.join(" "); 1470 return command.join(" ");
1470 }, 1471 },
1471 1472
1472 __proto__: WebInspector.View.prototype 1473 __proto__: WebInspector.View.prototype
1473 } 1474 }
1474 1475
1475 /** 1476 /**
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 2579 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2579 { 2580 {
2580 var aValue = a._request[propertyName]; 2581 var aValue = a._request[propertyName];
2581 var bValue = b._request[propertyName]; 2582 var bValue = b._request[propertyName];
2582 if (aValue > bValue) 2583 if (aValue > bValue)
2583 return revert ? -1 : 1; 2584 return revert ? -1 : 1;
2584 if (bValue > aValue) 2585 if (bValue > aValue)
2585 return revert ? 1 : -1; 2586 return revert ? 1 : -1;
2586 return 0; 2587 return 0;
2587 } 2588 }
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