report: gzip output if supported by browser
authorMans Rullgard <mans@mansr.com>
Fri, 30 Jul 2010 23:34:03 +0000 (00:34 +0100)
committerMans Rullgard <mans@mansr.com>
Fri, 30 Jul 2010 23:34:03 +0000 (00:34 +0100)
report.cgi

index fab8296..375dd3c 100755 (executable)
@@ -47,7 +47,14 @@ if (open P, "$slotdir/lastpass") {
 
 # main text
 
-print "Content-type: text/html\r\n\r\n";
+print "Content-type: text/html\r\n";
+
+if ($ENV{HTTP_ACCEPT_ENCODING} =~ /gzip/) {
+    print "Content-Encoding: gzip\r\n\r\n";
+    open STDOUT, '|-', 'gzip';
+} else {
+    print "\r\n";
+}
 
 doctype;
 start 'html', xmlns => "http://www.w3.org/1999/xhtml";