I'd have to look again to confirm whether or not ns_return wasn't binary
safe, but I wouldn't be surprised. I recently patched ns_http to correctly
handle the sending and receiving of binary data. I'll try and take a look at
as ns_return next. Would you mind adding this as a bug? Thanks!
- n
On 4/19/07, Rusty Brooks <[EMAIL PROTECTED]> wrote:
I don't believe you can use ns_return with binary data.
By the way, are there any plans to change that? Or make a
ns_return_binary or something? I have a lot of code that writes to a
file and then does ns_returnfile
Rusty
John Buckman wrote:
> How do you enable gzip page compression on ns_register_proc pages?
>
> The adp gzip compression occurs in C code, in Ns_ConnFlush(), which
> checks for "Accept-Encoding: gzip"
>
> Since a "ns_register_proc" uses "ns_return", like this:
> ns_return $conn 200 text/html $html
>
> I believe it's bypassing this gzip code, and always returning html.
>
> I wrote a ns_return_gzipped() proc (see below), but it doesn't seem to
> work, so I was wondering if anyone's done this already, and how.
>
> FYI I switched BookMooch to use adp gzip compression, and the results
> are impressive. 200k html files go to 35k, greatly speeding up the
> user experience.
>
> -john
>
>
>
> proc ns_return_gzipped {conn html} {
>
> if {[string first {gzip} [ns_set get [ns_conn headers]
> {Accept-Encoding}]] != -1} {
> set zl [ns_zlib gzip $html]
> ns_set put [ns_conn outputheaders] Content-Encoding gzip
> ns_return $conn 200 text/html $zl
> } else {
> ns_return $conn 200 text/html $html
> }
>
> }
>
>
> --
> 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.
--
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.
--
Nathan Folkman
[EMAIL PROTECTED]
--
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.