It does this by reading the System property jdk.httpclient.allowRestrictedHeaders and removing those set from the default list.

Fixes gh-30787