Skip to content

Conversation

@rejierd
Copy link
Contributor

@rejierd rejierd commented Apr 3, 2019

Fixes #936

This is a super simple fix to illustrate the issue.
If a different solution is preferred, then I'm open for suggestions of course.

@kdavisk6 kdavisk6 added the bug Unexpected or incorrect behavior label Apr 8, 2019
Copy link
Member

@kdavisk6 kdavisk6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. We may need to keep an eye out for any exotic use cases where the fragment may contain characters outside of the pchar definition, but I think this will work just fine for now. Thanks for helping out!

@rejierd rejierd closed this Apr 8, 2019
@rejierd rejierd reopened this Apr 8, 2019
@kdavisk6 kdavisk6 merged commit 6771866 into OpenFeign:master Apr 8, 2019
@flisky
Copy link
Contributor

flisky commented Apr 16, 2019

Sorry to chime in, but I think it's a wrong behavier!

Fragment is purely client-side, and the browser sends the url without fragment. Nginx will strip off the fragment, and curl does this so, and more.

I think we could choose one of the following ways:

  1. strip off the fragment
  2. throw an exception to reject fragment
  3. encode the # as user want it (the current behavier)

I prefer to 3, keep as it is. And user should be responsible for their input.

@flisky
Copy link
Contributor

flisky commented Apr 18, 2019

friendly ping @rejierd @kdavisk6 , any opinion?

@rejierd
Copy link
Contributor Author

rejierd commented Apr 18, 2019

We've been using OkHttp, which doesn't send the fragment either according to the documentation. The same can probably be said of every other underlying HTTP client that Feign delegates to - meaning this commit doesn't actually conflict with RFC3986 as you suggest.

Our use case is that we automatically generate Feign clients from Swagger files with the help of openapi-generator. Our partner uses fragments in some of their paths, and we'd rather not manually strip out them out every time they update their documentation.

Whether Feign actually keeps the fragment is not that important to us. The important thing is that Feign properly handles valid URLs, by not URL encoding the hash sign and putting the fragment before the query.

What are your thoughts @kdavisk6?

@kdavisk6
Copy link
Member

@rejierd

Agreed. It is our job to process and prepare the request based on the specification provided by the Target interface and it's underlying Contract, and to present consistent, repeatable behavior when doing so. In short, as @rejierd has stated, if a user specifies a fragment on the uri template, we need to ensure that we process it as outlined in RFC 6570 and produce a valid URL, which Feign was not doing properly in this case.

@kdavisk6 kdavisk6 added this to the 10.2.1 milestone Apr 28, 2019
velo pushed a commit that referenced this pull request Oct 7, 2024
Fixes #936

This is a super simple fix to illustrate the issue.
If a different solution is preferred, then I'm open for suggestions of course.
velo pushed a commit that referenced this pull request Oct 8, 2024
Fixes #936

This is a super simple fix to illustrate the issue.
If a different solution is preferred, then I'm open for suggestions of course.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fragment identifiers are handled incorrectly

3 participants