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

💡feat: allow for simpler override of Response header encoding of Forwarded Requests #2254

Merged
merged 11 commits into from Sep 22, 2023
Merged

💡feat: allow for simpler override of Response header encoding of Forwarded Requests #2254

merged 11 commits into from Sep 22, 2023

Conversation

ChintanRaval
Copy link
Contributor

@ChintanRaval ChintanRaval commented Sep 14, 2023

Overview

This change intends to allow consumers to be able to choose tolerance for non-default (non-ASCII) encoding of Response headers for forwarded requests by leveraging SocketsHttpHandler.ResponseHeaderEncodingSelector. The idea is to provide something similar to the existing HttpClientConfig.RequestHeaderEncoding property via a new HttpClientConfig.ResponseHeaderEncoding property.

Hopefully, this helps close #1346 and helps simplify solution for #2076.

Changes

  1. add support for SocketsHttpHandler.ResponseHeaderEncodingSelector via new ResponseHeaderEncoding member in HttpClientConfig
  2. honour the same in ForwarderHttpClientFactory.ConfigureHandler
  3. update existing & add new relevant tests
  4. update relevant documentation for API, usage & samples

Testing

No additional testing has been performed other than relying on CI to validate updated & newly added tests in code. Happy to discuss more testing if required.

@ChintanRaval ChintanRaval changed the title add support for ResponseHeaderEncoding in HttpClientConfig (progress commit) 🚧 [WIP] add support for ResponseHeaderEncoding in HttpClientConfig Sep 14, 2023
@ChintanRaval ChintanRaval changed the title 🚧 [WIP] add support for ResponseHeaderEncoding in HttpClientConfig 🚧 [WIP] (feat) add support for ResponseHeaderEncoding in HttpClientConfig Sep 14, 2023
@ChintanRaval ChintanRaval changed the title 🚧 [WIP] (feat) add support for ResponseHeaderEncoding in HttpClientConfig 🚧 (feat) add support for ResponseHeaderEncoding in HttpClientConfig Sep 14, 2023
@ChintanRaval
Copy link
Contributor Author

resolves #1346

@ChintanRaval ChintanRaval marked this pull request as ready for review September 15, 2023 04:38
@ChintanRaval
Copy link
Contributor Author

I'll suss out the license agreement soon once I figure out what exact company name to use wiht my employer.

@ChintanRaval ChintanRaval changed the title 🚧 (feat) add support for ResponseHeaderEncoding in HttpClientConfig 💡feat: add support for ResponseHeaderEncoding in HttpClientConfig Sep 15, 2023
@ChintanRaval ChintanRaval changed the title 💡feat: add support for ResponseHeaderEncoding in HttpClientConfig 💡feat: allow for simpler override of Response header encoding of Forwarded Requests Sep 15, 2023
@MihaZupan MihaZupan added this to the YARP 2.x milestone Sep 19, 2023
Copy link
Member

@MihaZupan MihaZupan left a comment

Choose a reason for hiding this comment

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

The change looks good, thanks.

I don't really mind exposing the option given we have a corresponding setting for request headers already, but I question the usefulness of having it in the config given that Kestrel uses a different default for response headers, forcing you into making code changes anyway.

docs/docfx/articles/http-client-config.md Outdated Show resolved Hide resolved
@ChintanRaval
Copy link
Contributor Author

@microsoft-github-policy-service agree company="PageUpPeople"

…server (with e.g. Kestrel) options for header encoding to match SocketsHttpHandler's header encoding options
docs/docfx/articles/http-client-config.md Outdated Show resolved Hide resolved
src/ReverseProxy/Configuration/HttpClientConfig.cs Outdated Show resolved Hide resolved
src/ReverseProxy/Configuration/HttpClientConfig.cs Outdated Show resolved Hide resolved
src/ReverseProxy/Configuration/HttpClientConfig.cs Outdated Show resolved Hide resolved
src/ReverseProxy/Configuration/HttpClientConfig.cs Outdated Show resolved Hide resolved
src/ReverseProxy/Configuration/HttpClientConfig.cs Outdated Show resolved Hide resolved
src/ReverseProxy/Configuration/HttpClientConfig.cs Outdated Show resolved Hide resolved
@MihaZupan MihaZupan merged commit 0f491bd into microsoft:main Sep 22, 2023
7 checks passed
@ChintanRaval ChintanRaval deleted the add-support-for-http-client-response-header-encoding branch September 22, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document Kestrel response header encoding
2 participants