mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
parseParams searched for '=' from the start of every pair. In a run of
pairs with no '=' after them, each search scanned to the end of the
string, so new URLSearchParams('a&'.repeat(n)) took quadratic time:
about 1.6 s for 262,144 pairs against 7.5 ms for 'a=b&'. Request's
formData() reaches the same loop with an urlencoded body.
Keep the position of the next '=' and search again only once the
parser has passed it.
Fixes: https://github.com/nodejs/node/issues/67652
Refs: https://github.com/nodejs/node/pull/65363
Signed-off-by: Aayush <21987529+aayushbtw@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67653
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>