ESPAsyncWebServer icon indicating copy to clipboard operation
ESPAsyncWebServer copied to clipboard

Case-insensitive header field names

Open bergos opened this issue 10 years ago • 5 comments

The RFC 7230 3.2 and also the old RFC 2616 4.2 define the field name as case-insensitive. node-fetch sends the content-length header field in lower case. That means the web server doesn't go into that if branch. I tested it with a quick 'n dirty or condition. I would like to make a PR. I think a generic solution, calling .toLowerCase() after this line would be the best solution, but that would also cause changes in many other places in the code and maybe even applications that use the web server library. What do you prefer?

bergos avatar Aug 07 '16 09:08 bergos

this is a good point. I did put some thought on it, no clear resolution in my mind :) You have methods for getting, searching and adding headers and I am not sure how all that will play out and what is the best way to deal with it.

me-no-dev avatar Aug 12 '16 06:08 me-no-dev

Even applications that use the web server library should deal with field names as case-insensitive, so providing the names in lower case only fashion could be useful. Not sure about it, though.

ClaudioHutte avatar Aug 12 '16 14:08 ClaudioHutte

+1 for toLowerCase in the library.

It neatly forces some standards compliance on my code

penfold42 avatar Aug 13 '16 00:08 penfold42

maybe equalsIgnoreCase should be used throughout the lib so case would not matter. I do not really want to force either situation.

me-no-dev avatar Aug 27 '16 20:08 me-no-dev

Should be resolved in the above commit

me-no-dev avatar Sep 02 '16 10:09 me-no-dev