"Illegal or missing hexadecimal sequence in chunked-encoding" in some scenarios

When connecting to the new environment we receive an error on the request for OData4-metadata (.../odata4) when taken from OData response cache.

For example, using curl the error is:

curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding

Using Postman, the error is:

Parse Error: Invalid character in chunk size

image

On Power BI, the error is:

OData: We were unable to detect required payload information.

The same URL works fine using Google Chrome, FireFox and Edge.

image

Please note that the initial download is always succesfull.

It seems to be isolated to the following conditions:

  • Request is using HTTP/1.1 with chunking (so does not appear on HTTP2 since HTTP2 has no longer chunking as in HTTP1.1)
  • Request is done to the Linux-based environment (not to the Windows-based environments)
  • Only occurs when data is retrieved from the OData response cache. With OData response cache disabled, the error never appears.

The following C# code returns a different error depending on whether using .net 6 or .net7 or newer.

Code:

using (HttpClient client = new HttpClient())
            {
                string url = "https://bridge-online.cloud/xxx/odata4";
                string username = "xxx";
                string password = "xxx";

                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}")));

                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, url);

                HttpResponseMessage response = await client.SendAsync(request);

                response.EnsureSuccessStatusCode();
            }

On .net 6, the error is:

The HTTP response headers length exceeded the set limit of 65536 bytes.

On .net 7 and 8, the error is:

The HTTP/1.1 response chunk was too large.

It however succeeds when you add before the line with await the following statement:

request.Version = new Version(2, 0);

The source of this problem has been determined to differences in handling of the Transfer-Encoding HTTP header between Microsoft IIS and Kestrel. Changes have been applied to the Linux-variants to leave out the Transfer-Encoding where necessary.

Dit topic is 7 dagen na het laatste antwoord automatisch gesloten. Nieuwe antwoorden zijn niet meer toegestaan.