Roxen.git/
server/
protocols/
http.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2016-05-26
2016-05-26 10:50:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>
0242e5a8104ee8836eae4ef64dc558cbf46e1bbb (
20
lines) (+
11
/-
9
)
[
Show
|
Annotate
]
Branch:
2f31036e575cbe2bcd8ec9def8c3a5b89a8fdb01
HTTP: Fixed handling of multiple Forwarded headers.
Fixes [bug
7694 (#7694)
] some more.
972:
array(int|string) new_forwarded_header = ({}); foreach (request_headers; string linename; array|string contents) {
-
if( arrayp(contents) ) contents = contents[0];
+
array(string) acontents;
+
if( arrayp(contents) )
{
+
acontents =
contents
;
+
contents
= contents[0];
+
} else {
+
acontents = ({ contents });
+
}
switch (linename) { case "cache-control": // Opera sends "no-cache" here.
1097:
case "forwarded": // RFC 7239
-
if (stringp(contents)) {
-
misc->forwarded =
MIME.tokenize(contents) / ({ ',' });
-
} else {
-
misc->forwarded =
map(map(
contents
, MIME.tokenize), `/, ({ ',' })) *
-
({});
-
}
+
misc->forwarded = map(map(
acontents
, MIME.tokenize), `/, ({ ',' })) * ({});
break; // The X-Forwarded-* headers have been obsoleted by RFC 7239.
1110:
// RFC 7239 7.4. But only if it hasn't already been done. case "x-forwarded-for": if (request_headers->forwarded) break;
-
foreach(
stringp(contents)?({ contents }):contents
, string line) {
+
foreach(
acontents
, string line) {
foreach(MIME.tokenize(line) / ({ ',' }), array(string|int) segment) { string ip; if ((sizeof(segment) == 1) && stringp(segment[0])) {
1135:
case "x-forwarded-proto": if (request_headers->forwarded) break; string field = linename[sizeof("x-forwarded-")..];
-
foreach(
stringp(contents)?({ contents }):contents
, string line) {
+
foreach(
acontents
, string line) {
foreach(MIME.tokenize(line) / ({ ',' }), array(string|int) segment) { string value; if ((sizeof(segment) == 1) && stringp(segment[0])) {