-- AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <list...@listserv.aol.com> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
> The code below does not produce valid output in AOL 4.5.1. But why?..
does it produce valid output in other versions of nsd?
The nsreturnz sources seem to be saying that a response with the gzip Content-Encoding isn't just a plain gzip compressed copy of the uncompressed body -
http://aolserver.cvs.sourceforge.net/viewvc/aolserver/nsreturnz/nsreturnz.c
/* copy the gzip header into the first 10 bytes, wiping out the
first 2 bytes from compress2. Add 8 to outlen for the gzip
header (10-2), subtract 4 because we're ignoring the last 4
bytes of compress2 */
is there any reason you're not just using ns_returnz ?
cheers
Russell
> ns_register_proc GET /headers ad_headers_proc
>
> proc ad_headers_proc {ignore} {
> set result {}
> set headers [ns_conn headers]
> for {set i 0} {$i < [ns_set size $headers]} {incr i} {
> set key [ns_set key $headers $i]
> set value [ns_set value $headers $i]
> append result "$key: $value\n"
> }
> ns_updateheader Content-Encoding gzip
> ns_return 200 text/plain [ns_zlib gzip $result]
> }
--
> > is there any reason you're not just using ns_returnz ?
>
> There is no ns_returnz function in upstream AOL repository:
>
> $ git clone git://github.com/aolserver/aolserver
> $ cd aolserver/
> $ rgrep ns_returnz .
hmmm, I guess it's one of the modules that Dossy hasn't copied over from sourceforge... other than that I'm not aware of any reason to not use it...
cheers
Russell
http://junom.com/gitweb/gitweb.perl?p=aolserver.git;a=tree;f=nsreturnz;h=49d6471737b294;hb=master
(use the snapshot link on this page to get a zip or tgz of just this
module (unfortunately the enclosing directory will be misnamed).
I've already done a cvsimport on all the modules. I'll put them up on
github later today.
tom jackson
http://junom.com/gitweb/gitweb.perl?p=aolserver.git;a=tree;f=nszlib;h=0ac26233;hb=origin
tom jackson
BTW, I think the functionality in the external module nsreturnz is now
part of nszlib
tom jackson
I don't use this feature, it just puts extra work on the server and
client to save something. If service providers think it is necessary
to save bandwidth, they could probably compress the content
themselves. But from looking at the code, you shouldn't have to do
anything except configure the module to get transparent compression.
You have to set minimum file content size, etc. and adp needs
independent configuration if you use adps. In other words, you don't
have to edit your site code to get compression with ns_zlib.
tom jackson
Personally I also wouldn't assume that AOLserver works perfectly with
Tcl8.6. Unless you absolutely need 8.5, I would stick with the latest
8.4 version. For one thing 8.4 is faster than either.
tom jackson
2010/12/1 Alexey Pechnikov <pech...@mobigroup.ru>:
> 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 <pech...@mobigroup.ru>
>>
>> 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
That's no longer true.
I remember looking into ns_zlib just because it was part of the adp
processing/fastpath code. I don't have any reason to believe that, if
configured correctly it doesn't work. I also doubt that ns_zlib would
have wound up in the core unless it worked, the author is well known
and I've never heard of anyone suggesting any of the repo modules
"don't work".
I'll try to look into how ns_zlib is supposed to work. Maybe this is a
total lack of documentation problem.
tom jackson
Not sure what is no longer true. AOLserver is pretty much ahead of Tcl
wrt client/server programming (and about 15 year ahead of Java). Tcl
8.6 continues to head into the direction of poor performance and
useless new API. In case programmers haven't figured it out,
multi-core processors are the norm, so stuff like thread bound
coroutines are useless wrt performance and much harder to program than
C thread based servers. But if you are stuck in one thread,
maybe..."maybe" there is some benefit in moving to Tcl 8.6, unless you
are using AOLserver.
Please don't listen to the Tcl gurus, they are behind the
curve...actually they are actively slowing down the curve. The
evidence is simple: 8.4 is faster than 8.5 which is faster than 8.6.
How is this even possible? The answer is simple: the developers do no
know what they are doing. The evidence is the performance.
tom jackson
The OpenACS community has decided some time ago
to require 8.5 for future releases.
>Please don't listen to the Tcl gurus, they are behind the
>curve...actually they are actively slowing down the curve.
Come on, stop that bashing. Jeff was referring to
http://code.activestate.com/lists/tcl-core/9805/
On real problems, the Tcl-core people are very helpful
and highly responsive...
-gustaf neumann
> >Please don't listen to the Tcl gurus, they are behind the
> >curve...actually they are actively slowing down the curve.
>
> Come on, stop that bashing. Jeff was referring to
> http://code.activestate.com/lists/tcl-core/9805/
Actually even more recent changes have improved things further. 8.5 is now actually faster than 8.4 on the benchmarks. In any case, we've learned to tune out people that only throw heat without light.
Jeff
And yet your examples provided even less customization. There is
almost no reason to waste cpu on compressing output, just provide a
gzipped file for very large files. Who are you trying to save money
for anyway?
> I don't think that this code is useful for production.
Right, then don't use it.
> And we may
> add ETAG functionality and smart caching checksums of results for decreasing
> data transfer and server loading. I dont know about your situation but my
> clients have limited internet connections (especially on mobile devices) and
> ETAG header transmitting is faster when gzipped content...
Then the least of your problems is gzipping content, you need to
actively minimize the data transfered. But all of this sounds like
_your_ problem, not the problem of a generic application server. You
haven't even figured out how automatic compression works in AOLserver
yet you want to propose additional features.
> For static files
> on group of hosts application-defined ETAG is helpful too but internal AOL
> last-modified-since mechanizm is niot useful (it's not the AOL problem, of
> cource).
??
> P.S. I dont understand why my suggestion to complete AOL documentation by
> examples was produce the holywar about Tcl 8.4 vs 8.5 vs 8.6.
Because I'm a jerk and overreact to what I think are idiotic statements?
BTW, you didn't provide any useful additions to AOLserver documentation.
> I think AOL
> 4.5.1 + Tcl 8.5 is better choice for new projects and Tcl 8.6 is better for
> some utilities (fast internal base64 realization, half-closed sockets and
> other features help me to build faster applications with a few lines of
> code).
I agree with Gustaf: the latest 8.5 is worth the effort. There are
certain features which simplify very annoying code. This is true even
if your version of 8.5 is slower than 8.4. But you have to actively
update your code to take advantage of the new features. The more code
you have, the less benefit you get from upgrading without code
conversion. However, Gustaf mentioned a higher stability in 8.5. This
could easily override the limited benefit of simply moving the Tcl
library to 8.5 from 8.4.
> Tcl 8.6 documentation of zlib functions is much better than AOL
> documentation of ns_zlib module and some of this docs and examples can be
> helpful for AOL, why not?
If you use Tcl, use the Tcl documentation. If you use AOLserver, use
the AOLserver documentation. I'm not sure why you keep confusing these
two things.
tom jackson (AKA the jerk)
I only skimmed over the code, but it looks like the problem is that the
content is only gzipped if the NS_CONN_GZIP flag is set on the conn, and
the only place that flag is set is in the adp processor.
The obvious (I think) improvement is to expose
Ns_ConnGetGzipFlag/Ns_ConnSetGzipFlag as subcommands of ns_conn, which
would let you write a filter to do the ancient/broken browser checking
or whatever else you needed and turn gzip on or off as needed.
(However, doing this could impact adp processing, so a corresponding
change might need to be made there, lest your adp code has a different
idea about what should or shouldn't be compressed)
-J
We had a similar discussion about this a couple years ago. See
http://www.mail-archive.com/aols...@listserv.aol.com/msg11598.html (although
the threading is messed up in the mail archive, so you will have to skip
around).
At the time, if I remember, there wasn't a real consensus, so I made changes in
my sandbox to mimic the adp compression but for ns_return. If people are
interested, I can try to dig up the code.
Notwithstanding your legitimate issue that gzipping every html and css
file on the fly is counterproductive in many cases, one case this is
not true is serving to mobile devices - if you're on the end of a weak
GPRS connection with a fairly powerful cpu, you are going to notice
the difference between gzipped and ungzipped content.
Just my 2c :)
--
Mark Aufflick
�http://mark.aufflick.com/about/contact
�http://pumptheory.com/about
If your website/service actually serves up content for mobile
customers, it would also help to generate scaled down content for
these users. This is a much bigger change than simply compressing the
content, but many web pages seem unusable in on small device screens,
heck some of the triple column news sites are almost impossible on a
laptop.
Maybe we should look at putting this into ns_return/fastpath if Brett
has a list of the changes.
tom jackson
Brett: you could email me the changed source files instead of
providing a patch to some git or cvs version.