But does not work for cyrillic strings. And zlib in Tcl 8.6 produce wrong
result too:
set content привет
set gzip [binary format "H*iH*" "1f8b0800" [clock seconds] "0003"]
append gzip [zlib deflate $content 0]
append gzip [binary format i [zlib crc32 $content]]
append gzip [binary format i [string length $content]]
set fd [open /tmp/test.gz w]
fconfigure $fd -translation binary -encoding binary
puts -nonewline $fd $gzip
close $fd
puts [exec zcat /tmp/test.gz ]
?...@825b
But for latin symbols all right:
set content hello
set gzip [binary format "H*iH*" "1f8b0800" [clock seconds] "0003"]
append gzip [zlib deflate $content]
append gzip [binary format i [zlib crc32 $content]]
append gzip [binary format i [string length $content]]
set fd [open /tmp/test.gz w]
fconfigure $fd -translation binary -encoding binary
puts -nonewline $fd $gzip
close $fd
puts [exec zcat /tmp/test.gz ]
hello
2010/12/1 Alexey Pechnikov <[email protected]>
> This work correct:
>
> ns_register_proc GET /test ad_test_proc
>
> proc ad_test_proc {ignore} {
> set gzip [ns_zlib gzip "test"]
> set time [ns_httptime [ns_time]]
> ns_write "HTTP/1.0 200 OK
> Content-Type: text/plain; charset=utf-8
> Content-Encoding: gzip
> \n"
> ns_write $gzip
> }
> $ curl http://localhost:8200/test 2>/dev/null| hexdump
> 0000000 8b1f 0008 0000 0000 0300 492b 2e2d 0001
> 0000010 7e0c d87f 0004 0000
> 0000018
>
>
> But is possible to disable all output translations by ns_return? Where is
> documented how ns_return process the data?..
>
> --
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
>
--
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.