soenkeliebau opened a new pull request, #11665: URL: https://github.com/apache/nifi/pull/11665
<!-- 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. --> # Summary [NIFI-16332](https://issues.apache.org/jira/browse/NIFI-16332) Upload replication (NIFI-15784) forwards inbound request headers and then adds an explicit Content-Type into a case-sensitive HashMap. When the inbound request carried a differently-cased name (e.g. lowercase "content-type" over HTTP/2 or via a gateway), both variants survived and the replicated request was sent with a duplicate Content-Type, which the receiving node rejects with 400 Bad Request. Before applying each explicit builder header, remove every inbound case-variant of that header name so the builder's header replaces them rather than joining them. The header casing is left unchanged. Adds regression tests covering the case-variant collision for Content-Type and Filename, multiple simultaneous variants, and that unrelated forwarded headers are passed through untouched. I considered using `ReplicationHeaderUtils.removeHeader` for removing the headers because it exists and is intended for this operation, but the current code makes it more obvious that we remove case insensitive, plus it has the benefit of also removing duplicate entries, not just the first matching one. This should not be relevant, as duplicate headers are caught upstream of us in the server component, but it also doesn't hurt I daresay. Happy to refactor to use `ReplicationHeaderUtils.removeHeader` if that is preferred. # Verification Please indicate the verification steps performed prior to pull request creation. ### Build - [ ] Build completed using `./mvnw clean install -P contrib-check` - [ ] JDK 21 - [ ] JDK 25 ### Licensing - [X] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html) - [X] New dependencies are documented in applicable `LICENSE` and `NOTICE` files ### Documentation - [X] Documentation formatting appears as expected in rendered files -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
