sdroege / rtsp-types

RTSP (RFC 7826) types and parsers/serializers
MIT License
26 stars 13 forks source link

Trim leading and trailing whitespace from header values #16

Closed nemosupremo closed 1 year ago

nemosupremo commented 1 year ago

Ref. scottlamb/retina#77

I've come across a device that appends a trailing space after the CSeq header which causes retina to fail to parse that header. I've attempted a quick fix in the retina library (See, scottlamb/retina#77), but after some discussion @scottlamb came to the conclusion it is more appropriate to fix this issue in rtsp-types after consulting the spec RFC 9110:

A field value does not include leading or trailing whitespace. When a specific 
version of HTTP allows such whitespace to appear in a message, a field parsing 
implementation MUST exclude such whitespace prior to evaluating the field value.
sdroege commented 1 year ago

Sounds like a good idea to me. Do you want to provide a PR for skipping leading/trailing whitespace?