You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be stripping leading and trailing C0 control or space if the call comes from any place other than the setters (step 1.3 in basic URL parser), but we are not.
We should be stripping ASCII tab or newline (step 3 in basic URL parser) before entering the state machine (step 11). Instead of following the spec strictly, we are currently using a "clever" scheme that allows us to strip them without an additional loop. However, this scheme is already somewhat not elegant, but can actually break completely when the remaining magical variable is used:
constassert=require('assert');const{URL}=require('url');assert.strictEqual(newURL('C|/','file://host/dir/file').href,'file:///C:/');// No errorsassert.strictEqual(newURL('C|\n/','file://host/dir/file').href,'file:///C:/');// AssertionError: 'file://host/dir/C|/' === 'file:///C:/'
When implementing issue 1 above, one should first add an appropriate CHAR_TEST for C0 control or space, like so:
Then we should add a new has_url argument to URL::Parse() much like the existing has_base to signify whether we should be stripping leading and trailing C0 control or space, or not.
As an optimization, if !has_url (i.e. if we are stripping leading and trailing C0 control or space) it should be possible to first find the appropriate start and end of the input without creating a new string, and then only create a new string in the ASCII tab or newline-removal step later.
@watilde Are you interested in taking a stab at this?#12846
The text was updated successfully, but these errors were encountered:
We should be stripping leading and trailing C0 control or space if the call comes from any place other than the setters (step 1.3 in basic URL parser), but we are not.
We should be stripping ASCII tab or newline (step 3 in basic URL parser) before entering the state machine (step 11). Instead of following the spec strictly, we are currently using a "clever" scheme that allows us to strip them without an additional loop. However, this scheme is already somewhat not elegant, but can actually break completely when the remaining magical variable is used:
When implementing issue 1 above, one should first add an appropriate
CHAR_TEST
for C0 control or space, like so:Then we should add a new has_url argument to URL::Parse() much like the existing has_base to signify whether we should be stripping leading and trailing C0 control or space, or not.
As an optimization, if !has_url (i.e. if we are stripping leading and trailing C0 control or space) it should be possible to first find the appropriate start and end of the input without creating a new string, and then only create a new string in the ASCII tab or newline-removal step later.
@watilde Are you interested in taking a stab at this?#12846The text was updated successfully, but these errors were encountered: