Subject: | Content-length error fix |
Ok, so I think I finished investigating the issue with the content
length. And here are the results of my investigation plus a patch.
Effectively this issue happens when the web server itself issued a
Document Has Moved and Catalyst issues a Document Has Moved on a
redirect while Keep-Alive is active.(From my understanding keep-alive
was deprecated as of HTTP 1.1 but some browsers still use HTTP 1.0 to
pre-load content on page and achieve more connections).
So effectively what happens is catalyst calculates the content-length of
its content not taking into account that the web server such as IIS
appends its own content prior. This makes the content-length incorrect
and cut off the buffer at the wrong point on the redirect page. Once
redirected due to keep-alive the previous buffer that has been cut off
still remains and again gives you the wrong content-length on the
landing page.
Anyways, the solution I propose is to add a config option of
"disable_redirect_html" that will disable catalyst from writing its own
HTML when the body is missing on redirects and lets the server handle
the document has moved.
Line 1856 -
if ( !$response->has_body ) {
to
Line 1856 +
if ( !$response->has_body and !$c->config->
{disable_redirect_html} ) {
What do you think?