tenderlove/mechanize — Issue #176: Mechanize should provide a mechanism to ignore bogus Content-Length
Author: rdpoor
Created: 2011-12-20 19:07:05+00:00
State: open

I'm working with a site that generates incorrect values for Content-Length when the body is compressed. An example header:

HTTP/1.1 200 OK
Server	Netscape-Enterprise/6.0
Content-length	538
Content-type	text/html;charset=UTF-8
Pragma	no-cache
Content-language	en
Cache-control	no-cache
Pragma	no-cache
Content-encoding	deflate
Transfer-encoding	Chunked

... however the body is only 526 bytes long. (In this case, it appears the site always advertises Content-Length 12 bytes greater than the actual body).

Since there is no way to control what the external server generates, it would be swell if Mechanize had some documented mechanism for ignoring a bogus Content-Length for cases such as this.