Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition of HTTP field-content is stricter than validate_headers #4221

Open
nigoroll opened this issue Nov 3, 2024 · 1 comment
Open
Labels
a=Implement Issue is ready for implementation

Comments

@nigoroll
Copy link
Member

nigoroll commented Nov 3, 2024

Upon review I noticed that our validate_headers implementation from #3407

// rfc7230,l,1243,1244
// ASCII VCHAR + TAB + obs-text (0x80-ff)
static inline VCL_BOOL
validhdr(const char *p)
{
AN(p);
for(;*p != '\0'; p++)
if (! vct_ishdrval(*p))
return (0);
return (1);
}

#define vct_ishdrval(x) \
(((uint8_t)(x) >= 0x20 && (uint8_t)(x) != 0x7f) ||(uint8_t)(x) == 0x09)

allows *( field-vchar / SP / HTAB) while already RFC7230 defined

     field-content  = field-vchar                                    
                      [ 1*( SP / HTAB ) field-vchar ]

This has not changed with RFC9110, which removed the line folding:

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

Unless I overlook anything (again), I think we can summarize as "any positive amount of SP/HTAB needs to be enclosed by field-vchar", which should be equivalent to "the last and first character of field-content need to be field-vchar".

Do we want to make our implementation more strict?

nigoroll added a commit that referenced this issue Nov 3, 2024
@nigoroll
Copy link
Member Author

nigoroll commented Nov 4, 2024

bugwash: yes, we want to tighten the check
Todo: write the code

@nigoroll nigoroll added the a=Implement Issue is ready for implementation label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a=Implement Issue is ready for implementation
Projects
None yet
Development

No branches or pull requests

1 participant