Below is a ns_return_gzipped proc that replaces ns_return and sends back gzipped output.

It worked fine everywhere, *except* with a debugging http proxy I used (in ActiveState's Komodo) where pages stalled. I was thinking perhaps the problem is that "Connection: close" wasn't being honored by the proxy, but it makes me nervous, because the builtin ADP gzip compression works fine with the proxy.

Is there a way to force a connection closed in a ns_register_proc page, after ns_write? I can't use "ns_conn close" in this context, since that's an ADP command.

-john


proc ns_return_gzipped {conn html} {
        
        set zl [ns_zlib gzip $html]

set h [subst {HTTP/1.0 200 OK
MIME-Version: 1.0
Server: AolServer/4.5.0a
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-Length: [string length $zl]
Content-Encoding: gzip

$zl}]

        ns_write $conn $h
   return TCL_OK
}


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to