Commit 0745e0e4 authored by Joey Arhar's avatar Joey Arhar Committed by Commit Bot

[DevTools] Escape exclamation points in copy as curl

Bug: 919356
Change-Id: I8b7769f6d6fef258f31dd16367d54b505284a7d8
Reviewed-on: https://chromium-review.googlesource.com/c/1437265
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626211}
parent 5201c070
......@@ -1673,14 +1673,14 @@ Network.NetworkLogView = class extends UI.VBox {
return code < 16 ? '\\u0' + code.toString(16) : '\\u' + code.toString(16);
}
if (/[\u0000-\u001f\u007f-\u009f]|\'/.test(str)) {
if (/[\u0000-\u001f\u007f-\u009f!]|\'/.test(str)) {
// Use ANSI-C quoting syntax.
return '$\'' +
str.replace(/\\/g, '\\\\')
.replace(/\'/g, '\\\'')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\u0000-\u001f\u007f-\u009f]/g, escapeCharacter) +
.replace(/[\u0000-\u001f\u007f-\u009f!]/g, escapeCharacter) +
'\'';
} else {
// Use single quote syntax.
......
......@@ -19,13 +19,13 @@ fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"conten
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"1234^
00^^^^'^\^"^!^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n00\u02\u03\u04\u05\'"!' --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n00\u02\u03\u04\u05\'"\u21' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("1234$([char]13)$([char]10)00$([char]2)$([char]3)$([char]4)$([char]5)'`"!"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"1234\r\n00\u0002\u0003\u0004\u0005'\"!","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"1234^
^00^^^^'^\^"^!^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n\u0100\u02\u03\u04\u05\'"!' --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'1234\r\n\u0100\u02\u03\u04\u05\'"\u21' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("1234$([char]13)$([char]10)$([char]1)00$([char]2)$([char]3)$([char]4)$([char]5)'`"!"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"1234\r\n\u000100\u0002\u0003\u0004\u0005'\"!","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"^%^OS^%^
......@@ -33,7 +33,7 @@ cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binar
^%^%^OS^%^%^
^\^"^\^\^\^"'^$^&^!^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'%OS%\r\n%%OS%%\r\n"\\"\'$&!' --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'%OS%\r\n%%OS%%\r\n"\\"\'$&\u21' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("%OS%$([char]13)$([char]10)%%OS%%$([char]13)$([char]10)`"\`"'`$&!"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"%OS%\r\n%%OS%%\r\n\"\\\"'$&!","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary ^"^!^@^#^$^%^^^&*()_+~`1234567890-=^[^]^{^};':^\^",./^
......@@ -47,7 +47,7 @@ t^
^
yuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM^" --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'!@#$%^&*()_+~`1234567890-=[]{};\':",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM' --compressed
cURL Unix: curl 'http://example.org/path' -H 'Content-Type: application/binary' --data-binary $'\u21@#$%^&*()_+~`1234567890-=[]{};\':",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM' --compressed
Powershell: Invoke-WebRequest -Uri "http://example.org/path" -Method "POST" -ContentType "application/binary" -Body ([System.Text.Encoding]::UTF8.GetBytes("!@#`$%^&*()_+~``1234567890-=[]{};':`",./$([char]13)<>?$([char]13)$([char]10)qwer$([char]10)t$([char]10)$([char]10)yuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM"))
fetch: fetch("http://example.org/path", {"credentials":"omit","headers":{"content-type":"application/binary"},"body":"!@#$%^&*()_+~`1234567890-=[]{};':\",./\r<>?\r\nqwer\nt\n\nyuiopasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM","method":"POST","mode":"cors"});
cURL Windows: curl "http://example.org/path" -H "Content-Type: application/binary" --data-binary "^^€^^ÿ ^܀" --compressed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment