Anna Henningsen
33ffaa49ba
src: use const reference instead of pointer in URL::SerializeURL
...
Just some general cleanup to make things C++-y instead of C-y.
PR-URL: https://github.com/nodejs/node/pull/41759
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2022-02-11 11:40:12 +00:00
Anna Henningsen
889534ec35
src: reserve string allocation space early in URL::SerializeURL
...
This can be useful for performance when doing many string
concatenations.
PR-URL: https://github.com/nodejs/node/pull/41759
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2022-02-11 11:40:11 +00:00
Anna Henningsen
acd35ecbe7
src: fix query/fragment serialization in URL::SerializeURL
...
These are presumably typos.
PR-URL: https://github.com/nodejs/node/pull/41759
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2022-02-11 11:40:10 +00:00
Anna Henningsen
e5084d33f0
src: slightly simplify URLHost::ToString
...
PR-URL: https://github.com/nodejs/node/pull/41747
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Mestery <mestery@protonmail.com >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-02-05 08:04:17 -08:00
Tobias Nießen
5e0dd79a3c
src: add and fix some preprocessor comments
...
PR-URL: https://github.com/nodejs/node/pull/40701
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-11-10 15:24:22 +01:00
XadillaX
0e561de643
src: move ToUSVString() to node_util.cc
...
Since `toUSVString()` was exposed in `util` as a public API, not only
for internal `url` any more.
PR-URL: https://github.com/nodejs/node/pull/40204
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-09-26 16:57:47 +08:00
Shelley Vohr
f8836b208c
src: fix -Wunreachable-code-return error
...
PR-URL: https://github.com/nodejs/node/pull/40034
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-09-11 09:55:48 +02:00
Darshan Sen
00cac65af1
url: prevent pathname setter from erasing path of path-only URLs
...
This change prevents the pathname setter from erasing the path of
path-only URLs as that would make them cannot-be-a-base URLs.
The changes in all files except `src/node_url.cc` have been done by
running:
```console
git node wpt url
```
Fixes: https://github.com/nodejs/node/issues/39059
Signed-off-by: Darshan Sen <darshan.sen@postman.com >
PR-URL: https://github.com/nodejs/node/pull/39060
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2021-07-18 05:41:21 +00:00
XadillaX
38a15d832a
src,url: separate some tables out of node_url.cc
...
The purpose of separating is for readability and maintainability.
PR-URL: https://github.com/nodejs/node/pull/38988
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2021-06-17 11:08:32 +08:00
XadillaX
c109a6cc83
url,src: simplify ipv6 logic by using uv_inet_pton
...
PR-URL: https://github.com/nodejs/node/pull/38842
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-06-10 14:26:34 +08:00
Timothy Gu
bf06daa656
url: exit early when : delimiter is seen in hostname
...
This aligns with an upstream spec change.
PR-URL: https://github.com/nodejs/node/pull/38742
Fixes: https://github.com/nodejs/node/issues/38710
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-05-22 17:46:05 -07:00
Darshan Sen
4197555ca9
url: forbid pipe in URL host
...
Fixes: https://github.com/nodejs/node/issues/37862
PR-URL: https://github.com/nodejs/node/pull/37877
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-03-30 04:04:22 -07:00
Michaël Zasso
d1f1fcfe0c
src: avoid implicit type conversions (take 2)
...
This fixes more C4244 MSVC warnings in the code base.
Refs: https://github.com/nodejs/node/pull/37149
PR-URL: https://github.com/nodejs/node/pull/37334
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-02-20 10:50:28 +01:00
raisinten
b8c15c7413
src: fix leading backslash bug in URL
...
The associated condition mentioned in the URL parsing algorithm of the
WHATWG URL Standard is:
url is special and c is U+005C (\)
So, `special_back_slash` must be updated whenever `special` is updated.
Fixes: https://github.com/nodejs/node/issues/36559
PR-URL: https://github.com/nodejs/node/pull/36613
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-12-31 12:31:03 -08:00
Daijiro Wachi
e40ed2856f
src: integrate URL::href() and use in inspector
...
PR-URL: https://github.com/nodejs/node/pull/35912
Refs: https://github.com/nodejs/node/issues/22610
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-11-22 00:02:32 +09:00
Daijiro Wachi
7afe3af200
url: fix file url reparse
...
Fixes: https://github.com/nodejs/node/issues/35571
Refs: https://github.com/whatwg/url/pull/550
Refs: https://github.com/web-platform-tests/wpt/pull/25989
PR-URL: https://github.com/nodejs/node/pull/35671
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2020-10-19 15:52:45 +09:00
Daijiro Wachi
bb62f4ad9e
url: file URL path normalization
...
Refs: https://github.com/whatwg/url/pull/544
Refs: https://github.com/web-platform-tests/wpt/pull/25716
PR-URL: https://github.com/nodejs/node/pull/35477
Fixes: https://github.com/nodejs/node/issues/35429
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2020-10-12 15:06:55 +09:00
Michaël Zasso
69ef4c2375
url: verify domain is not empty after "ToASCII"
...
Port of https://github.com/whatwg/url/pull/497
PR-URL: https://github.com/nodejs/node/pull/33770
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2020-09-16 06:23:41 +00:00
Michaël Zasso
4831278a16
url: remove U+0000 case in the fragment state
...
Port of https://github.com/whatwg/url/pull/486
PR-URL: https://github.com/nodejs/node/pull/33770
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2020-09-16 06:23:40 +00:00
Tobias Nießen
1be7bbdc3b
src: prefer C++ empty() in boolean expressions
...
PR-URL: https://github.com/nodejs/node/pull/34432
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2020-08-11 13:22:04 -07:00
Joyee Cheung
7a447bcd54
src: snapshot node
...
This runs `lib/internal/bootstrap/node.js` before creating
the builtin snapshot and deserialize the loaders from the
snapshot in deserialization mode.
PR-URL: https://github.com/nodejs/node/pull/32984
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2020-07-18 11:23:21 +08:00
Anna Henningsen
a038199265
src,doc,test: remove String::New default parameter
...
`kNormal` has been the implicit default for a while now (since V8 7.6).
Refs: https://github.com/v8/v8/commit/e0d7f816990ada28ebe1281ca9431236ef8c6e4f
PR-URL: https://github.com/nodejs/node/pull/34248
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-07-14 15:13:34 +02:00
Michaël Zasso
0d08d5ae7c
url: remove gopher from special schemes
...
Refs: https://github.com/nodejs/node/issues/33315
Refs: https://github.com/whatwg/url/commit/d589670451a4da9717bad69ed5d5364f93fede33
Refs: https://github.com/whatwg/url/commit/7ae1c691c96f0d82fafa24c33aa1e8df9ffbf2bc
PR-URL: https://github.com/nodejs/node/pull/33325
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-06-06 11:11:02 +02:00
Anna Henningsen
3f32126fd5
src: avoid OOB read in URL parser
...
This is not a big concern, because right now, all (non-test) inputs
to the parser are `'\0'`-terminated, but we should be future-proof
here and not perform these OOB reads.
PR-URL: https://github.com/nodejs/node/pull/33640
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-05-30 10:26:24 -07:00
Yash Ladha
9be51ee9a1
url: forbid lt and gt in url host code point
...
As per the recent changes in whatwg/url spec. lt and gt are also added
in the list of forbidden hostCodePoint list.
PR-URL: https://github.com/nodejs/node/pull/33328
Refs: https://github.com/whatwg/url/pull/459
Refs: https://github.com/nodejs/node/issues/33315
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2020-05-23 21:36:51 +02:00
Anna Henningsen
2b1c18f03d
src: fix compile warnings in node_url.cc
...
Since for all affected conversions there is a preceding type check,
it’s safe to use `.FromJust()` instead.
This fixes the following compile warnings:
../src/node_url.cc: In function ‘void node::url::{anonymous}::ToUSVString(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_url.cc:2242:43: warning: ignoring return value of ‘bool v8::Maybe<T>::To(T*) const [with T = long int]’, declared with attribute warn_unused_result [-Wunused-result]
2242 | args[1]->IntegerValue(env->context()).To(&start);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
../src/node_url.cc: In function ‘node::url::url_data node::url::{anonymous}::HarvestBase(node::Environment*, v8::Local<v8::Object>)’:
../src/node_url.cc:1206:34: warning: ignoring return value of ‘bool v8::Maybe<T>::To(T*) const [with T = int]’, declared with attribute warn_unused_result [-Wunused-result]
1206 | flags->Int32Value(context).To(&base.flags);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../src/node_url.cc:1211:33: warning: ignoring return value of ‘bool v8::Maybe<T>::To(T*) const [with T = int]’, declared with attribute warn_unused_result [-Wunused-result]
1211 | port->Int32Value(context).To(&base.port);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
../src/node_url.cc: In function ‘void node::url::{anonymous}::ToUSVString(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_url.cc:2245:15: warning: ‘start’ may be used uninitialized in this function [-Wmaybe-uninitialized]
2245 | for (size_t i = start; i < value.length(); i++) {
| ^
PR-URL: https://github.com/nodejs/node/pull/31689
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-02-10 15:43:05 +01:00
James M Snell
aee3e2bc4c
src: various minor improvements to node_url
...
Went hunting for possible performance improvements. Didn't find
anything significant but did manage to make a number of style
improvements that bring more in line with style guidelines and
good pratice.
PR-URL: https://github.com/nodejs/node/pull/31651
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-02-07 23:29:43 +01:00
Sam Roberts
b6bfc19378
src: remove util-inl.h from header files
...
Its intended that *-inl.h header files are only included into the src
files that call the inline methods. Explicitly include it into the files
that need it.
PR-URL: https://github.com/nodejs/node/pull/27631
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-05-13 13:43:26 -07:00
gengjiawen
f091d4e840
src: apply clang-tidy rule modernize-use-emplace
...
PR-URL: https://github.com/nodejs/node/pull/26564
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-03-21 07:23:44 +01:00
Refael Ackermann
f2064dfc1f
src: de-lint header usage
...
PR-URL: https://github.com/nodejs/node/pull/26306
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-03-12 09:57:19 -04:00
gengjiawen
8137668c53
src: apply clang-tidy rule modernize-deprecated-headers
...
PR-URL: https://github.com/nodejs/node/pull/26159
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-27 05:35:53 +01:00
Joyee Cheung
1838d00eba
src: reduce includes of node_internals.h
...
PR-URL: https://github.com/nodejs/node/pull/25507
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-01-21 07:54:42 +01:00
Anna Henningsen
0ff1eb83d9
src: simplify JS Array creation
...
Use `ToV8Value()` where appropriate to reduce duplication
and avoid extra `Array::Set()` calls.
PR-URL: https://github.com/nodejs/node/pull/25288
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-01-02 14:46:14 +01:00
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