mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
feat(lambda-web): write the platform's own Date header on app responses in place of the app's (#7257)
* feat(lambda-web): write the platform's own Date header on app responses in place of the app's * test(lambda-web): check the Date header in the headers test on its function
This commit is contained in:
1 parent
65e9522433
commit
b7697f8148
3 files changed
+32
-2
No files matched your search
@@ -590,7 +590,9 @@ public class LambdaWebDataPlane {
|
||||
headers.set("Connection", "close");
|
||||
}
|
||||
|
||||
/** The platform writes its own {@code Date} in place of the app's, but lets a {@code date} in lowercase pass. */
|
||||
static void copyResponseHeaders(MultiMap headers, HttpServerResponse out) {
|
||||
out.headers().add("Date", LambdaWebErrorPages.platformDate(Instant.now()));
|
||||
Set<String> dropped = new HashSet<>(DROPPED_RESPONSE_HEADERS);
|
||||
for (String connection : headers.getAll("Connection")) {
|
||||
for (String token : connection.split(",")) {
|
||||
@@ -598,7 +600,7 @@ public class LambdaWebDataPlane {
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, String> header : headers) {
|
||||
if (!dropped.contains(header.getKey().toLowerCase(Locale.ROOT))) {
|
||||
if (!"Date".equals(header.getKey()) && !dropped.contains(header.getKey().toLowerCase(Locale.ROOT))) {
|
||||
out.headers().add(header.getKey(), header.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user