You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "alexisgra (via GitHub)" <gi...@apache.org> on 2024/04/19 21:35:30 UTC
[PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
alexisgra opened a new pull request, #13866:
URL: https://github.com/apache/camel/pull/13866
# Description
Some websocket apis require authentication and various headers during the handshake process in order to upgrade to websocket. It was not supported by the vertx-component. So I added an uri param to set a map of headers that will be passed as header in the HTTP handshake request. It is important to note that it only works when the endpoint is a producer, or a consumer of a remote host (consumeAsClient true).
I added three tests :
- One to test that handshakeHeaders are correctly binded in the configuration.
- One to test that handshakeHeaders are correctly passed in the HTTP handshake request when the endpoint is a producer.
- One to test that handshakeHeaders are correctly passed in the HTTP handshake request when the endpoint is a consumer of a remote host.
# Target
- [x] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
No JIRA issue found.
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful subject line and body.
<!--
If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
-->
- [x] I have run `mvn clean install -DskipTests` locally and I have committed all auto-generated changes
<!--
You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
-->
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2067610183
This test
```
Map.of("Authorization", "Bearer", "ApiSign", "12345");
```
What if you have many ApiSign, do you need to add each of them, or would you just match if ApiSign header was present or match by regexp or something.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2067588171
Using `Map` as UriParam is not soo tooling friendly. I wonder if it can be made to just a plain `String` where entires are separated by comma.
Also I wonder should it match by exact value or would the presence of a header only be enough to match (ie match value = *)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2077794489
Ah yeah lets use another approach with `multiValue = true` which allows to keep a `Map` type and users can provide entries for the map one at a time with a given prefix.
See for example QuartzEndpoint.java file how it does it
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "alexisgra (via GitHub)" <gi...@apache.org>.
alexisgra commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2072728866
No, I don't have any real world example. We can make the choice to not support comma in handshake headers. I will add it in the doc.
However, I have real world example with `:`, `=` with the APIs I'm trying to integrate using `camel-vertx-websocket`. Typically on an `ApiTimestamp` and an `ApiSign`.
Do I update with this format: `headerName,headerValue,headerName2,headerValue2`?
Thanks.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2067311370
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
* You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the Summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
* :warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "alexisgra (via GitHub)" <gi...@apache.org>.
alexisgra commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2068673717
Hi @davsclaus ,
When I changed the map to comma-separated `String` entries, I noticed a problem.
If you look at the http specification, you'll see that formats such as `header=value,header2=value2` or `header=value;header2=value2` don't work. Commas, semi-colons, colons and equals can be used in header values.
Here are a few examples:
`Date: Tue, 15 Nov 1994 08:12:31 GMT`
`Accept-Language: en-US,en;q=0.5`
So I think we have to choose between several possibilities: use `String` and don't support all header types (list, parameters...), use message headers as is the case in other HTTP components or keep a `Map`.
What do you think? Thanks for your help
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "alexisgra (via GitHub)" <gi...@apache.org>.
alexisgra commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2067601582
Thanks for the review! @davsclaus
I also wondered about the Map. I'd seen maps in Uriparam before but it was quite rare. No problem, I'll make the change! It will be easier to use.
For your comment about the match, I'm not sure I understand. Are you talking about matches in the tests?
Thanks!
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #13866:
URL: https://github.com/apache/camel/pull/13866#issuecomment-2072423239
Do you have any real-world examples of use header values with comma for that handshake situation? The test in the code use Bearer and ApiSign123
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add handshakeHeaders uri param in vertx-websocket component [camel]
Posted by "alexisgra (via GitHub)" <gi...@apache.org>.
alexisgra closed pull request #13866: Add handshakeHeaders uri param in vertx-websocket component
URL: https://github.com/apache/camel/pull/13866
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org