fix(pockethost): patch eventsource to use URL instead of parse

This commit is contained in:
Ben Allfree 2024-07-29 18:06:27 -04:00
parent ccf08c66f9
commit e03b19b29d
3 changed files with 34 additions and 2 deletions

View File

@ -110,5 +110,10 @@
"tsx": "^3.14.0",
"type-fest": "^4.6.0",
"typescript": "^5.2.2"
},
"pnpm": {
"patchedDependencies": {
"eventsource@2.0.2": "patches/eventsource@2.0.2.patch"
}
}
}

View File

@ -0,0 +1,22 @@
diff --git a/lib/eventsource.js b/lib/eventsource.js
index bd401a106c16ca1f5aa6a965db51d9a38f10a1c6..a271b2d391df5a62ccf5d4e69e81afe1fa36c704 100644
--- a/lib/eventsource.js
+++ b/lib/eventsource.js
@@ -87,7 +87,7 @@ function EventSource (url, eventSourceInitDict) {
var reconnectUrl = null
function connect () {
- var options = parse(url)
+ var options = new URL(url)
var isSecure = options.protocol === 'https:'
options.headers = { 'Cache-Control': 'no-cache', 'Accept': 'text/event-stream' }
if (lastEventId) options.headers['Last-Event-ID'] = lastEventId
@@ -113,7 +113,7 @@ function EventSource (url, eventSourceInitDict) {
// and include the original url in path and Host headers
var useProxy = eventSourceInitDict && eventSourceInitDict.proxy
if (useProxy) {
- var proxy = parse(eventSourceInitDict.proxy)
+ var proxy = new URL(eventSourceInitDict.proxy)
isSecure = proxy.protocol === 'https:'
options.protocol = isSecure ? 'https:' : 'http:'

9
pnpm-lock.yaml generated
View File

@ -4,6 +4,11 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
patchedDependencies:
eventsource@2.0.2:
hash: tygaxpd33h24mrpcadqkqji6vy
path: patches/eventsource@2.0.2.patch
importers:
.:
@ -389,7 +394,7 @@ importers:
version: 1.0.31
eventsource:
specifier: ^2.0.2
version: 2.0.2
version: 2.0.2(patch_hash=tygaxpd33h24mrpcadqkqji6vy)
exit-hook:
specifier: ^4.0.0
version: 4.0.0
@ -8882,7 +8887,7 @@ snapshots:
eventemitter3@4.0.7: {}
eventsource@2.0.2: {}
eventsource@2.0.2(patch_hash=tygaxpd33h24mrpcadqkqji6vy): {}
execa@0.7.0:
dependencies: