RusticiSoftware/TinCanJS

Content-Length should be a form parameter for IE mode requests

Opened this issue · 2 comments

I don't think there is any change needed here for this request. If the client is using a 'Content-Length' header then it was explicitly set since the library itself doesn't ever set it automatically. In that case the library will automatically shove all headers it isn't doing itself into the form encoded body, and then the browser may add the actual request content length automatically, which is still within spec.

My understanding is that we should always be sending a content length header. This is something that is not a MUST, but is encouraged in 1.0.3 and very loosely implied in earlier versions (you explicitly MAY omit Content-Length in HEAD requests).

It doesn't generally matter that TinCanJS doesn't add a content-length header for normal requests because the browser adds it (I think all the main ones do?). It's more important for alt syntax requests because those never add the content length form parameter.

A complete solution would also ensure we're not relying on the browser adding the header too.