Skip to content

HTTP/2 - Valid horizontal tab "\t" in http header is coverted into "?" #13336

@stanley13442

Description

@stanley13442

Jetty version(s)
12.0.18 (problem also exist in latest Jetty version)

Jetty Environment
Core

Java version/vendor (use: java -version)
JAVA 17

OS type/version
Linux

Description
public static char sanitizeFieldVchar(char c) will convert valid horizontal tab "\t" into "?" causing traffic failure.

As indicated in RFC 9110, a HTAB is a valid OWS (5.6.3 Whitespace) that is allowed in http header parameters (5.6.6 Parameters) and HTTP field values (5.5 Field Values). However, Jetty treats HTAB as an illegal control character.

public static boolean isIllegalFieldVchar(char c) { return (c >= 256 || c < ' '); }

For your reference:

5.6.6 Parameters
parameters = *( OWS ";" OWS [ parameter ] )
parameter = parameter-name "=" parameter-value
parameter-name = token
parameter-value = ( token / quoted-string )

5.6.3 Whitespace
OWS = *( SP / HTAB )
; optional whitespace

5.5 Field Values
field-value = field-content
field-content = field-vchar
[ 1
( SP / HTAB / field-vchar ) field-vchar ]
field-vchar = VCHAR / obs-text
obs-text = %x80-FF

We also test the behavior of other popular web servers:
Image
Jetty is the only one that handled this issue differently.

How to reproduce?
Send a http2 request with 'Content-Type: text/plain; \t\t\tcharset=UTF-8', each '\t' will be replaced by '?', as shown in

Image

Metadata

Metadata

Labels

BugFor general bugs on Jetty sideSpecificationFor all industry Specifications (IETF / Servlet / etc)

Type

No type

Projects

Status

✅ Done

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions