Closed SamuelMarks closed 4 years ago
That's intended behavior. There is no way to produce the expected behavior that you posted there because nginx reads upgrade
and 'upgrade'
and "upgrade"
the exact same way. Quotes in nginx syntax are only for escaping whitespace, and there's no difference between the two types of quotes.
Can you provide an example of how this breaks windows support?
Windows paths with spaces wrapped in "
.
@aluttik So are you saying that these are equivalent:
A
proxy_set_header Connection 'upgrade';
B
proxy_set_header Connection "upgrade";
C
proxy_set_header Connection '"upgrade"';
D
proxy_set_header Connection '"upgrade"';
No, A and B are and C and D are, but A and C are not the same.
I'm saying that, to nginx, A and B and this example are all the same:
proxy_set_header Connection upgrade;
Crossplane decides if an argument needs quotes when written to the nginx config and adds them automatically for you.
For example, it is not possible to make crossplane write 'update'
to the config because it will always decide to write the unquoted update
instead of 'update'
(which is equivalent so far as nginx is concerned). However, it will write the quoted 'foo bar'
to the config if you pass in "args":["foo bar"]
because it knows that nginx would read "foo" and "bar" as two separate args if there were no quotes.
If you use escaped quotes like "args":["\"foo bar\""]
, you're telling crossplane "I want nginx to see these quotes as part of the argument" so it will wrap the argument (that contains quotes) with another set of quotes like '"foo bar"'
instead of what you probably wanted: 'foo bar'
.
If crossplane is making the wrong choice and not putting quotes around something that it should, causing nginx to behave in unexpected ways, then that's a bug.
I said earlier that "quotes in nginx syntax are only for escaping whitespace", but that's not exactly true. I should have said that they are used only for escaping purposes, which includes escaping whitespace as well as special characters like '
and "
.
Describe the bug A clear and concise description of what the bug is.
To Reproduce
PS: I have also tried manually changing that line to:
Expected behavior
Your environment
Additional context Keep in mind that this also breaks Windows support, as paths cannot be quoted properly.