Skip to content

Instantly share code, notes, and snippets.

@ozuma
Created July 24, 2013 05:30
Show Gist options
  • Save ozuma/6068257 to your computer and use it in GitHub Desktop.
Save ozuma/6068257 to your computer and use it in GitHub Desktop.
Suppress "Transfer-Encoding: chunked" header and chunked body in CGI. (Apache, Perl)
#!/usr/bin/perl
use strict;
use warnings;
my $body = <<"EOM";
<html>
<head>
<title>title</title>
</head>
<body>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</p>
<p>ccccccccccccccccccccccccccccccccccccccccccccccccccccccc</p>
</body>
</html>
EOM
# When you add "Content-Length" header, Apache doesn't respond with
# > Transfer-Encoding: chunked
# even in HTTP/1.1 .
print "Content-Type: text/html\n";
print "Content-Length: " . length($body) . "\n";
print "\n";
print $body;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment