You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "eric-maynard (via GitHub)" <gi...@apache.org> on 2025/02/28 21:13:01 UTC
[PR] Treat headers as case-insensitive during RealmContext resolution [polaris]
eric-maynard opened a new pull request, #1089:
URL: https://github.com/apache/polaris/pull/1089
According to the RFC, HTTP headers should be case-insensitive. To support this, we need to avoiding doing string comparison against a case-sensitive map.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Treat headers as case-insensitive during RealmContext resolution [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #1089:
URL: https://github.com/apache/polaris/pull/1089#discussion_r1976136306
##########
service/common/src/test/java/org/apache/polaris/service/context/DefaultRealmIdResolverTest.java:
##########
@@ -82,4 +82,17 @@ void headerNotPresentFailure() {
.isInstanceOf(UnresolvableRealmContextException.class)
.hasMessage("Missing required realm header: Polaris-Header");
}
+
+ @Test
+ void headerCaseInsensitive() {
+ DefaultRealmContextResolver resolver = new DefaultRealmContextResolver(config);
+ RealmContext RealmContext1 =
+ resolver.resolveRealmContext(
+ "requestURL", "method", "path", Map.of("POLARIS-HEADER", "realm1"));
+ assertThat(RealmContext1.getRealmIdentifier()).isEqualTo("realm1");
+ RealmContext RealmContext2 =
+ resolver.resolveRealmContext(
+ "requestURL", "method", "path", Map.of("polaris-header", "realm2"));
Review Comment:
never mind, the field value isn't case-insensitive.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Treat headers as case-insensitive during RealmContext resolution [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #1089:
URL: https://github.com/apache/polaris/pull/1089#discussion_r1976134567
##########
service/common/src/test/java/org/apache/polaris/service/context/DefaultRealmIdResolverTest.java:
##########
@@ -82,4 +82,17 @@ void headerNotPresentFailure() {
.isInstanceOf(UnresolvableRealmContextException.class)
.hasMessage("Missing required realm header: Polaris-Header");
}
+
+ @Test
+ void headerCaseInsensitive() {
+ DefaultRealmContextResolver resolver = new DefaultRealmContextResolver(config);
+ RealmContext RealmContext1 =
+ resolver.resolveRealmContext(
+ "requestURL", "method", "path", Map.of("POLARIS-HEADER", "realm1"));
+ assertThat(RealmContext1.getRealmIdentifier()).isEqualTo("realm1");
+ RealmContext RealmContext2 =
+ resolver.resolveRealmContext(
+ "requestURL", "method", "path", Map.of("polaris-header", "realm2"));
Review Comment:
Nit: add a test against map values as well?
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Treat headers as case-insensitive during RealmContext resolution [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard merged PR #1089:
URL: https://github.com/apache/polaris/pull/1089
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org