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

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 // These headers are derived from URL (except "version") and would be ad ded by cURL anyway.
1376 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1};
1376 1377
1377 function escapeStringWin(str) 1378 function escapeStringWin(str)
1378 { 1379 {
1379 /* Replace quote by double quote (but not by \") because it is 1380 /* Replace quote by double quote (but not by \") because it is
1380 recognized by both cmd.exe and MS Crt arguments parser. 1381 recognized by both cmd.exe and MS Crt arguments parser.
1381 1382
1382 Replace % by "%" because it could be expanded to an environment 1383 Replace % by "%" because it could be expanded to an environment
1383 variable value. So %% becomes "%""%". Even if an env variable "" 1384 variable value. So %% becomes "%""%". Even if an env variable ""
1384 (2 doublequotes) is declared, the cmd.exe will not 1385 (2 doublequotes) is declared, the cmd.exe will not
1385 substitute it with its value. 1386 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; 1428 var escapeString = WebInspector.isWin() ? escapeStringWin : escapeString Posix;
1428 1429
1429 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&")); 1430 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&"));
1430 1431
1431 var inferredMethod = "GET"; 1432 var inferredMethod = "GET";
1432 var data = []; 1433 var data = [];
1433 var requestContentType = request.requestContentType(); 1434 var requestContentType = request.requestContentType();
1434 if (requestContentType && requestContentType.startsWith("application/x-w ww-form-urlencoded") && request.requestFormData) { 1435 if (requestContentType && requestContentType.startsWith("application/x-w ww-form-urlencoded") && request.requestFormData) {
1435 data.push("--data"); 1436 data.push("--data");
1436 data.push(escapeString(request.requestFormData)); 1437 data.push(escapeString(request.requestFormData));
1437 ignoredHeaders["Content-Length"] = true; 1438 ignoredHeaders["content-length"] = true;
1438 inferredMethod = "POST"; 1439 inferredMethod = "POST";
1439 } else if (request.requestFormData) { 1440 } else if (request.requestFormData) {
1440 data.push("--data-binary"); 1441 data.push("--data-binary");
1441 data.push(escapeString(request.requestFormData)); 1442 data.push(escapeString(request.requestFormData));
1442 ignoredHeaders["Content-Length"] = true; 1443 ignoredHeaders["content-length"] = true;
1443 inferredMethod = "POST"; 1444 inferredMethod = "POST";
1444 } 1445 }
1445 1446
1446 if (request.requestMethod !== inferredMethod) { 1447 if (request.requestMethod !== inferredMethod) {
1447 command.push("-X"); 1448 command.push("-X");
1448 command.push(request.requestMethod); 1449 command.push(request.requestMethod);
1449 } 1450 }
1450 1451
1451 for (var i = 0; i < request.requestHeaders.length; i++) { 1452 for (var i = 0; i < request.requestHeaders.length; i++) {
1452 var header = request.requestHeaders[i]; 1453 var header = request.requestHeaders[i];
1453 if (header.name in ignoredHeaders) 1454 var name = header.name.replace(/^:/, ""); // Translate SPDY v3 heade rs to HTTP headers.
1455 if (name.toLowerCase() in ignoredHeaders)
1454 continue; 1456 continue;
1455 command.push("-H"); 1457 command.push("-H");
1456 command.push(escapeString(header.name + ": " + header.value)); 1458 command.push(escapeString(name + ": " + header.value));
1457 } 1459 }
1458 command = command.concat(data); 1460 command = command.concat(data);
1459 command.push("--compressed"); 1461 command.push("--compressed");
1460 return command.join(" "); 1462 return command.join(" ");
1461 }, 1463 },
1462 1464
1463 __proto__: WebInspector.View.prototype 1465 __proto__: WebInspector.View.prototype
1464 } 1466 }
1465 1467
1466 /** 1468 /**
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 2571 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2570 { 2572 {
2571 var aValue = a._request[propertyName]; 2573 var aValue = a._request[propertyName];
2572 var bValue = b._request[propertyName]; 2574 var bValue = b._request[propertyName];
2573 if (aValue > bValue) 2575 if (aValue > bValue)
2574 return revert ? -1 : 1; 2576 return revert ? -1 : 1;
2575 if (bValue > aValue) 2577 if (bValue > aValue)
2576 return revert ? 1 : -1; 2578 return revert ? 1 : -1;
2577 return 0; 2579 return 0;
2578 } 2580 }
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