amppackager icon indicating copy to clipboard operation
amppackager copied to clipboard

Fix Accept parsing

Open twifkak opened this issue 6 years ago • 1 comments
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".

twifkak avatar Jan 24 '19 16:01 twifkak

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.

twifkak avatar May 03 '19 23:05 twifkak