@jsenv/server 14.1.1 → 14.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/server",
|
|
3
|
-
"version": "14.1.
|
|
3
|
+
"version": "14.1.4",
|
|
4
4
|
"description": "Write your Node.js server using pure functions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"test": "node --conditions=development ./scripts/test.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@jsenv/abort": "4.2.
|
|
38
|
-
"@jsenv/log": "3.
|
|
37
|
+
"@jsenv/abort": "4.2.4",
|
|
38
|
+
"@jsenv/log": "3.3.0",
|
|
39
39
|
"@jsenv/url-meta": "7.0.0",
|
|
40
40
|
"@jsenv/utils": "2.0.1",
|
|
41
41
|
"ws": "8.8.1"
|
|
@@ -170,7 +170,20 @@ const writeHead = (
|
|
|
170
170
|
onHeadersSent({ nodeHeaders, status, statusText })
|
|
171
171
|
return
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
responseStream.writeHead(status, statusText, nodeHeaders)
|
|
176
|
+
} catch (e) {
|
|
177
|
+
if (
|
|
178
|
+
e.code === "ERR_INVALID_CHAR" &&
|
|
179
|
+
e.message.includes("Invalid character in statusMessage")
|
|
180
|
+
) {
|
|
181
|
+
throw new Error(`Invalid character in statusMessage
|
|
182
|
+
--- status message ---
|
|
183
|
+
${statusText}`)
|
|
184
|
+
}
|
|
185
|
+
throw e
|
|
186
|
+
}
|
|
174
187
|
onHeadersSent({ nodeHeaders, status, statusText })
|
|
175
188
|
}
|
|
176
189
|
|
package/src/start_server.js
CHANGED
|
@@ -207,6 +207,7 @@ export const startServer = async ({
|
|
|
207
207
|
const firstExternalIp = ipGetters.getFirstExternalIp({ preferIpv6 })
|
|
208
208
|
serverOrigins.externalip = createOrigin(firstExternalIp)
|
|
209
209
|
} else if (hostnameInfo.label === "loopback") {
|
|
210
|
+
// nothing
|
|
210
211
|
} else {
|
|
211
212
|
serverOrigins.local = createOrigin(hostname)
|
|
212
213
|
}
|
|
@@ -947,6 +948,10 @@ export const startServer = async ({
|
|
|
947
948
|
)
|
|
948
949
|
stopCallbackList.add(removeUpgradeCallback)
|
|
949
950
|
stopCallbackList.add(() => {
|
|
951
|
+
websocketClients.forEach((websocketClient) => {
|
|
952
|
+
websocketClient.close()
|
|
953
|
+
})
|
|
954
|
+
websocketClients.clear()
|
|
950
955
|
websocketServer.close()
|
|
951
956
|
websocketServer = null
|
|
952
957
|
})
|