question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use of non ASCII characters in the header

See original GitHub issue

Expected 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

  1. Add a header with a non ASCII character.

Specifications

  • Version: 13.0.0

  • Platform: Windows 10 x64

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
zpc870921commented, Mar 14, 2019

the latest .net core 2.2 support non-ascii characters, we hope ocelot can support too!!!

1reaction
margaalecommented, Jan 30, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found