MKNetworkKit icon indicating copy to clipboard operation
MKNetworkKit copied to clipboard

Made the HTTP header matching case insensitive

Open cbrauchli opened this issue 13 years ago • 3 comments
trafficstars

I've noticed that some servers return ETag headers with name "Etag," "ETag," "ETAG", etc. all of which do not get matched by NSDictionary's "objectForKey" method, which is case sensitive. HTTP header names are case insensitive. This commit allows case insensitive matching.

cbrauchli avatar Jan 11 '12 08:01 cbrauchli

according to rfc correct spelling is "ETag". If a server doesn't spell it correctly- it's a server problem.

yas375 avatar Jan 08 '13 08:01 yas375

If a server doesn't spell it correctly- it's a server problem.

Ran across this on google and just wanted to note for future visitors that the casing should make NO difference. Headers are case-insensitive as per RFC 2616 Section 4.2. etag, ETag, ETAG, eTaG ... they should all be accepted and usable by any application/server that purports to be HTTP/1.1 compliant.

So if it's not spelled correctly it's a "server problem." But if it's not capitalized in your specific way it's a "you problem" and the casing should be normalized before use.

rdlowrey avatar Jan 29 '13 21:01 rdlowrey

my bad( You are right, @rdlowrey!

yas375 avatar Jan 30 '13 10:01 yas375