Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEBCLIENT do not encode URL fully (according to RFC 3986, only query parameters #2515

Closed
lasteris opened this issue Nov 20, 2023 · 9 comments
Labels

Comments

@lasteris
Copy link

Questions

Why Vert.x WebClient encodes only query part of URL ? I am not sure, that i am right, but accordingly to RFC 3986 i assumed that ALL characters, that seems not valid to US-ASCII should being encoded by percent-notation. Am i wrong ?

Version

4.5.0

Context

I've encountered this problem, while I was trying to use Cyrillic symbols in path (not in query part).

Do you have a reproducer?

GIST: https://gist.github.com/lasteris/859c75bcd8640b15a27655cb0784c8b1

Steps to reproduce

  1. run
  2. curl --location 'http://127.0.0.1:8881/typo/?hi=%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82'
  3. view logs
  4. see 20:22:22.651 [vert.x-eventloop-thread-1] WARN i.v.e.w.h.impl.LoggerHandlerImpl - 127.0.0.1 - - [Sun, 19 Nov 2023 17:22:22 GMT] "GET /�����hi=%D0%A0%D1%9F%D0%A1%D0%82%D0%A0%D1%91%D0%A0%D0%86%D0%A0%C2%B5%D0%A1%E2%80%9A HTTP/1.1" 404 53 "-" "Vert.x-WebClient/4.5.0"

Extra

  • Windows 10/11, Java 21
@tsegismont
Copy link
Contributor

tsegismont commented Nov 20, 2023

With UriTemplate you can get an absolute URI that is properly encoded:

String absoluteURI = UriTemplate.of("{scheme}://{host}:{port}/{path}")
      .expandToString(Variables.variables()
        .set("scheme", "http")
        .set("host", "127.0.0.1")
        .set("port", 8881)
        .set("path", "привет"));

But on the server side encoded path segments are not supported anyway. Would you like to contribute this?

@lasteris
Copy link
Author

lasteris commented Nov 20, 2023

With UriTemplate you can get an absolute URI that is properly encoded:

      .expandToString(Variables.variables()
        .set("scheme", "http")
        .set("host", "127.0.0.1")
        .set("port", 8881)
        .set("path", "привет"));

But on the server side encoded path segments are not supported anyway. Would you like to contribute this?

that sounds like an interesting idea🤗

@vietj
Copy link
Contributor

vietj commented Nov 21, 2023

yeah that's what URI template are made for

@lasteris
Copy link
Author

yeah that's what URI template are made for

can I really give it a try to implement decoding path segments at the server side ?

@vietj
Copy link
Contributor

vietj commented Nov 21, 2023

I'm not sure what you want to do since we are talking here about web client and not server

@vietj
Copy link
Contributor

vietj commented Nov 21, 2023

ah you mean Thomas suggestion

@lasteris
Copy link
Author

lasteris commented Nov 21, 2023

ah you mean Thomas suggestion

yeah, honestly i thought about server support from the start, because if webclient does not encode, why should the server have logic for decoding (cause it all in one ecosystem) ?
and now sounds interesting, maybe i could find the "path segments" resolving logic on server side and try out to implement decoding

@lasteris
Copy link
Author

lasteris commented Nov 21, 2023

and by webclient side i am not sure that it should be implemented, because I think that on client side that's not a problem in any case if we have UriTemplate or UrlEncoder

@vietj
Copy link
Contributor

vietj commented Nov 22, 2023

sure, I'll close this issue in the meantime then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants