@@ -50,7 +50,7 @@ var require_symbols = __commonJS({
50
50
kClient : Symbol ( "client" ) ,
51
51
kParser : Symbol ( "parser" ) ,
52
52
kOnDestroyed : Symbol ( "destroy callbacks" ) ,
53
- kPipelining : Symbol ( "pipelinig " ) ,
53
+ kPipelining : Symbol ( "pipelining " ) ,
54
54
kSocket : Symbol ( "socket" ) ,
55
55
kHostHeader : Symbol ( "host header" ) ,
56
56
kConnector : Symbol ( "connector" ) ,
@@ -319,30 +319,30 @@ var require_util = __commonJS({
319
319
if ( typeof url === "string" ) {
320
320
url = new URL ( url ) ;
321
321
if ( ! / ^ h t t p s ? : / . test ( url . origin || url . protocol ) ) {
322
- throw new InvalidArgumentError ( "invalid protocol" ) ;
322
+ throw new InvalidArgumentError ( "Invalid URL protocol: the URL must start with `http:` or `https:`. " ) ;
323
323
}
324
324
return url ;
325
325
}
326
326
if ( ! url || typeof url !== "object" ) {
327
- throw new InvalidArgumentError ( "invalid url " ) ;
327
+ throw new InvalidArgumentError ( "Invalid URL: The URL argument must be a non-null object. " ) ;
328
328
}
329
329
if ( url . port != null && url . port !== "" && ! Number . isFinite ( parseInt ( url . port ) ) ) {
330
- throw new InvalidArgumentError ( "invalid port" ) ;
330
+ throw new InvalidArgumentError ( "Invalid URL: port must be a valid integer or a string representation of an integer. " ) ;
331
331
}
332
332
if ( url . path != null && typeof url . path !== "string" ) {
333
- throw new InvalidArgumentError ( "invalid path" ) ;
333
+ throw new InvalidArgumentError ( "Invalid URL path: the path must be a string or null/undefined. " ) ;
334
334
}
335
335
if ( url . pathname != null && typeof url . pathname !== "string" ) {
336
- throw new InvalidArgumentError ( "invalid pathname" ) ;
336
+ throw new InvalidArgumentError ( "Invalid URL pathname: the pathname must be a string or null/undefined. " ) ;
337
337
}
338
338
if ( url . hostname != null && typeof url . hostname !== "string" ) {
339
- throw new InvalidArgumentError ( "invalid hostname" ) ;
339
+ throw new InvalidArgumentError ( "Invalid URL hostname: the hostname must be a string or null/undefined. " ) ;
340
340
}
341
341
if ( url . origin != null && typeof url . origin !== "string" ) {
342
- throw new InvalidArgumentError ( "invalid origin" ) ;
342
+ throw new InvalidArgumentError ( "Invalid URL origin: the origin must be a string or null/undefined. " ) ;
343
343
}
344
344
if ( ! / ^ h t t p s ? : / . test ( url . origin || url . protocol ) ) {
345
- throw new InvalidArgumentError ( "invalid protocol" ) ;
345
+ throw new InvalidArgumentError ( "Invalid URL protocol: the URL must start with `http:` or `https:`. " ) ;
346
346
}
347
347
if ( ! ( url instanceof URL ) ) {
348
348
const port = url . port != null ? url . port : url . protocol === "https:" ? 443 : 80 ;
@@ -570,6 +570,15 @@ var require_util = __commonJS({
570
570
}
571
571
}
572
572
}
573
+ var hasToWellFormed = ! ! String . prototype . toWellFormed ;
574
+ function toUSVString ( val ) {
575
+ if ( hasToWellFormed ) {
576
+ return `${ val } ` . toWellFormed ( ) ;
577
+ } else if ( nodeUtil . toUSVString ) {
578
+ return nodeUtil . toUSVString ( val ) ;
579
+ }
580
+ return `${ val } ` ;
581
+ }
573
582
var kEnumerableProperty = /* @__PURE__ */ Object . create ( null ) ;
574
583
kEnumerableProperty . enumerable = true ;
575
584
module2 . exports = {
@@ -578,7 +587,7 @@ var require_util = __commonJS({
578
587
isDisturbed,
579
588
isErrored,
580
589
isReadable,
581
- toUSVString : nodeUtil . toUSVString || ( ( val ) => ` ${ val } ` ) ,
590
+ toUSVString,
582
591
isReadableAborted,
583
592
isBlobLike,
584
593
parseOrigin,
@@ -725,7 +734,8 @@ var require_constants = __commonJS({
725
734
"content-encoding" ,
726
735
"content-language" ,
727
736
"content-location" ,
728
- "content-type"
737
+ "content-type" ,
738
+ "content-length"
729
739
] ;
730
740
var requestDuplex = [
731
741
"half"
@@ -863,7 +873,7 @@ var require_util2 = __commonJS({
863
873
}
864
874
function requestBadPort ( request ) {
865
875
const url = requestCurrentURL ( request ) ;
866
- if ( / ^ h t t p s ? : / . test ( url . protocol ) && badPorts . includes ( url . port ) ) {
876
+ if ( urlIsHttpHttpsScheme ( url ) && badPorts . includes ( url . port ) ) {
867
877
return "blocked" ;
868
878
}
869
879
return "allowed" ;
@@ -955,7 +965,7 @@ var require_util2 = __commonJS({
955
965
case "no-referrer-when-downgrade" :
956
966
case "strict-origin" :
957
967
case "strict-origin-when-cross-origin" :
958
- if ( / ^ h t t p s : / . test ( request . origin ) && ! / ^ h t t p s : / . test ( requestCurrentURL ( request ) ) ) {
968
+ if ( request . origin && urlHasHttpsScheme ( request . origin ) && ! urlHasHttpsScheme ( requestCurrentURL ( request ) ) ) {
959
969
serializedOrigin = null ;
960
970
}
961
971
break ;
@@ -1272,6 +1282,22 @@ var require_util2 = __commonJS({
1272
1282
byteLength += chunk . length ;
1273
1283
}
1274
1284
}
1285
+ function urlIsLocal ( url ) {
1286
+ assert ( "protocol" in url ) ;
1287
+ const protocol = url . protocol ;
1288
+ return protocol === "about:" || protocol === "blob:" || protocol === "data:" ;
1289
+ }
1290
+ function urlHasHttpsScheme ( url ) {
1291
+ if ( typeof url === "string" ) {
1292
+ return url . startsWith ( "https:" ) ;
1293
+ }
1294
+ return url . protocol === "https:" ;
1295
+ }
1296
+ function urlIsHttpHttpsScheme ( url ) {
1297
+ assert ( "protocol" in url ) ;
1298
+ const protocol = url . protocol ;
1299
+ return protocol === "http:" || protocol === "https:" ;
1300
+ }
1275
1301
var hasOwn = Object . hasOwn || ( ( dict , key ) => Object . prototype . hasOwnProperty . call ( dict , key ) ) ;
1276
1302
module2 . exports = {
1277
1303
isAborted,
@@ -1312,7 +1338,10 @@ var require_util2 = __commonJS({
1312
1338
isReadableStreamLike,
1313
1339
readableStreamClose,
1314
1340
isomorphicEncode,
1315
- isomorphicDecode
1341
+ isomorphicDecode,
1342
+ urlIsLocal,
1343
+ urlHasHttpsScheme,
1344
+ urlIsHttpHttpsScheme
1316
1345
} ;
1317
1346
}
1318
1347
} ) ;
@@ -6122,13 +6151,7 @@ var require_formdata = __commonJS({
6122
6151
webidl . brandCheck ( this , FormData ) ;
6123
6152
webidl . argumentLengthCheck ( arguments , 1 , { header : "FormData.delete" } ) ;
6124
6153
name = webidl . converters . USVString ( name ) ;
6125
- const next = [ ] ;
6126
- for ( const entry of this [ kState ] ) {
6127
- if ( entry . name !== name ) {
6128
- next . push ( entry ) ;
6129
- }
6130
- }
6131
- this [ kState ] = next ;
6154
+ this [ kState ] = this [ kState ] . filter ( ( entry ) => entry . name !== name ) ;
6132
6155
}
6133
6156
get ( name ) {
6134
6157
webidl . brandCheck ( this , FormData ) ;
@@ -6799,9 +6822,7 @@ var require_response = __commonJS({
6799
6822
return makeResponse ( {
6800
6823
type : "error" ,
6801
6824
status : 0 ,
6802
- error : isError ? reason : new Error ( reason ? String ( reason ) : reason , {
6803
- cause : isError ? reason : void 0
6804
- } ) ,
6825
+ error : isError ? reason : new Error ( reason ? String ( reason ) : reason ) ,
6805
6826
aborted : reason && reason . name === "AbortError"
6806
6827
} ) ;
6807
6828
}
@@ -7011,6 +7032,7 @@ var require_request = __commonJS({
7011
7032
var { setMaxListeners, getEventListeners, defaultMaxListeners } = require ( "events" ) ;
7012
7033
var TransformStream = globalThis . TransformStream ;
7013
7034
var kInit = Symbol ( "init" ) ;
7035
+ var kAbortController = Symbol ( "abortController" ) ;
7014
7036
var requestFinalizer = new FinalizationRegistry ( ( { signal, abort } ) => {
7015
7037
signal . removeEventListener ( "abort" , abort ) ;
7016
7038
} ) ;
@@ -7057,10 +7079,10 @@ var require_request = __commonJS({
7057
7079
if ( request . window ?. constructor ?. name === "EnvironmentSettingsObject" && sameOrigin ( request . window , origin ) ) {
7058
7080
window = request . window ;
7059
7081
}
7060
- if ( init . window !== void 0 && init . window != null ) {
7082
+ if ( init . window != null ) {
7061
7083
throw new TypeError ( `'window' option '${ window } ' must be null` ) ;
7062
7084
}
7063
- if ( init . window !== void 0 ) {
7085
+ if ( " window" in init ) {
7064
7086
window = "no-window" ;
7065
7087
}
7066
7088
request = makeRequest ( {
@@ -7170,8 +7192,13 @@ var require_request = __commonJS({
7170
7192
if ( signal . aborted ) {
7171
7193
ac . abort ( signal . reason ) ;
7172
7194
} else {
7195
+ this [ kAbortController ] = ac ;
7196
+ const acRef = new WeakRef ( ac ) ;
7173
7197
const abort = function ( ) {
7174
- ac . abort ( this . reason ) ;
7198
+ const ac2 = acRef . deref ( ) ;
7199
+ if ( ac2 !== void 0 ) {
7200
+ ac2 . abort ( this . reason ) ;
7201
+ }
7175
7202
} ;
7176
7203
try {
7177
7204
if ( getEventListeners ( signal , "abort" ) . length >= defaultMaxListeners ) {
@@ -7180,7 +7207,7 @@ var require_request = __commonJS({
7180
7207
} catch {
7181
7208
}
7182
7209
signal . addEventListener ( "abort" , abort , { once : true } ) ;
7183
- requestFinalizer . register ( this , { signal, abort } ) ;
7210
+ requestFinalizer . register ( ac , { signal, abort } ) ;
7184
7211
}
7185
7212
}
7186
7213
this [ kHeaders ] = new Headers ( ) ;
@@ -7208,11 +7235,11 @@ var require_request = __commonJS({
7208
7235
}
7209
7236
}
7210
7237
const inputBody = input instanceof Request ? input [ kState ] . body : null ;
7211
- if ( ( init . body !== void 0 && init . body != null || inputBody != null ) && ( request . method === "GET" || request . method === "HEAD" ) ) {
7238
+ if ( ( init . body != null || inputBody != null ) && ( request . method === "GET" || request . method === "HEAD" ) ) {
7212
7239
throw new TypeError ( "Request with GET/HEAD method cannot have body." ) ;
7213
7240
}
7214
7241
let initBody = null ;
7215
- if ( init . body !== void 0 && init . body != null ) {
7242
+ if ( init . body != null ) {
7216
7243
const [ extractedBody , contentType ] = extractBody ( init . body , request . keepalive ) ;
7217
7244
initBody = extractedBody ;
7218
7245
if ( contentType && ! this [ kHeaders ] [ kHeadersList ] . contains ( "content-type" ) ) {
@@ -10536,7 +10563,10 @@ var require_fetch = __commonJS({
10536
10563
isErrorLike,
10537
10564
fullyReadBody,
10538
10565
readableStreamClose,
10539
- isomorphicEncode
10566
+ isomorphicEncode,
10567
+ urlIsLocal,
10568
+ urlIsHttpHttpsScheme,
10569
+ urlHasHttpsScheme
10540
10570
} = require_util2 ( ) ;
10541
10571
var { kState, kHeaders, kGuard, kRealm, kHeadersCaseInsensitive } = require_symbols2 ( ) ;
10542
10572
var assert = require ( "assert" ) ;
@@ -10659,7 +10689,7 @@ var require_fetch = __commonJS({
10659
10689
const originalURL = response . urlList [ 0 ] ;
10660
10690
let timingInfo = response . timingInfo ;
10661
10691
let cacheState = response . cacheState ;
10662
- if ( ! / ^ h t t p s ? : / . test ( originalURL . protocol ) ) {
10692
+ if ( ! urlIsHttpHttpsScheme ( originalURL ) ) {
10663
10693
return ;
10664
10694
}
10665
10695
if ( timingInfo === null ) {
@@ -10771,7 +10801,7 @@ var require_fetch = __commonJS({
10771
10801
async function mainFetch ( fetchParams , recursive = false ) {
10772
10802
const request = fetchParams . request ;
10773
10803
let response = null ;
10774
- if ( request . localURLsOnly && ! / ^ ( a b o u t | b l o b | d a t a ) : / . test ( requestCurrentURL ( request ) . protocol ) ) {
10804
+ if ( request . localURLsOnly && ! urlIsLocal ( requestCurrentURL ( request ) ) ) {
10775
10805
response = makeNetworkError ( "local URLs only" ) ;
10776
10806
}
10777
10807
tryUpgradeRequestToAPotentiallyTrustworthyURL ( request ) ;
@@ -10801,7 +10831,7 @@ var require_fetch = __commonJS({
10801
10831
request . responseTainting = "opaque" ;
10802
10832
return await schemeFetch ( fetchParams ) ;
10803
10833
}
10804
- if ( ! / ^ h t t p s ? : / . test ( requestCurrentURL ( request ) . protocol ) ) {
10834
+ if ( ! urlIsHttpHttpsScheme ( requestCurrentURL ( request ) ) ) {
10805
10835
return makeNetworkError ( "URL scheme must be a HTTP(S) scheme" ) ;
10806
10836
}
10807
10837
request . responseTainting = "cors" ;
@@ -11025,7 +11055,7 @@ var require_fetch = __commonJS({
11025
11055
} catch ( err ) {
11026
11056
return makeNetworkError ( err ) ;
11027
11057
}
11028
- if ( ! / ^ h t t p s ? : / . test ( locationURL . protocol ) ) {
11058
+ if ( ! urlIsHttpHttpsScheme ( locationURL ) ) {
11029
11059
return makeNetworkError ( "URL scheme must be a HTTP(S) scheme" ) ;
11030
11060
}
11031
11061
if ( request . redirectCount === 20 ) {
@@ -11052,7 +11082,7 @@ var require_fetch = __commonJS({
11052
11082
request . headersList . delete ( "authorization" ) ;
11053
11083
}
11054
11084
if ( request . body != null ) {
11055
- assert ( request . body . source ) ;
11085
+ assert ( request . body . source != null ) ;
11056
11086
request . body = safelyExtractBody ( request . body . source ) [ 0 ] ;
11057
11087
}
11058
11088
const timingInfo = fetchParams . timingInfo ;
@@ -11119,7 +11149,7 @@ var require_fetch = __commonJS({
11119
11149
httpRequest . headersList . append ( "accept-encoding" , "identity" ) ;
11120
11150
}
11121
11151
if ( ! httpRequest . headersList . contains ( "accept-encoding" ) ) {
11122
- if ( / ^ h t t p s : / . test ( requestCurrentURL ( httpRequest ) . protocol ) ) {
11152
+ if ( urlHasHttpsScheme ( requestCurrentURL ( httpRequest ) ) ) {
11123
11153
httpRequest . headersList . append ( "accept-encoding" , "br, gzip, deflate" ) ;
11124
11154
} else {
11125
11155
httpRequest . headersList . append ( "accept-encoding" , "gzip, deflate" ) ;
@@ -11279,6 +11309,7 @@ var require_fetch = __commonJS({
11279
11309
fetchParams . controller . resume = async ( ) => {
11280
11310
while ( true ) {
11281
11311
let bytes ;
11312
+ let isFailure ;
11282
11313
try {
11283
11314
const { done, value } = await fetchParams . controller . next ( ) ;
11284
11315
if ( isAborted ( fetchParams ) ) {
@@ -11290,6 +11321,7 @@ var require_fetch = __commonJS({
11290
11321
bytes = void 0 ;
11291
11322
} else {
11292
11323
bytes = err ;
11324
+ isFailure = true ;
11293
11325
}
11294
11326
}
11295
11327
if ( bytes === void 0 ) {
@@ -11298,7 +11330,7 @@ var require_fetch = __commonJS({
11298
11330
return ;
11299
11331
}
11300
11332
timingInfo . decodedBodySize += bytes ?. byteLength ?? 0 ;
11301
- if ( isErrorLike ( bytes ) ) {
11333
+ if ( isFailure ) {
11302
11334
fetchParams . controller . terminate ( bytes ) ;
11303
11335
return ;
11304
11336
}
@@ -11362,7 +11394,7 @@ var require_fetch = __commonJS({
11362
11394
const key = headersList [ n + 0 ] . toString ( "latin1" ) ;
11363
11395
const val = headersList [ n + 1 ] . toString ( "latin1" ) ;
11364
11396
if ( key . toLowerCase ( ) === "content-encoding" ) {
11365
- codings = val . split ( "," ) . map ( ( x ) => x . trim ( ) ) ;
11397
+ codings = val . toLowerCase ( ) . split ( "," ) . map ( ( x ) => x . trim ( ) ) ;
11366
11398
} else if ( key . toLowerCase ( ) === "location" ) {
11367
11399
location = val ;
11368
11400
}
@@ -11373,9 +11405,9 @@ var require_fetch = __commonJS({
11373
11405
const willFollow = request . redirect === "follow" && location && redirectStatus . includes ( status ) ;
11374
11406
if ( request . method !== "HEAD" && request . method !== "CONNECT" && ! nullBodyStatus . includes ( status ) && ! willFollow ) {
11375
11407
for ( const coding of codings ) {
11376
- if ( / ( x - ) ? g z i p / . test ( coding ) ) {
11408
+ if ( coding === "x- gzip" || coding === "gzip" ) {
11377
11409
decoders . push ( zlib . createGunzip ( ) ) ;
11378
- } else if ( / ( x - ) ? d e f l a t e / . test ( coding ) ) {
11410
+ } else if ( coding === "deflate" ) {
11379
11411
decoders . push ( zlib . createInflate ( ) ) ;
11380
11412
} else if ( coding === "br" ) {
11381
11413
decoders . push ( zlib . createBrotliDecompress ( ) ) ;
0 commit comments