socket-function 0.69.0 → 0.71.0

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": "socket-function",
3
- "version": "0.69.0",
3
+ "version": "0.71.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -281,11 +281,20 @@ export function requireMain() {
281
281
  throw new Error(`Mixed domains with non-domain requests is not supported presently. Requests: ${requests.join(" | ")}`);
282
282
  }
283
283
  let url = new URL(request);
284
- if (domainOrigin && domainOrigin !== url.origin) {
284
+ let origin = url.origin;
285
+ // Fix stupid :443 erasure (other ports aren't erased, except 80, but we'll never use HTTP,
286
+ // so that's fine).
287
+ {
288
+ let remaining = request.slice(origin.length);
289
+ if (remaining.startsWith(":443/")) {
290
+ origin += ":443";
291
+ }
292
+ }
293
+ if (domainOrigin && domainOrigin !== origin) {
285
294
  // TODO: If this happens, we can probably just split the call up into multiple calls?
286
295
  throw new Error(`Mixed domains in require call is not supported presently. Requests: ${requests.join(" | ")}`);
287
296
  }
288
- domainOrigin = url.origin + "/";
297
+ domainOrigin = origin + "/";
289
298
  // By stripping by length, we can turn https://example.com/./test => "./test"
290
299
  // (where as if we used pathname, it would turn into "/test"
291
300
  return request.slice(domainOrigin.length);
@@ -85,6 +85,8 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
85
85
  if (hostname.startsWith("https://")) {
86
86
  hostname = hostname.slice("https://".length);
87
87
  }
88
+ hostname = hostname.split(":")[0];
89
+ hostname = hostname.split("/")[0];
88
90
  return hostname;
89
91
  }
90
92
  let hostDomain = rootDomain(host);