Skip to content

[WinHTTP] Validate header values for ASCII #115112

Open
@ManickaP

Description

@ManickaP

We pass headers to WinHTTP.dll without any validation of their values:

requestHeadersBuffer.AppendLine(requestMessage.Headers.ToString());

We should validate the values to be well-formed the same way as SocketsHttpHandler does:
OperationStatus status = Ascii.FromUtf16(s, buffer, out int bytesWritten);

I.e. For ASCII chars.

See RFC for header values: https://www.rfc-editor.org/rfc/rfc9110.html#name-field-values

Note: it allows up to the full byte to allow encoding like Latin-1 for historical purposes.

Metadata

Metadata

Assignees

Labels

area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additions

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions