New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 798498 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Copy as cURL (cmd) produce the wrong commands

Reported by doggy.hu...@gmail.com, Jan 2 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36

Steps to reproduce the problem:
1. Navigate to https://www.udemy.com/
2. Hit F12 and switch to Network tab
3. Reload the page
4. Right click on the first HTTP request in the Network tab in the DevTools.
5. Choose Copy -> Copy as cURL (cmd)
6. Open cmd.exe
7. paste cURL command in the Command Prompt then hit Enter

Here is the sample command produced by Google Chrome:

curl "https://www.udemy.com/" -H "pragma: no-cache" -H "accept-encoding: gzip, deflate, br" -H "accept-language: zh-TW,zh;q=0.9,en;q=0.8,la;q=0.7" -H "upgrade-insecure-requests: 1" -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "cache-control: no-cache" -H "authority: www.udemy.com" -H "cookie: __udmy_2_v57r=543bea7adcd74cdc99280353bcf8f85c; ud_firstvisit=2018-01-02T18:05:38.288699+00:00:1eWQwU:PlSTQAhagqi2TZcG7pWy_V3lAR8; eva=^\^"Sg4=^\^"; seen=1; _ga=GA1.2.191154943.1514916341; _gid=GA1.2.499832606.1514916341; _ga=GA1.1.191154943.1514916341; _gid=GA1.1.499832606.1514916341; __ssid=e439a0c1-32f0-462d-8876-234667be316b; IR_gbd=udemy.com; IR_PI=1514916342216.pznrk861nkr; _pxvid=8dc96780-efe7-11e7-9d0e-41012fd075eb; IR_5420=1514916348492^%^7C0^%^7C1514916342216; ud_rule_vars=eJyFzcEKwyAQBNBfCXttU1aNzeq3CMHoWqQFqbG9hPx7pdBzT3OYecwOzdcbN47LO2-5lWr1pFb2s48hzlOIwRhJqLRaQ6JEOthQyj0z2AF2Bw-_taXy88U9o2_seuFAoqARxYhyEGRRW0UXLZSh6wnRIjo491XKtavv8R8rSZNUP3vA8QHr3jUk:1eWQwe:beRZo-57iixV-l4dtC83Sv0m9Oc; ki_t=1514916350337^%^3B1514916350337^%^3B1514916350337^%^3B1^%^3B1; ki_r=; _px2=eyJ1IjoiOGY4NTZmNjAtZWZlNy0xMWU3LTg0NGUtZjc3YWE4YWY4YTVlIiwidiI6IjhkYzk2NzgwLWVmZTctMTFlNy05ZDBlLTQxMDEyZmQwNzVlYiIsInQiOjE1MTQ5MTcxNTA3MDksImgiOiI4NzcwMzBhMDU1OWM5NGI5MGRmMTEyYTAwMjlkYWRjZDk5ZjYwN2I1MzdiNTcwMWZlODMxMTA4NzljOWQzMzYzIn0=; _px3=33a41811a63d032baabec2a02a75809c6d6c8562fdc5469e0b5a717670d54f35:EzuC8pPdDQdA4VV1gaN8vXK8lVxfnALENgzE7zewxl7AA0Shme4z9iD+ysFKkw5En7c8OS2QtSCYYwQhn7jUxQ==:1000:ZWdSymmngL4HG8isE1FDr8GbbJ9bzc7oei40hr3f97WL+A6mO2SJatJ1BfOqeWWugDZH8iV69zDOOjDu2g7vJWSF7eNaNIzKX5s1ebpmVXrfOwlBWiPLxAxGwclB+VUKt4BY8N8evfbHT+2XHeLLVNooow1R65vj2RCuFZMcAYs=" --compressed

What is the expected behavior?
Run the cURL tool and get the expected result correctly.

What went wrong?
The command produced by Google Chrome is wrong especially in the "Cookie" header.  There is one Cookie contains a double quote just like below:

eva="Sg4=";

The Google Chrome produce a command argument as below which the double quote usage is wrong.

eva=^\^"Sg4=^\^";

The correct one should be:

eva="Sg4=";

There is the correct full command should be produced:

curl "https://www.udemy.com/" -H "pragma: no-cache" -H "accept-encoding: gzip, deflate, br" -H "accept-language: zh-TW,zh;q=0.9,en;q=0.8,la;q=0.7" -H "upgrade-insecure-requests: 1" -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36" -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "cache-control: no-cache" -H "authority: www.udemy.com" -H "cookie: __udmy_2_v57r=543bea7adcd74cdc99280353bcf8f85c; ud_firstvisit=2018-01-02T18:05:38.288699+00:00:1eWQwU:PlSTQAhagqi2TZcG7pWy_V3lAR8; eva="Sg4="; seen=1; _ga=GA1.2.191154943.1514916341; _gid=GA1.2.499832606.1514916341; _ga=GA1.1.191154943.1514916341; _gid=GA1.1.499832606.1514916341; __ssid=e439a0c1-32f0-462d-8876-234667be316b; IR_gbd=udemy.com; IR_PI=1514916342216.pznrk861nkr; _pxvid=8dc96780-efe7-11e7-9d0e-41012fd075eb; IR_5420=1514916348492^%^7C0^%^7C1514916342216; ud_rule_vars=eJyFzcEKwyAQBNBfCXttU1aNzeq3CMHoWqQFqbG9hPx7pdBzT3OYecwOzdcbN47LO2-5lWr1pFb2s48hzlOIwRhJqLRaQ6JEOthQyj0z2AF2Bw-_taXy88U9o2_seuFAoqARxYhyEGRRW0UXLZSh6wnRIjo491XKtavv8R8rSZNUP3vA8QHr3jUk:1eWQwe:beRZo-57iixV-l4dtC83Sv0m9Oc; ki_t=1514916350337^%^3B1514916350337^%^3B1514916350337^%^3B1^%^3B1; ki_r=; _px2=eyJ1IjoiOGY4NTZmNjAtZWZlNy0xMWU3LTg0NGUtZjc3YWE4YWY4YTVlIiwidiI6IjhkYzk2NzgwLWVmZTctMTFlNy05ZDBlLTQxMDEyZmQwNzVlYiIsInQiOjE1MTQ5MTcxNTA3MDksImgiOiI4NzcwMzBhMDU1OWM5NGI5MGRmMTEyYTAwMjlkYWRjZDk5ZjYwN2I1MzdiNTcwMWZlODMxMTA4NzljOWQzMzYzIn0=; _px3=33a41811a63d032baabec2a02a75809c6d6c8562fdc5469e0b5a717670d54f35:EzuC8pPdDQdA4VV1gaN8vXK8lVxfnALENgzE7zewxl7AA0Shme4z9iD+ysFKkw5En7c8OS2QtSCYYwQhn7jUxQ==:1000:ZWdSymmngL4HG8isE1FDr8GbbJ9bzc7oei40hr3f97WL+A6mO2SJatJ1BfOqeWWugDZH8iV69zDOOjDu2g7vJWSF7eNaNIzKX5s1ebpmVXrfOwlBWiPLxAxGwclB+VUKt4BY8N8evfbHT+2XHeLLVNooow1R65vj2RCuFZMcAYs=" --compressed

Did this work before? N/A 

Chrome version: 63.0.3239.108  Channel: stable
OS Version: 10.0
Flash Version: 

Here is a reference article about this.  Just FYI.

Everyone quotes command line arguments the wrong way – Twisty Little Passages, All Alike
https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
 
Labels: Needs-Triage-M63
Labels: Needs-Bisect
Cc: vamshi.k...@techmahindra.com
Labels: -Needs-Bisect Triaged-ET M-65
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on reported chrome version 63.0.3239.108 and on the latest canary 65.0.3312.0 using windows 10 with the steps mentioned in comment#0 by reporter. 
Note: Issue is not seen on Ubuntu 14.04 and Mac 10.13.1

* Behavior of 50.0.2661.0: After pasting the copied cURL(cmd) we are getting eva="Sg4=" not eva=^\^"Sg4=^\^"; so we confirm that the Issue is not seen in M50(50.0.2661.0)
We are unable to provide the bisect as the intermediate builds (like M55-55.0.2841.0, M58-58.0.2990.0) has issues with copy/paste. To be clear and specific, while copying through Devtools>Network>Copy> Copy as cURL(cmd) as said in comment#0 , it isn't getting copied rather the text which is already copied in clipboard is being pasted. Attaching the screen cast of the same where the issue is clearly shown.

Hence removing Needs-Bisect label and marking it as Untriaged.

Requesting some one from Platform>DevTools team to have a look into the issue for further investigation.

Thanks!
798498.mp4
6.1 MB View Download
Owner: eostroukhov@chromium.org
Status: Assigned (was: Untriaged)
Is this issue has any progress?
This bug exists for more than half year.  Any plan on this?

Comment 8 Deleted

Here is the modified version of the `escapeStringWin` function:

```
function escapeStringWin(str) {
    return '"' + str + '"';
}
```

When using double quote, you don't have to escape anything including "double quote" itself.
Owner: jarhar@chromium.org
any progress?

Sign in to add a comment