-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output isn't quoted when multipart form values include spaces #5
Comments
Oh right. I think I'll go with always-quoting the string and add escaping for a bunch of sensitive letters. What do you think about that? |
I struggle with getting shells to understand me sometimes. Always quoting seems like a good idea. |
That also makes letters such as semicolons not needing extra escaping. |
Since the fix uses double quotes instead of single quotes, a shell will expand $ variables.
outputs: |
Adding $ and \ to the regex now. Anything else? |
Windows will expand |
The windows command prompt doesn't support single quotes! |
So quote % as well? |
Impossible...? In Windows, |
Hm, okey, so maybe ignore Windows for now and add an option to make the output "windows compatible" later. |
Seems like best effort option is to provide the output suitable for the host platform with the option to generate output for other systems. Looks like String::ShellQuote is a good bicycle for POSIX platforms. If external library dependencies is a no-no, then for POSIX shells easiest way seems to use singular quotes so this is the only character that you will have to take care. Reference: https://stackoverflow.com/a/24869016/7598113 |
... so it won't help us a whole lot. |
For Microsoft® Windows™ platforms there is an MSDN blog-post about the wrong ways to do so. TL;DR: See conclusions at the end of the post, it should enlighten on how to do it properly. P.S. |
still, that requires a "windows output mode" option to quote in that style instead |
When a mutlipart form value contains spaces, h2c outputs
--form FOO=1 2 3 4
instead of--form 'FOO=1 2 3 4'
.Since h2c's output is a valid shell command, one should be careful with other characters such as
;
or'
, which may require quoting or escaping.The text was updated successfully, but these errors were encountered: