jshttp / negotiator

An HTTP content negotiator for Node.js
MIT License
309 stars 33 forks source link

Regex error while additional attribute value contains `/` #17

Closed kevinprotoss closed 10 years ago

kevinprotoss commented 10 years ago

Hello,

I found a bug of your regex.

If I give some additional attribute in the accept header like the following, the header can not be correctly parsed. e.g.,

application/xhtml+xml;profile="http://www.wapforum.org/xhtml"

The result of regex match is:

type = application/xhtml+xml;profile="http://www.wapforum.org
subtype = xhtml"

Of course, it must not happen. However, if a whitespace exists before the attribute, then regex works correctly again.

application/xhtml+xml; profile="http://www.wapforum.org/xhtml"

Best regards, Kevin

federomero commented 10 years ago

Thanks Kevin, this commit https://github.com/federomero/negotiator/commit/d5e20863223bdaf3ee353711afbaf7ff82fafcbf fixes that.