HttpHeader lowercase field names

47 views
Skip to first unread message

Doug Reese

unread,
Aug 31, 2016, 5:08:29 AM8/31/16
to Dart Misc
Hi,

I'm using the dart:io HttpClient to communicate with an API that is not under my control.  This API incorrectly requires case sensitive header field names, such as:

Authorization: Basic xxxyyyzzz

The HttpClientRequest header gets sent as:

authorization: Basic xxxyyyzzz

which is technically correct (according to RFC 7230 section 3.2*), but does not work against this API.  I have asked for the API to be fixed, however this is for a very vertical market application that is installed in customer sites.  Even if the API is fixed, I do not yet know how often customer sites are updated.

I have looked at the HttpHeader code, and the lowercasing of the field name is really baked in. In reading the RFC*, I can interpret it to mean the case of the field name could (should?) be completely ignored by the client, with all the adjustment to lowercase happening on the server for the purposes of comparison.  According to the spec, it seems I should be able to send "AuThOrIzAtIoN" and expect it to be matched to "authorization" on the server.  

Any thoughts on removing the "force to lowercase" of header field names?  I realize this would require a change in how the HttpHeader class ensures there are no duplicate header field names as well (section 3.2.2 of the RFC). 

In the short term, any suggestions as to how I might support an API that incorrectly requires the field name to have an uppercase first letter?  Since I cannot authenticate properly this project is dead in the water right now.

Thanks.

Doug


3.2. Header Fields

Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.
Reply all
Reply to author
Forward
0 new messages