O wise ones, please can you assist in a most vexatious problem I'm having with IIS6.

I am running a site under IIS6 on windows server 2003 using Activestate Perl as an ISAPI filter for cgi.

Everything works fine. Well as fine as anything can do under IIS ;-)

I want to enable gzip compression by the server of cgi content and have religiously followed the instructions provided both on the microsoft site here;

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true
And checked it against some real world use here;
http://www.codinghorror.com/blog/archives/000059.html

All my STATIC content (eg html) is being compressed nicely thank you IIS. But NONE of my cgi content is being compressed :(

Here is the response to a request of a static file as shown by live http headers in firefox;

GET /terms.htm HTTP/1.1 Host: www.backupsdb.com:8000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.2 +) Gecko/20090729 Firefox/3.5.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive If-Modified-Since: Sat, 04 Jul 2009 10:57:03 GMT If-None-Match: "80a9992996fcc91:f46" Cache-Control: max-age=0 HTTP/1.x 200 OK Content-Length: 5527 Content-Type: text/html Content-Encoding: gzip Last-Modified: Sat, 04 Jul 2009 10:57:03 GMT Accept-Ranges: bytes Etag: "80a9992996fcc91:f42" Vary: Accept-Encoding Server: Microsoft-IIS/6.0 Date: Wed, 05 Aug 2009 10:12:34 GMT Connection: close

Here is the request and response to the SAME content, but being delivered by a cgi script.

GET /testzip.cgi HTTP/1.1 Host: www.backupsdb.com:8000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.2 +) Gecko/20090729 Firefox/3.5.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 200 OK Expires: Wed, 05 Aug 2009 10:10:57 GMT Date: Wed, 05 Aug 2009 10:10:57 GMT Content-Length: 22527 Content-Type: text/html; charset=ISO-8859-1

This is the code fragment I am using in this test case for outputting the page of text;

my $length = length($HTML); print $cgi->header( -nph=>1, -Content_length=>$length, -expires=>'+0s', -type=>"text/html") ; print $HTML;

I've tried several variations such as turning off non parsed headers, adding a vary=>accept encoding header, but to no avail. I have a hunch that the ISAPI plugin is interfering with the IIS config for dynamic script compression but I could equally be doing something wrong ...

Has anyone here persuaded IIS6 to serve cgi content using the ISAPI perl filter OK?? If so, what's the secret please!!

Kind Regards
Roger

UPDATED -------

It seems that if instead of running Perl as an ISAPI filter, I run it as standard CGI, everything works as expected (implying my server config is probably ok) - except of course my performance is now hammered by the lack of persistence. Is this a bug in the implementation of the Perl ISAPI filter or is there a workaround??


In reply to Persuading IIS6 to gzip Perl ISAPI cgi? by brancusi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.