fix(client): respect sun.net.http.allowRestrictedHeaders after config refactor - #6118
Open
arimu1 wants to merge 1 commit into
Open
fix(client): respect sun.net.http.allowRestrictedHeaders after config refactor#6118arimu1 wants to merge 1 commit into
arimu1 wants to merge 1 commit into
Conversation
fromClient() set isRestrictedHeaderPropertySet on the intermediate ReadWrite instance instead of the returned clientConfiguration copy. After the 2.48 configuration refactor, the stored client config always kept the init() default of false, so restricted headers (Host, Origin, …) were treated as disallowed even when sun.net.http.allowRestrictedHeaders was true. Apply the system property to the returned configuration so it propagates through fromRequest()/copy() as before the refactor. Fixes eclipse-ee4j#6085 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression introduced by the
HttpUrlConnectorconfiguration refactor (2.48+):sun.net.http.allowRestrictedHeaders=truewas ignored for restricted headers such asHostandOrigin.Root cause
HttpUrlConnectorConfiguration.ReadWrite#fromClient()setisRestrictedHeaderPropertySeton the intermediatethisinstance, then returned a copy (clientConfiguration) created earlier viacopyFromClient()→init()(defaults the flag tofalse) +setNonEmpty(this)(still empty at that point).HttpUrlConnectorstores that returned copy and later usesfromRequest()/copy(), so the system property value never reached request-time checks. Users always saw:even when the property was set (e.g. OCI SDK setting
Host).Fix
Apply and log the system property on the returned
clientConfiguration, matching the pre-2.48 behavior where the constructor field was assigned from the property.Testing
HttpUrlConnectorRestrictedHeadersTest(3 tests):fromClientrecordstrue/falseon the returned configcopy()(the path used byfromRequest)mvn -pl core-client -am test -Dtest=HttpUrlConnectorRestrictedHeadersTestFixes #6085