Use of non ASCII characters in the header
See original GitHub issueExpected Behavior
Use of non ASCII characters in the header of a http request, for example ñ.
Actual Behavior
I’m getting these exceptions:
HttpRequesterMiddleware
warn: Ocelot.Requester.Middleware.HttpRequesterMiddleware[0]
requestId: 0HLK5V6HTDSH7:00000001, previousRequestId: no previous request id, message: Error making http request, exception: System.Net.Http.HttpRequestException: Request headers must contain only ASCII characters.
at System.Net.Http.HttpConnection.WriteStringAsync(String s)
at System.Net.Http.HttpConnection.WriteHeadersAsync(HttpHeaders headers, String cookiesFromContainer)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task'1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Ocelot.Requester.HttpClientHttpRequester.GetResponse(DownstreamContext context)`
ResponderMiddleware:
warn: Ocelot.Responder.Middleware.ResponderMiddleware[0]
requestId: 0HLK5V6HTDSH7:00000001, previousRequestId: no previous request id, message: Error Code: UnableToCompleteRequestError Message: Error making http request, exception: System.Net.Http.HttpRequestException: Request headers must contain only ASCII characters.
at System.Net.Http.HttpConnection.WriteStringAsync(String s)
at System.Net.Http.HttpConnection.WriteHeadersAsync(HttpHeaders headers, String cookiesFromContainer)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task'1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Ocelot.Requester.HttpClientHttpRequester.GetResponse(DownstreamContext context) errors found in ResponderMiddleware. Setting error response for request path:/api/v1/Products, request method: POST`
Steps to Reproduce the Problem
- Add a header with a non ASCII character.
Specifications
-
Version: 13.0.0
-
Platform: Windows 10 x64
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Sending non-ASCII text in HTTP POST header
You cannot use non ASCII character in HTTP headers, see the RFC 2616. URI are themselves standardized by RFC 2396 and don't permit...
Read more >HTTP/2.0 non US-ASCII header names should be rejected
Just as in HTTP/1.x, header field names are strings of ASCII characters that are compared in a case-insensitive fashion. However,
Read more >Are non-ascii characters allowed as values for email X- ...
1 Answer. Non-ASCII characters are not permitted in MIME headers. While X-header fields were explicitly protected from being standardised, they ...
Read more >Request headers must contain only ASCII characters with ...
HttpRequestException: Request headers must contain only ASCII characters with Asp.Net Core 3.1 on Ubuntu - Microsoft Q&A.
Read more >RFC 1342 - Representation of Non-ASCII Text in Internet ...
Like the encoding techniques described in RFC 1341, the techniques outlined here were designed to allow the use of non-ASCII characters in message...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
the latest .net core 2.2 support non-ascii characters, we hope ocelot can support too!!!
Maybe the standard leaves a door open for anothers encoding, but as the exception says, net core only allows headers encoded as ascii. Until they don’t change the framework we can’t do anything from our side. Sorry