JavaScript considered harmful (was Re: New online index to Be azley's tutorials)

Delaney, Timothy tdelaney at avaya.com
Tue Jan 8 23:03:41 EST 2002


> From: Steve Holden [mailto:sholden at holdenweb.com]
> "Skip Montanaro" <skip at pobox.com> wrote in message
> news:mailman.1010542632.12583.python-list at python.org...
> >
> >     >> Did you consider using Content-Encoding: gzip and 
> compress the data
> >     >> on-the-fly? Usually works very well.
> Not without using special methods to force IIS to treat the content as
> binary. IIS is pretty picky about stuff like that! But I seem 
> to remember
> having to do something similar to get graphical content out 
> through IIS from
> a Python script (I should have used CGI rather than ASP, but 
> that's another
> story). The thing you NEED to know about is the BinaryWrite 
> method of the
> Response object.

All this is possible, but none of these methods are automatic. They require
explicitly gzipping things, etc, and lots of testing to make sure you have
it right.

What is needed for this to be used in the general case from IIS is automatic
addition of Content-Encoding: gzip (or Transfer-Encoding: gzip I think) and
the corresponding gzipping done by a filter (presumably ISAPI) whenever it
encounters an Accepts-Encoding: gzip (or whatever is the correct header).
Preferably only for text/* formats ... (why use processing power on both
ends for gzipping images when you are unlikely to gain anything ...).

I think this is what mod_gzip does for Apache.

However, there appears to be nothing viable for IIS 4.0 (possibly for IIS
5.0).

In the particular case I was dealing with (a single, very large page), the
additional stuff (adding something to do the compression, testing it,
testing the page both with and without a browser that supported it, etc)
could in no way be justified compared to the simple and effective use of
Javascript - especially as the site already required Javascript (against my
recommendation I may add - unfortunately, multiple developers ...).

I am in no way advocating Javascript - I personally advocate *against* it,
except in those cases where it proves to be very useful.

Tim Delaney




More information about the Python-list mailing list