fix: Configuration to be able to control sending RFC 9457 related Accept HTTP header - #1891
Conversation
Some servers have issues handling it (esp the Accept HTTP header), so make it possible to disable it. Moreover, the new config accepts REPO_ID suffix, so this can happen per-server basis.
kwin
left a comment
There was a problem hiding this comment.
In addition we need to add Accept for regular content (either wildcard for all requests or xml/binary depending on whether it is metadata or artifacts) when we add the accept for problem+json
| * @configurationDefaultValue {@link #DEFAULT_HTTP_SUPPORT_RFC9457} | ||
| * @configurationRepoIdSuffix Yes | ||
| */ | ||
| public static final String HTTP_SUPPORT_RFC9457 = PREFIX_TRANSPORT_HTTP + "supportRfc9457"; |
There was a problem hiding this comment.
This is a confusing comment to me, as this is just about the accept header which is not actually specified in the RFC. I would therefore rather refer to it as EXPLICITLY_ACCEPT_PROBLEM_JSON
There was a problem hiding this comment.
This and @slawekjaranowski comment below makes sense, this config should be ONLY about Accept header, and then as Slawek says below, just always parse response?
| if (supportRfc9457) { | ||
| ApacheRFC9457Reporter.INSTANCE.generateException(response, (statusCode, reasonPhrase) -> { | ||
| throw new HttpResponseException(statusCode, reasonPhrase + " (" + statusCode + ")"); | ||
| }); |
There was a problem hiding this comment.
maybe we can always parse response?
I find this problematic: adding xml or json or any other Accept is not right; transport is only about artifacts, and as we know, servers knows to be picky. So, ideally I'd just modific the text of this config param (it is ONLY about adding Accept to fully support RFC 9457), because historically Resolver never sent any Accept header at all. |
|
Also, in this very case, it just happens that we use a REST endpoint of an older software. Usually, Resolver transport is hitting non REST. And this happens ONLY as nx2 offered "transparent support" for maven-deploy-plugin, while deployment to staging was always possible via alternate means (native plugin or so). |
Some servers have issues handling it (esp the Accept HTTP header), so make it possible to disable it. Moreover, the new config accepts REPO_ID suffix, so this can happen per-server basis.
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.