From f67596fd99e882ae2d0f7d858bcdc7c1bf14ff3c Mon Sep 17 00:00:00 2001 From: Alfonso Altamirano Date: Wed, 16 Aug 2023 21:35:53 -0600 Subject: [PATCH 1/2] FISH-7044: preventing the addition of multiple HSTS header for response --- .../main/java/org/glassfish/grizzly/config/HSTSFilter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java b/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java index 45bec33d720..0c03a2a4efe 100644 --- a/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java +++ b/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java @@ -99,7 +99,9 @@ public NextAction handleWrite(FilterChainContext ctx) throws IOException { Object message = ctx.getMessage(); if (message instanceof HttpContent && enabled) { HttpContent content = (HttpContent) message; - content.getHttpHeader().addHeader(HSTS_HEADER, header); + if(!content.getHttpHeader().containsHeader(HSTS_HEADER)) { + content.getHttpHeader().addHeader(HSTS_HEADER, header); + } } return ctx.getInvokeAction(); From 15cfd193f87d8a8a2343fd6393a45a96fce89961 Mon Sep 17 00:00:00 2001 From: Alfonso Altamirano Date: Fri, 18 Aug 2023 08:46:24 -0600 Subject: [PATCH 2/2] FISH-7044: upgrading copyright --- .../src/main/java/org/glassfish/grizzly/config/HSTSFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java b/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java index 0c03a2a4efe..eb4fecf2bc2 100644 --- a/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java +++ b/nucleus/grizzly/config/src/main/java/org/glassfish/grizzly/config/HSTSFilter.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2021 Payara Foundation and/or affiliates + * Copyright (c) [2021-2023] Payara Foundation and/or affiliates * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development