MCPcopy Create free account
hub / github.com/coder/mux / inferProtocol

Function inferProtocol

src/node/orpc/server.ts:232–241  ·  view source on GitHub ↗
(req: OriginValidationRequest)

Source from the content-addressed store, hash-verified

230}
231
232function inferProtocol(req: OriginValidationRequest): "http" | "https" {
233 if (typeof req.protocol === "string") {
234 const normalized = normalizeProtocol(req.protocol);
235 if (normalized) {
236 return normalized;
237 }
238 }
239
240 return (req.socket as { encrypted?: boolean }).encrypted ? "https" : "http";
241}
242
243function getExpectedHosts(req: OriginValidationRequest): string[] {
244 return [getFirstHeaderValue(req, "x-forwarded-host"), getFirstHeaderValue(req, "host")].filter(

Callers 1

getClientFacingProtocolFunction · 0.85

Calls 1

normalizeProtocolFunction · 0.85

Tested by

no test coverage detected