Anna Henningsen
0043c6f548
src: pass along MaybeLocal<> state from URL::ToObject()
...
PR-URL: https://github.com/nodejs/node/pull/25141
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-12-31 01:10:36 +01:00
Gus Caplan
f084e06de7
src: use custom TryCatch subclass
...
PR-URL: https://github.com/nodejs/node/pull/24751
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-12-03 10:25:06 -06:00
leeight
adbf9477eb
src: use arraysize instead of hardcode number
...
PR-URL: https://github.com/nodejs/node/pull/24473
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-12-01 18:57:00 +01:00
Timothy Gu
f2be20b735
url: reuse existing context in href setter
...
Correctness-wise, this removes side effects in the href setter if
parsing fails. Style-wise, this allows removing the parse() wrapper
function around C++ _parse().
Also fix an existing bug with whitespace trimming in C++ that was
previously circumvented by additionally trimming the input in
JavaScript.
Fixes: https://github.com/nodejs/node/issues/24345
Refs: https://github.com/nodejs/node/pull/24218#issuecomment-438476591
PR-URL: https://github.com/nodejs/node/pull/24495
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-01 08:53:05 -08:00
Timothy Gu
639f6411a7
src: set HAS_USERNAME/PASSWORD more strictly
...
Fixes: https://github.com/nodejs/node/issues/24211
PR-URL: https://github.com/nodejs/node/pull/24495
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-01 08:53:05 -08:00
Jayasankar
c5db2df325
src: elevate v8 namespaces for node_url.cc
...
Elevate namespace for repeated entities.
PR-URL: https://github.com/nodejs/node/pull/24573
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-11-24 19:59:34 -08:00
Joyee Cheung
5850220229
src: move error handling code into node_errors.cc
...
Move the following code into a new node_errors.cc file and
declare them in node_errors.h for clarity and make it possible
to include them with node_errors.h.
- AppendExceptionLine()
- DecorateErrorStack()
- FatalError()
- OnFatalError()
- PrintErrorString()
- FatalException()
- ReportException()
- FatalTryCatch
And move the following definitions (declared elsewhere than
node_errors.h) to node_errors.cc:
- Abort() (in util.h)
- Assert() (in util.h)
PR-URL: https://github.com/nodejs/node/pull/24058
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-11-06 20:58:40 +08:00
cjihrig
e649ba9ad6
src: reduce variable scope in node_url.cc
...
PR-URL: https://github.com/nodejs/node/pull/23297
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-09 08:33:23 -04:00
Alexey Kozyatinskiy
cf340fe0f5
src: added URL::FromFilePath method
...
Method returns file URL from native file path.
PR-URL: https://github.com/nodejs/node/pull/22251
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-09-14 08:32:08 -07:00
Weijia Wang
e917a23d2e
url: move process.binding('url') to internalBinding
...
PR-URL: https://github.com/nodejs/node/pull/22204
Refs: https://github.com/nodejs/node/issues/22160
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
2018-09-07 09:03:25 +08:00
Timothy Gu
c7788fba28
src: encode 0x27 (') for special URLs
...
Refs: https://github.com/whatwg/url/commit/6ef17ebe1220a7e7c0cfff0785017502ee18808b
PR-URL: https://github.com/nodejs/node/pull/22022
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-08-18 15:18:05 -04:00
Timothy Gu
65f617314d
src: start annotating native code side effect
...
PR-URL: https://github.com/nodejs/node/pull/21458
Refs: https://github.com/nodejs/node/issues/20977
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-06-25 23:15:35 -04:00
Ayush Gupta
11892b0b64
url: introduce URL_FLAGS_IS_DEFAULT_SCHEME_PORT flag
...
Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured
when the parser detects that the port passed is the default port
for that scheme.
PR-URL: https://github.com/nodejs/node/pull/20479
Fixes: https://github.com/nodejs/node/issues/20465
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-18 15:24:05 +02:00
Anna Henningsen
bd6dc9ebab
src: replace template< → template <
...
PR-URL: https://github.com/nodejs/node/pull/20675
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-14 18:09:23 +02:00
Anna Henningsen
ae70e2bc34
src: general C++ cleanup in node_url.cc
...
- Merge `domain` and `opaque` storage in URL parser:
This just simplifies the code a bit, having multiple fields
in an union with the same type is usually just overhead.
- Add move variant of `URLHost::ToString()`:
This helps avoid unnecessary string copy operations, especially
since we control the lifetime of `URLHost` objects pretty well.
- Use const refs in node_url.cc where appropriate
- Remove or reduce overly generous `.reserve()` calls:
These would otherwise keep a lot of unused memory lying around.
- Return return values instead of unnecessary pointer arguments
- Use more common/expressive variable names
- Avoid macro use, reduce number of unnecessary JS strings:
There’s no reason for `GET`, `GET_AND_SET` and `UTF8STRING` to be
macros. Also, `GET` would previously create a JS string instance
for each single call, even though the strings it was called
with were compile-time constants.
- Avoid unnecessary JS casts when the type of a value is known
- Avoid (commonly unnecessary) copy for whitespace stripping
PR-URL: https://github.com/nodejs/node/pull/19598
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-03-30 14:30:40 +02:00
Daniel Bevenius
ebbf393600
src: name all builtin init functions Initialize
...
This commit renames a few of the builtin modules init functions to
Initialize for consistency.
PR-URL: https://github.com/nodejs/node/pull/19550
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-26 08:23:49 +02:00
Joyee Cheung
8484b40b3d
src: put bootstrappers in lib/internal/bootstrap/
...
Create `lib/internal/bootstrap/` and put bootstrappers there:
Before:
```
lib/internal
├── ...
├── bootstrap_loaders.js
└── bootstrap_node.js
```
After:
```
lib/internal
├── ...
└── bootstrap
├── loaders.js
└── node.js
```
PR-URL: https://github.com/nodejs/node/pull/19177
Refs: https://github.com/nodejs/node/pull/19112
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-03-15 20:50:34 +08:00
Ivan Filenko
36fd25fa05
src: free memory before re-setting URLHost value
...
Fixes: https://github.com/nodejs/node/issues/18302
PR-URL: https://github.com/nodejs/node/pull/18357
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2018-02-01 11:05:45 +01:00
Hakan Kimeiga
897f457f5d
url: added url fragment lookup table
...
Percent-encoded additional characters in fragment state with new
FRAGMENT_ENCODE_SET lookup table. The fragment percent-encode set
includes the C0 control percent-encode set and code points U+0020,
U+0022, U+003C, U+003E, and U+0060.
PR-URL: https://github.com/nodejs/node/pull/17627
Fixes: https://github.com/nodejs/node/issues/17540
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-15 09:26:12 -08:00
Anna Henningsen
e8a5f7bfb3
src: use correct OOB check for IPv6 parsing
...
`last_piece` pointed to the end of the 8×16 bit array,
so `piece_pointer == last_piece` already means that the pointer
is not writable any longer.
Previously, this still worked most of the time but could
result in an out-of-bounds-write.
Also, rename `last_piece` to `buffer_end` to avoid this pitfall.
PR-URL: https://github.com/nodejs/node/pull/17470
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-12-12 13:52:27 -02:00
Anna Henningsen
9236dfe1ef
src: make url host a proper C++ class
...
- Gives `URLHost` a proper destructor that clears memory
depending on the type of the host (This fixes a memory leak)
- Hide the host type enums and class layout as implementation details
- Make the `Parse` methods members of `URLHost`
- Turn `WriteHost` into a `ToString()` method on the `URLHost` class
- Verify that at the beginning of a parse attempt, the type is set
to “failed”
- Remove a lot of `goto`s from the source code 🐢 🚀
PR-URL: https://github.com/nodejs/node/pull/17470
Fixes: https://github.com/nodejs/node/issues/17448
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-12-12 13:52:27 -02:00
Anna Henningsen
89b374623f
src: move url internals into anonymous namespace
...
This helps because `static` doesn’t work for C++ classes,
but refactoring `url_host` into a proper C++ class seems the
most reasonable soluation for the memory leak fixed by the next commit.
PR-URL: https://github.com/nodejs/node/pull/17470
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-12-12 13:52:24 -02:00
Anna Henningsen
2050bab09c
src: minor cleanups to node_url.cc
...
- Remove pointless pointers
- Make `WriteHost` take a const argument so that it’s functionality
is clear from the signature
- Make `FindLongestZeroSequence` templated to accommodate the constness
in `WriteHost` and because using `uint16_t` is an articifial,
unnecessary restriction
- Remove string copying when no copies are needed
- Make `PercentDecode` just return its return value
- Make `ParseHost` (string-only version) take its constant argument
as a constant reference
PR-URL: https://github.com/nodejs/node/pull/17470
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-12-12 13:52:20 -02:00
Daniel Bevenius
e32bbbf4d7
src: use nullptr instead of NULL
...
PR-URL: https://github.com/nodejs/node/pull/17373
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-12-01 07:45:00 +01:00
Anna Henningsen
a01267265a
src: remove ClearFatalExceptionHandlers()
...
At its call sites, `ClearFatalExceptionHandlers()` was used to
make the process crash as soon as possible once an exception occurred,
without giving JS land a chance to interfere.
`ClearFatalExceptionHandlers()` awkwardly removed the current domain
and any `uncaughtException` handlers, whereas a clearer way is to
execute the relevant reporting (and `exit()`) code directly.
PR-URL: https://github.com/nodejs/node/pull/17333
Refs: https://github.com/nodejs/node/pull/17159
Refs: https://github.com/nodejs/node/pull/17324
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-11-29 15:58:42 +01:00
Daniel Bevenius
a515e593f3
src: rename base-object -> base_object
...
This commit renames base-object to base_object for consitency with other
c++ source files.
PR-URL: https://github.com/nodejs/node/pull/17022
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2017-11-17 12:49:10 +01:00
Yihong Wang
8680bb9f1a
src: explicitly register built-in modules
...
Previously, built-in modules are registered before main() via
__attribute__((constructor)) mechanism in GCC and similiar
mechanism in MSVC. This causes some issues when node is built as
static library. Calling module registration function for built-in
modules in node::Init() helps to avoid the issues.
Signed-off-by: Yihong Wang <yh.wang@ibm.com >
PR-URL: https://github.com/nodejs/node/pull/16565
Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-11-13 23:17:34 +00:00
Joyee Cheung
cdb263d3ba
src: do not include x.h if x-inl.h is included
...
PR-URL: https://github.com/nodejs/node/pull/16548
Fixes: https://github.com/nodejs/node/issues/16519
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-10-30 18:56:38 +08:00
Rimas Misevičius
92146e00fd
url: fix port overflow checking
...
This patch adds (port > 0xffff) check after each digit in the loop and
prevents integer overflow.
PR-URL: https://github.com/nodejs/node/pull/15794
Refs: https://github.com/w3c/web-platform-tests/pull/7602
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-10-10 08:13:19 -07:00
Ben Noordhuis
d9d46e7757
src: fix windows-only build breakage
...
Commit af6af08 introduced a build error in a Windows-only code path in
src/node_url.cc.
Fix it by making the code a little nicer in general: const-ify the
`input` parameter to `ToASCII()` and `ToUnicode()`.
PR-URL: https://github.com/nodejs/node/pull/15724
Refs: https://github.com/nodejs/node/pull/15615
Refs: https://github.com/nodejs/node/pull/15723
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-10-02 14:37:57 +02:00
Sam Roberts
af6af08482
url: const-ify APIs, and pass URL by ref
...
Fixes warnings by Coverity Scan of inefficiences when passing by value
instead of passing by const reference.
PR-URL: https://github.com/nodejs/node/pull/15615
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-10-01 20:20:06 -03:00
Rimas Misevičius
09b703bd3c
url: fix remaining calculation
...
Fix remaining calculation in the PercentDecode function to match the
definition in URL standard: https://url.spec.whatwg.org/#remaining
PR-URL: https://github.com/nodejs/node/pull/15637
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-09-29 09:25:19 -07:00
cjihrig
eee166f24d
src: remove unused variable in node_url.cc
...
PR-URL: https://github.com/nodejs/node/pull/15592
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2017-09-27 08:12:12 -04:00
cjihrig
75ab1e0d9f
src: remove unused computation
...
PR-URL: https://github.com/nodejs/node/pull/15593
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-27 07:52:43 -04:00
Benjamin Coe
456d8e21ea
url: fix windows drive letter handling
...
Address issue with Windows drive letter handling that was
causing es-module test suite to fail.
PR-URL: https://github.com/nodejs/node/pull/15490
Ref: https://github.com/whatwg/url/pull/343
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2017-09-24 14:12:56 -03:00
Anna Henningsen
290315ace7
src: refactor #include handling
...
`node_internals.h` already includes the most common headers,
so double includes can be avoided in a lot of cases. Also don’t include
`node_internals.h` from `node.h` implicitly anymore, as that is mostly
unnecessary.
PR-URL: https://github.com/nodejs/node/pull/14697
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-14 17:38:38 +02:00
Bradley Farias
c8a389e19f
module: Allow runMain to be ESM
...
This follows the EPS an allows the node CLI to have ESM as an entry point.
`node ./example.mjs`. A newer V8 is needed for `import()` so that is not
included. `import.meta` is still in specification stage so that also is not
included.
PR-URL: https://github.com/nodejs/node/pull/14369
Author: Bradley Farias <bradley.meck@gmail.com >
Author: Guy Bedford <guybedford@gmail.com >
Author: Jan Krems <jan.krems@groupon.com >
Author: Timothy Gu <timothygu99@gmail.com >
Author: Michaël Zasso <targos@protonmail.com >
Author: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2017-09-07 15:18:32 -05:00
Anna Henningsen
6a0e3b16f3
src: remove extra copy from Copy() in node_url.cc
...
The was copying the whole array and the strings in it without
any benefit.
PR-URL: https://github.com/nodejs/node/pull/14907
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-08-21 16:54:38 +02:00
Timothy Gu
e96ca62480
src: avoid dereference without existence check
...
Currently the URL API is only used from the JS binding, which always
initializes `base` regardless of `has_base`. Therefore, there is no
actual security risk right now, but would be had we made other C++ parts
of Node.js use this API.
An earlier version of this patch was created by Bradley Farias
<bradley.meck@gmail.com >.
PR-URL: https://github.com/nodejs/node/pull/14591
Refs: https://github.com/nodejs/node/pull/14369#discussion_r128767221
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-08-06 15:10:59 +08:00
Michaël Zasso
a3c5ccd78c
src: fix new V8 compiler warnings
...
PR-URL: https://github.com/nodejs/node/pull/14004
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-08-01 15:23:16 -05:00
Bradley Farias
d49e6693fe
url: do not use HandleScope in ToObject
...
It is not needed / invalidates the returned value unlike EscapableHandleScope
PR-URL: https://github.com/nodejs/node/pull/14096
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-07-17 09:29:30 -04:00
Timothy Gu
b01ac75edc
url: normalize port on scheme change
...
PR-URL: https://github.com/nodejs/node/pull/13997
Refs: https://github.com/whatwg/url/pull/328
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-07-05 12:07:15 +08:00
Timothy Gu
841bb4c61f
url: fix C0 control and whitespace handling
...
PR-URL: https://github.com/nodejs/node/pull/12846
Fixes: https://github.com/nodejs/node/issues/12825
Refs: https://github.com/w3c/web-platform-tests/pull/5792
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-05-19 23:19:57 -07:00
Daijiro Wachi
943dd5f9ed
url: handle windows drive letter in the file state
...
`C|` should not satisfy the condition to not copy
the base's path. It also synchronises WPT url test data
to verify the update in upstream.
PR-URL: https://github.com/nodejs/node/pull/12808
Refs: https://github.com/whatwg/url/pull/305
Refs: https://github.com/w3c/web-platform-tests/pull/5754
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-05-04 18:20:45 -07:00
Timothy Gu
b2870a4f8c
url: update WHATWG URL API to latest spec
...
- Update to spec
- Add opaque hosts
- File state did not correctly deal with lack of base URL
- Cleanup API for file and non-special URLs
- Allow % and IPv6 addresses in non-special URL hosts
- Use specific names for percent-encode sets
- Add empty host concept for file and non-special URLs
- Clarify IPv6 serializer
- Fix existing mistakes
- Add missing ':' to forbidden host code point list.
- Correct IPv4 parser empty label behavior
- Maintain type equivalence in URLContext with spec
- scheme, username, and password should always be strings
- host, port, query, and fragment may be strings or null
- Align scheme state more closely with the spec
- Make sure the `special` variable is always synced with
URL_FLAG_SPECIAL.
PR-URL: https://github.com/nodejs/node/pull/12523
Fixes: https://github.com/nodejs/node/issues/10608
Fixes: https://github.com/nodejs/node/issues/10634
Refs: https://github.com/whatwg/url/pull/185
Refs: https://github.com/whatwg/url/pull/225
Refs: https://github.com/whatwg/url/pull/224
Refs: https://github.com/whatwg/url/pull/218
Refs: https://github.com/whatwg/url/pull/243
Refs: https://github.com/whatwg/url/pull/260
Refs: https://github.com/whatwg/url/pull/268
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-04-24 16:36:03 -07:00
Timothy Gu
ade80eeb1a
src: clean up WHATWG WG parser
...
* reduce indentation
* refactor URL inlined methods
* prefer templates over macros
* do not export ARG_* flags in url binding
PR-URL: https://github.com/nodejs/node/pull/12251
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-04-17 09:11:56 -07:00
Daijiro Wachi
1b99d8ffe9
url: disallow invalid IPv4 in IPv6 parser
...
Fixes: https://github.com/nodejs/node/issues/10655
PR-URL: https://github.com/nodejs/node/pull/12315
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-04-14 18:12:16 +02:00
Daijiro Wachi
b470a85f07
url: trim leading slashes of file URL paths
...
It should trim the slashes after the colon into three for file URL.
PR-URL: https://github.com/nodejs/node/pull/12203
Refs: https://github.com/w3c/web-platform-tests/pull/5195
Fixes: https://github.com/nodejs/node/issues/11188
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-04-10 18:09:06 +02:00
Daijiro Wachi
f8f46f9917
url: change path parsing for non-special URLs
...
This changes to the way path parsing for non-special URLs.
It allows paths to be empty for non-special URLs and also
takes that into account when serializing.
Fixes: https://github.com/nodejs/node/issues/11962
Refs: https://github.com/whatwg/url/pull/213
PR-URL: https://github.com/nodejs/node/pull/12058
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-04-03 18:11:51 +09:00
Timothy Gu
4ddd23f0ec
src: WHATWG URL C++ parser cleanup
...
- Clarify port state
- Remove scheme flag
- Clarify URL_FLAG_TERMINATED
PR-URL: https://github.com/nodejs/node/pull/11917
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-03-29 22:19:33 -07:00