Dhairya-007 commented on PR #29694:
URL: https://github.com/apache/camel/pull/29694#issuecomment-6821204057
Thanks both, and thanks for sweeping the monorepo for the remaining call
sites — good to know `camel-oauth` and `AS2ClientConnection` were already right.
**The tautology is fixed.** @gnodet-bot is right: I computed the expectation
the same way the code does, so on Java 21 (default charset UTF-8) the assertion
agreed with whatever the code produced. The test now asserts a written-out
value and that the ISO-8859-1 encoding of the same credentials differs from it:
```java
assertEquals("Basic dXNlcjpww6Rzc3dvcmQ=",
message.getFirstHeader(AS2Header.AUTHORIZATION).getValue());
// what the default charset would have produced instead, had it not been
UTF-8
assertNotEquals("Basic " + Base64.getEncoder().encodeToString(("user:" +
password).getBytes(ISO_8859_1)),
message.getFirstHeader(AS2Header.AUTHORIZATION).getValue());
```
So it now pins the wire format rather than restating the implementation.
(`dXNlcjpww6Rzc3dvcmQ=` is `user:pässword` in UTF-8; the ISO-8859-1 form is
`dXNlcjpw5HNzd29yZA==`.)
**On `SmppConnectionFactory.connectProxy`** — yes, consistency, and you are
right that HTTP/1.x does not define non-ASCII values for the `proxyHeaders` the
user configures. My reasoning was that leaving four `getBytes()` and an
`InputStreamReader` on the default charset two lines away from the one I was
fixing would read as an oversight, and that UTF-8 is byte-identical for the
ASCII that actually belongs there. Happy to narrow it to just the credentials
line if you would rather keep the change minimal.
**The receiving side** is a good catch —
`HttpServerChannelHandler.extractBasicAuthSubject` decoding with
`Charset.defaultCharset()` has exactly the same failure mode from the other
end. I will send that as a separate PR rather than widening this one.
**JIRA** — I have no credentials for issues.apache.org from this
environment, so I cannot create the ticket. If you want a `CAMEL-XXXX` on this,
could a committer open it (or give me the number) and I will retitle and amend?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]