Ayush0612005 commented on code in PR #30509:
URL: https://github.com/apache/camel/pull/30509#discussion_r4645124859
##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java:
##########
@@ -568,6 +584,15 @@ public HttpResponse toNettyResponse(Message message,
NettyHttpConfiguration conf
// must use entrySet to ensure case of keys is preserved
for (Map.Entry<String, Object> entry :
message.getHeaders().entrySet()) {
String key = entry.getKey();
+ if (!HttpHelper.isValidHeaderName(key)) {
+ // a message header can have any name, for example a form
field mapped to a header,
+ // but it cannot be sent as an HTTP header, and the route has
already run
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Skipping header {} in the response, as its name
is not a valid HTTP header name",
+ key.replaceAll("[\n\r]", "_"));
Review Comment:
Done in the latest commit, as offered above: `sanitizeLog(String)` moved to
the camel-http-base `HttpHelper`, which camel-netty-http depends on, and the
camel-http-common `HttpHelper.sanitizeLog` delegates to it, as the other
methods of that class do. Both guards in `DefaultNettyHttpBinding` now use
`HttpHelper.sanitizeLog(key)`. `HttpHelperTest#testSanitizeLog` covers it, and
the http-base, http-common and netty-http tests pass.
_Claude Code on behalf of Ayush0612005_
--
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]