Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aviod duplicate Transfer-Encoding: chunked when already set in headers #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/Starman/Server.pm
Expand Up @@ -475,7 +475,10 @@ sub _finalize_response {
if ( !exists $headers{'content-length'} ) { if ( !exists $headers{'content-length'} ) {
if ( $status !~ /^1\d\d|[23]04$/ && $env->{REQUEST_METHOD} ne 'HEAD' ) { if ( $status !~ /^1\d\d|[23]04$/ && $env->{REQUEST_METHOD} ne 'HEAD' ) {
DEBUG && warn "[$$] Using chunked transfer-encoding to send unknown length body\n"; DEBUG && warn "[$$] Using chunked transfer-encoding to send unknown length body\n";
push @headers, 'Transfer-Encoding: chunked'; # Only push where 'chunked' encoding is not already present
push @headers, 'Transfer-Encoding: chunked'
unless (( exists $headers{'transfer-encoding'})
&& ( $headers{'transfer-encoding'} =~ /chunked/ ));
$chunked = 1; $chunked = 1;
} }
} }
Expand Down