url: introduce native URL class for internal use#11801
url: introduce native URL class for internal use#11801jasnell wants to merge 1 commit intonodejs:masterfrom
Conversation
|
Can you add some gtests for this new API? |
src/node_url.cc
Outdated
There was a problem hiding this comment.
Maybe it’s just me, but I’d probably find it more readable if these methods were just inlined
There was a problem hiding this comment.
hmm... I guess... I prefer the inlined methods personally but I can change it up
src/node_url.h
Outdated
There was a problem hiding this comment.
This can probably be const struct url_data* base?
src/node_url.h
Outdated
src/node_url.h
Outdated
There was a problem hiding this comment.
I think there’s no reason to not make these methods return const references, i.e. const std::string& protocol() const { … } (except path())?
|
@TimothyGu ... yep, I intend to, just ran out of time on Friday and wanted to get this out so that @bmeck had something he could start working with. Will look at adding tests on Monday. |
|
@addaleax ... addressed your feedback. @TimothyGu ... adding a gtest is going to be more involved. I'd like to add that later in a separate PR so that I can get this landed for @bmeck to use. |
|
CI is 🍏 |
addaleax
left a comment
There was a problem hiding this comment.
LGTM
(And yeah, this is definitely more readable. Thank you!)
|
@TimothyGu ... once #11956 lands I will be able to get tests added for the native class. |
Adds a URL native class for use within the node.js c/c++
code. This is primarily intended to be used by the eventual
ES6 modules implementation but can be used generally wherever
URL parsing within the c/c++ may be necessary.
```c
URL url1("http://example.org");
URL url2("foo", "http://example.org/bar");
URL url3("baz", &url2);
```
While we're at it, reduce reliance on macros to simplify impl.
Adds a URL native class for use within the node.js c/c++
code. This is primarily intended to be used by the eventual
ES6 modules implementation but can be used generally wherever
URL parsing within the c/c++ may be necessary.
```c
URL url1("http://example.org");
URL url2("foo", "http://example.org/bar");
URL url3("baz", &url2);
```
While we're at it, reduce reliance on macros to simplify impl.
PR-URL: #11801
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
Landed in e26b6c6 |
Adds a URL native class for use within the node.js c/c++
code. This is primarily intended to be used by the eventual
ES6 modules implementation but can be used generally wherever
URL parsing within the c/c++ may be necessary.
```c
URL url1("http://example.org");
URL url2("foo", "http://example.org/bar");
URL url3("baz", &url2);
```
While we're at it, reduce reliance on macros to simplify impl.
PR-URL: #11801
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable changes:
* buffer:
- do not segfault on out-of-range index (Timothy Gu)
#11927
* crypto:
- Fix memory leak if certificate is revoked (Tom Atkinson)
#12089
* deps:
* upgrade npm to 4.2.0 (Kat Marchán)
#11389
* fix async await desugaring in V8 (Michaël Zasso)
#12004
* readline:
- add option to stop duplicates in history (Danny Nemer)
#2982
* src:
- add native URL class (James M Snell)
#11801
PR-URL: #12104
Notable changes:
* buffer:
- do not segfault on out-of-range index (Timothy Gu)
#11927
* crypto:
- Fix memory leak if certificate is revoked (Tom Atkinson)
#12089
* deps:
* upgrade npm to 4.2.0 (Kat Marchán)
#11389
* fix async await desugaring in V8 (Michaël Zasso)
#12004
* readline:
- add option to stop duplicates in history (Danny Nemer)
#2982
* src:
- add native URL class (James M Snell)
#11801
PR-URL: #12104
Notable changes:
* buffer:
- do not segfault on out-of-range index (Timothy Gu)
nodejs/node#11927
* crypto:
- Fix memory leak if certificate is revoked (Tom Atkinson)
nodejs/node#12089
* deps:
* upgrade npm to 4.2.0 (Kat Marchán)
nodejs/node#11389
* fix async await desugaring in V8 (Michaël Zasso)
nodejs/node#12004
* readline:
- add option to stop duplicates in history (Danny Nemer)
nodejs/node#2982
* src:
- add native URL class (James M Snell)
nodejs/node#11801
PR-URL: nodejs/node#12104
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
Provides a native URL class that uses the WHATWG URL algorithm.
This is intended primarily to support the ES6 modules implementation work (which will need WHATWG URL processing).
/cc @bmeck
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
url