[PLUG] HTML Whitespace Compression

Paul Heinlein heinlein at attbi.com
Sat Jul 13 04:57:38 UTC 2002


On Fri, 12 Jul 2002, Jason Van Cleve wrote:

> > * quoted strings in JavaScript, or any client-parsed script
> 
> How would quoted strings be a problem?  They start with a quote, not
> whitespace.  Remember, I'm just talking about whitespace at the start of
> lines, not everywhere.

I've never actually tried doing a multi-line string in JavaScript, but 
my hunch is that it's possible, just like it is in, say, Perl:

my $str = qq/
ooh

                this

     whitespace is part
  of the string
/;

And the minute you say, oh, OK, we'll make an exception for 
JavaScript, then you'll end up changing a standard Internet protocol
every time a new client-side scripting language evolves. I just don't 
think the HTTP protocol should bear the burden of defining what is and 
isn't significant whitespace.

> > * strings in forms
> 
> You mean as in a TEXTAREA?  That's probably another exception, but
> like PRE, it shouldn't be that hard.

In Textareas, yeah, and in <option value="blah">, where the value 
string could, according to the HTML spec, span lines. It's unlikely, 
granted, but a stripper could violate the integrity of a legitimate 
string.

> I'm actually a little suprised there's no compression features in
> HTTP.  Seems like the browser could request a page and indicate that
> it supports a simple compression of some sort, and the server could
> then compress it on its way out.

Some clients, even old ones like Mosaic, supported some forms of
decompression on the fly, but it's certainly not part of the HTTP
protocol.  Under some circumstances, like when the client and server 
are communicating at ethernet speeds, compression can actually slow
things down.

--Paul Heinlein <heinlein at attbi.com>






More information about the PLUG mailing list