Skip to content

Add ResponseHeaderEncodingSelector on HttpSysOptions #66162

@jvano

Description

@jvano

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

When migrating from OWIN/Katana + HTTP.sys to ASP.NET Core + HTTP.sys, response headers containing non-ASCII characters are encoded differently.

OWIN/Katana + HTTP.sys: Response header values are encoded as Latin-1 (ISO-8859-1). A character like U+00A0 (non-breaking space) becomes a single byte 0xA0 on the wire.

ASP.NET Core + HTTP.sys: Response header values are encoded as UTF-8. The same U+00A0 becomes two bytes 0xC2 0xA0 on the wire, which clients interpret as two separate characters (Â + NBSP).

Kestrel provides ResponseHeaderEncodingSelector on KestrelServerOptions to control this. HTTP.sys only has UseLatin1RequestHeaders for request headers (added in .NET 5) — there is no equivalent for response headers.

Describe the solution you'd like

Add a UseLatin1ResponseHeaders property (or a more general ResponseHeaderEncoding option) to HttpSysOptions, similar to:

  • HttpSysOptions.UseLatin1RequestHeaders (existing, request-side only)
  • KestrelServerOptions.ResponseHeaderEncodingSelector (Kestrel equivalent)

This would allow applications migrating from OWIN/Katana to ASP.NET Core HTTP.sys to maintain wire-level compatibility for response headers.

Additional context

Current state in .NET 8/9:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions