amppackager
amppackager copied to clipboard
Fix Accept parsing
trafficstars
There is a bug in the comma-splitting logic for Accept (not fixed in #196). It doesn't ignore commas inside quoted strings. A correct splitter would need to identify ,, ", and \". See Spring's tokenizer for example.
This bug is mentioned in accept_test.go, but downplayed as rare. However, it is likely to occur in the future when Chrome advertises support for v="b3,b4".
Two options:
- Wait for golang/go#19307 to be fixed
- Implement a preprocessor that splits on comma, but only after an even number of non-backslash-escaped quotes (being sure to track backslash-escaped-backslash as well). i.e. the tokenizer link above.