From e7e6f076f6ba811827c253bf134cc40ccce4afae Mon Sep 17 00:00:00 2001 From: Charl Mert <cmert@lbsd.net> Date: Fri, 22 Nov 2013 15:33:38 +0200 Subject: [PATCH] setting content length to 0 for HTTP 1.1 redirects closes issue #2 --- opentrafficshaper/POE/Filter/HybridHTTP.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/opentrafficshaper/POE/Filter/HybridHTTP.pm b/opentrafficshaper/POE/Filter/HybridHTTP.pm index 4b79c50..79a3498 100644 --- a/opentrafficshaper/POE/Filter/HybridHTTP.pm +++ b/opentrafficshaper/POE/Filter/HybridHTTP.pm @@ -460,10 +460,11 @@ sub _build_raw_response if (!defined($response->header("Server"))) { $response->push_header("Server","POE Hybrid HTTP Server v$VERSION"); } - # Set our content Length - if (my $length = length($response->content)) { - $response->push_header("Content-Length",$length); - } + + # Set our content length + # - This is required even if the content length is 0, for instance when we doing a REDIRECT with no content some browsers hang if + # - there is no content length set. + $response->push_header("Content-Length",length($response->content)); # Setup our output my $output = sprintf("%s %s",$self->{'protocol'},$response->status_line); -- GitLab