querystring,
};
-const cookieSplitRE = /; */;
+const cookieSplitRE = /\s*;\s*/;
+const headerParseRE = /^(?<name>[^:]+): +(?<value>.*)$/;
+const lineBreakRE = /\r\n|\n|\r/;
+const proxySplitRE = /\s*,\s*/u;
class Dingus {
/**
(this.trustProxy && req?.getHeader(Enum.Header.XRealIP)) ||
(req?.connection?.remoteAddress) ||
'';
- return address.split(/\s*,\s*/u)[0];
+ return address.split(proxySplitRE)[0];
}
// TODO: RFC7239 Forwarded support
const protocol = (this.trustProxy && req?.getHeader(Enum.Header.XForwardedProto)) ||
((req?.connection?.encrypted) ? 'https' : 'http');
- return protocol.split(/\s*,\s*/u)[0];
+ return protocol.split(proxySplitRE)[0];
}
return added;
}
- const lineBreakRE = /\r\n|\n|\r/;
const lines = data.toString().split(lineBreakRE);
common.unfoldHeaderLines(lines);
- const headerParseRE = /^(?<name>[^:]+): +(?<value>.*)$/;
lines.forEach((line) => {
if (line) {
const result = headerParseRE.exec(line);