Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


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

wants to merge 1 commit into from

2 participants


Apps could set this even if they probably shouldn't. Avoiding the duplicate.


You also need to factor in the possibility of application setting the 'Transfer-Encoding: identity' header (which would indicate that message is terminated by closing the connection), in which case as per RFC2612 the 'Transfer-Encoding: chunked' is not necessary. Something like is what I use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Starman/
5 lib/Starman/
@@ -475,7 +475,10 @@ sub _finalize_response {
if ( !exists $headers{'content-length'} ) {
if ( $status !~ /^1\d\d|[23]04$/ && $env->{REQUEST_METHOD} ne 'HEAD' ) {
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;
Something went wrong with that request. Please try again.