-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
querystring: use String.prototype.split
's limit
#2288
Conversation
The changes LGTM. CI: https://jenkins-iojs.nodesource.com/job/node-test-commit/90/ |
Split is not in Array but in String |
Array.prototype.split
's limit
String.prototype.split
's limit
@targos ok, fixed @thefourtheye that's some serious lapse on my side :( |
String.prototype.split
's limit
Array.prototype.split
's limit
Array.prototype.split
's limit
String.prototype.split
's limit
@@ -209,18 +209,20 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq, options) { | |||
} | |||
|
|||
var regexp = /\+/g; | |||
qs = qs.split(sep); | |||
|
|||
var maxKeys = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but what's with this really arbitrary value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the docs, changing it would mean a major version upgrade. I don't know the reasoning behind it, I guess 1000 is a safe but large enough number of key value pairs.
@manvalls ... can you take a look at @ronkorving's question here: #2288 (comment) @thefourtheye @targos ... looks like the conversation on this stalled out. Any further thoughts? |
I forgot about it, sorry ! This still LGTM. |
@manvalls ... could you squash the commits and fix up the commit message? |
LGTM |
@jasnell done |
@manvalls I'd like to land this. Could you rebase on master? |
There's no need to add extra logic for it, `String.prototype.split` already has a `limit` argument. By using this argument we avoid keeping the whole array in memory, and V8 doesn't have to process the entire string.
@targos done |
Thanks a lot. |
There's no need to add extra logic for it, `String.prototype.split` already has a `limit` argument. By using this argument we avoid keeping the whole array in memory, and V8 doesn't have to process the entire string. PR-URL: #2288 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Landed in 27def4f |
@targos it looks like this commit is breaking body-parser. specifically when maxKeys is set to Infinity |
There is a very subtle change in behavior introduced with this patch.
The spec documents that the second argument must be an In the past if body-parser is depending on this functionality, at the very least in their tests. We should likely find out how much I'm not 100% that the changes present here justify the edge case |
Here is a gist for a test if you want to experiment |
It is worth mentioning that the documentation for |
@nodejs/ctc please tune briefly in to this, interesting result from smoke testing work that @thealphanerd has been doing, see nodejs/citgm#74 For the sake of being conservative about breaking changes, particularly when we have examples of people using it in the wild (and if there's one, there's bound to be more, particularly on a prominent project that people use as a reference), I'd +1 a special case here for checking |
fix for this landed in 878bcd4 |
There's no need to add extra logic for it, `String.prototype.split` already has a `limit` argument. By using this argument we avoid keeping the whole array in memory, and V8 doesn't have to process the entire string. PR-URL: #2288 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
There's no need to add extra logic for it, `String.prototype.split` already has a `limit` argument. By using this argument we avoid keeping the whole array in memory, and V8 doesn't have to process the entire string. PR-URL: nodejs#2288 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
There's no need to add extra logic for it,
String.prototype.split
already has alimit
argument. By using this argument we avoid keeping the whole array in memory, and V8 doesn't have to process the entire string.