projects
/
squeep-api-dingus
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
776161c
)
loft named regexps to file level
author
Justin Wind
<justin.wind+git@gmail.com>
Fri, 7 Jun 2024 22:30:18 +0000
(15:30 -0700)
committer
Justin Wind
<justin.wind+git@gmail.com>
Fri, 7 Jun 2024 22:30:18 +0000
(15:30 -0700)
lib/dingus.js
patch
|
blob
|
history
diff --git
a/lib/dingus.js
b/lib/dingus.js
index 1bda0c2ac57b2659cc5149c86a37e304cc4a72b4..c53e469808b26e2049d3dcd2428dbd66f50272c9 100644
(file)
--- a/
lib/dingus.js
+++ b/
lib/dingus.js
@@
-38,7
+38,10
@@
const defaultOptions = {
querystring,
};
querystring,
};
-const cookieSplitRE = /; */;
+const cookieSplitRE = /\s*;\s*/;
+const headerParseRE = /^(?<name>[^:]+): +(?<value>.*)$/;
+const lineBreakRE = /\r\n|\n|\r/;
+const proxySplitRE = /\s*,\s*/u;
class Dingus {
/**
class Dingus {
/**
@@
-161,7
+164,7
@@
class Dingus {
(this.trustProxy && req?.getHeader(Enum.Header.XRealIP)) ||
(req?.connection?.remoteAddress) ||
'';
(this.trustProxy && req?.getHeader(Enum.Header.XRealIP)) ||
(req?.connection?.remoteAddress) ||
'';
- return address.split(
/\s*,\s*/u
)[0];
+ return address.split(
proxySplitRE
)[0];
}
}
@@
-174,7
+177,7
@@
class Dingus {
// TODO: RFC7239 Forwarded support
const protocol = (this.trustProxy && req?.getHeader(Enum.Header.XForwardedProto)) ||
((req?.connection?.encrypted) ? 'https' : 'http');
// 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];
}
}
@@
-582,11
+585,9
@@
class Dingus {
return added;
}
return added;
}
- const lineBreakRE = /\r\n|\n|\r/;
const lines = data.toString().split(lineBreakRE);
common.unfoldHeaderLines(lines);
const lines = data.toString().split(lineBreakRE);
common.unfoldHeaderLines(lines);
- const headerParseRE = /^(?<name>[^:]+): +(?<value>.*)$/;
lines.forEach((line) => {
if (line) {
const result = headerParseRE.exec(line);
lines.forEach((line) => {
if (line) {
const result = headerParseRE.exec(line);