2010/12/1 Tom Jackson <[email protected]>

> BTW, I think the functionality in the external module nsreturnz is now
> part of nszlib


But are you sure that this works? In my tests only ns_returnfile work
correct for gzipped content:


ns_register_proc GET /test  ad_test_proc
proc ad_test_proc {ignore} {
    ns_updateheader Content-Encoding gzip
    ns_return 200 text/plain [ns_zlib gzip "test"]
}

$ curl http://localhost:8200/test 2>/dev/null| hexdump
0000000 c21f 088b 0000 0000 0000 2b03 2d49 012e
0000010 0c00 7f7e 98c3 0004 0000
000001a


ns_register_proc GET /test  ad_test_proc
proc ad_test_proc {ignore} {
    set fd [open /tmp/test.gz r]
    fconfigure $fd -translation binary -encoding binary
    ns_updateheader Content-Encoding gzip
    ns_return 200 text/plain [read $fd]
    close $fd
}
$ echo -n test|gzip>/tmp/test.gz
$ curl http://localhost:8200/test 2>/dev/null| hexdump
0000000 c21f 088b c300 7f99 b6c3 004c 2b03 2d49
0000010 012e 0c00 7f7e 98c3 0004 0000
000001c


ns_register_proc GET /test  ad_test_proc
proc ad_test_proc {ignore} {
    ns_updateheader Content-Encoding gzip
    ns_returnfile 200 text/plain /tmp/test.gz
}
$ echo -n test|gzip>/tmp/test.gz
$ curl http://localhost:8200/test 2>/dev/null| hexdump
0000000 8b1f 0008 7fd9 4cf6 0300 492b 2e2d 0001
0000010 7e0c d87f 0004 0000
0000018

Browsers can show only last question result. I don't understand how ns_zlib
encode the data.

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/


--
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