This is an automated email from the ASF dual-hosted git repository. schultz pushed a commit to tag 10.1.32 in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit f62333b16cb2bcea9290dd4ab209394e0c23a1fc Author: Christopher Schultz <ch...@christopherschultz.net> AuthorDate: Thu Nov 7 13:47:08 2024 -0500 Tag 10.1.32 --- EarlyHintsFilter.java | 89 +++++++++++++++++++++++++++++++ build.properties.release | 54 +++++++++++++++++++ res/install-win/Uninstall.exe.sig | Bin 0 -> 8275 bytes res/install-win/tomcat-installer.exe.sig | Bin 0 -> 8275 bytes res/maven/mvn.properties.release | 27 ++++++++++ webapps/docs/changelog.xml | 2 +- 6 files changed, 171 insertions(+), 1 deletion(-) diff --git a/EarlyHintsFilter.java b/EarlyHintsFilter.java new file mode 100644 index 0000000000..49e66aaa26 --- /dev/null +++ b/EarlyHintsFilter.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.filters; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +import org.apache.catalina.connector.ResponseFacade; + +/** + * A Filter that adds a series of Link and/or Content-Security-Policy + * headers to a 103 response if a compatible protocol is in use. + */ +public class EarlyHintsFilter + implements Filter +{ + private final ArrayList<String> csps = new ArrayList<String>(1); + private final ArrayList<String> hints = new ArrayList<String>(); + + @Override + public void init(FilterConfig config) throws ServletException { + Enumeration<String> paramNames = config.getInitParameterNames(); + while(paramNames.hasMoreElements()) { + String name = paramNames.nextElement(); + + if(name.startsWith("csp.")) { + csps.add(config.getInitParameter(name)); + } else if(name.startsWith("link.")) { + String hint = config.getInitParameter(name); + int pos = hint.indexOf("${contextPath}"); + if(pos >= 0) { + hint = hint.replace("${contextPath}", config.getServletContext().getContextPath()); + } + + hints.add(hint); + } else { + config.getServletContext().log("WARNING: Unexpected init-param to EarlyHintsFilter: " + name); + } + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + HttpServletResponse rsp = (HttpServletResponse)response; + + if(!csps.isEmpty()) { + for(String csp : csps) { + rsp.addHeader("Content-Security-Policy", csp); + } + } + if(!hints.isEmpty()) { + for(String hint : hints) { + rsp.addHeader("Link", hint); + } + + // NOTE: Tomcat will only return a 103 response here when + // the request protocol is HTTP/1.1 or HTTP/2.0. For HTTP/1.0 + // requests, Tomcat will do nothing. + + ((ResponseFacade)rsp).sendEarlyHints(); + } + + chain.doFilter(request, response); + } +} diff --git a/build.properties.release b/build.properties.release new file mode 100644 index 0000000000..3952ed89d7 --- /dev/null +++ b/build.properties.release @@ -0,0 +1,54 @@ +# ----------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# This file was auto-generated by the pre-release Ant target. + +# Any unwanted settings may be over-ridden in a build.properties file located +# in the same directory as this file. + +# Set the version-dev to "" (empty string) as this is not a development release. +version.dev= + +# Ensure consistent timestamps for reproducible builds. +ant.tstamp.now.iso=2024-11-07T18:34:38Z + +# Enable insertion of detached signatures into the Windows installer. +do.codesigning=true + +# Re-use the same GPG executable. +gpg.exec=/usr/local/bin/gpg + +# Reproducible builds require the use of the build tools defined below. The +# vendors (where appropriate) and versions must match exactly for a reproducible +# build since this data is embedded in various files, particularly JAR file +# manifests, as part of the build process. +# +# Apache Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024 +# +# Java Name: OpenJDK 64-Bit Server VM +# Java Vendor: Eclipse Adoptium +# Java Version: 22.0.2+9 + +# The following is provided for information only. Builds will be repeatable +# whether or not the build environment is consistent with this information. +# +# OS: x86_64 Mac OS X 14.7 +# File encoding: UTF-8 +# +# Release Manager: schultz +release-java-version=22.0.2+9 +release-ant-version=1.10.15 diff --git a/res/install-win/Uninstall.exe.sig b/res/install-win/Uninstall.exe.sig new file mode 100644 index 0000000000..26148247d7 Binary files /dev/null and b/res/install-win/Uninstall.exe.sig differ diff --git a/res/install-win/tomcat-installer.exe.sig b/res/install-win/tomcat-installer.exe.sig new file mode 100644 index 0000000000..1d349430e7 Binary files /dev/null and b/res/install-win/tomcat-installer.exe.sig differ diff --git a/res/maven/mvn.properties.release b/res/maven/mvn.properties.release new file mode 100644 index 0000000000..3f4dbbc96f --- /dev/null +++ b/res/maven/mvn.properties.release @@ -0,0 +1,27 @@ +# ----------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# This file was auto-generated by the pre-release Ant target. + +# Remove "-dev" from the version since this is not a development release. +maven.asf.release.deploy.version=10.1.32 + +# Re-use the same GPG executable. +gpg.exec=/usr/local/bin/gpg + +# Set the user name to use to upload the artefacts to Nexus. +asf.ldap.username=schultz diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index f4cd6af296..68283a48c1 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -104,7 +104,7 @@ They eventually become mixed with the numbered issues (i.e., numbered issues do not "pop up" wrt. others). --> -<section name="Tomcat 10.1.32 (schultz)" rtext="in development"> +<section name="Tomcat 10.1.32 (schultz)" rtext=""> <subsection name="Catalina"> <changelog> <add> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org