spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Case-sensitive HttpHeaders with ReadOnlyHttpHeaders

Open spencergibb opened this issue 1 year ago • 2 comments

Spring Cloud recently upgraded to boot 3.4.0-M1 and I came across an interesting regression. Spring Cloud Gateway has various filters that work on http headers. After upgrading to framework 6.2.0-M6 I ran into a situation trying to get a "host" header using getFirst(HttpHeaders.HOST). The host header existed, but as lower case. The input value to HttpHeaders is a ReadOnlyHttpHeaders but it appears that it is not case-sensitive. I had to work around it by creating a new HttpHeaders object and add all the values from the original. Does this ring any bells?

spencergibb avatar Aug 08 '24 14:08 spencergibb

I don't see anything that stands out in the commit history for 6.2. How would we reproduce this?

rstoyanchev avatar Aug 14 '24 05:08 rstoyanchev

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Aug 26 '24 10:08 spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-projects-issues avatar Sep 02 '24 10:09 spring-projects-issues

Sorry for the delay, I'll find the place in our build that was failing.

spencergibb avatar Sep 26 '24 14:09 spencergibb

@rstoyanchev this is the commit to fix things and make them case sensitive again https://github.com/spring-cloud/spring-cloud-gateway/commit/b362a913037b7cbc40c40152a95dcc10abebc841

And this is the test that fails

https://github.com/spring-cloud/spring-cloud-gateway/blob/508ffeb51af720f3e12d4d87f22d7f360531085e/spring-cloud-gateway-server/src/test/java/org/springframework/cloud/gateway/test/GatewayIntegrationTests.java#L115-L131

spencergibb avatar Oct 11 '24 15:10 spencergibb

Specifically, this line fails https://github.com/spring-cloud/spring-cloud-gateway/commit/b362a913037b7cbc40c40152a95dcc10abebc841#diff-3b5acb6faa4abf622703749c7fe9fb7df8c98536e48a642ba7e9b3d2cc7a2a1dR114

spencergibb avatar Oct 11 '24 15:10 spencergibb

Possibly https://github.com/spring-projects/spring-framework/commit/4b732d62c22297aea536a09477d2272c3e87a221. I'll work on an isolated minimal reproducer

spencergibb avatar Oct 11 '24 15:10 spencergibb

I believe the fix for #33666 fixes this issue

spencergibb avatar Oct 11 '24 16:10 spencergibb

This could be fixed by #33666.

rstoyanchev avatar Oct 11 '24 16:10 rstoyanchev