httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matt farey <matt.fa...@gmail.com>
Subject Re: [users@httpd] Stripping white space from HTML
Date Sun, 11 Mar 2007 19:27:37 GMT




Nick Kew wrote:
> On Sun, 11 Mar 2007 11:45:04 -0700
> Grant <emailgrant@gmail.com> wrote:
>
>   
>>> You'd incur a far lower penalty using a SAX-based parser such as
>>> mod_proxy_html or mod_publisher.
>>>       
>> How could you use either of those to eliminate white space in
>> delivered HTML?  Would implementing the DTD feature of mod_publisher
>> automatically do it?
>>     
>
> Hmmm, good point.  I had something slightly different in mind.
> An MLRewriteRule to collapse superfluous whitespace will do it
> (and either module will automatically collapse it within your tags).
>
>   
>>> If the issue is just one of transmitting far too many bytes, then
>>> standard compression with mod_deflate will fix that.  That's also
>>> a performance hit, so you might want to use mod_cache.
>>>       
>> I plan on using mod_gzip to eliminate bytes at some point.
>>     
>
> You mean mod_deflate.  mod_gzip is obsolete.
>
>   
>> 	  Right now
>> all I want to do is eliminate all white space from my delivered HTML.
>>     
>
> mod_line_edit might be a better bet, perhaps with a LERewriteRule to
> collapse any whitespace of more than one byte to a single space.
>
>   

As I understand it, the reason why you wish the whitespace to be reduced
is so you look at the source within your browser, and that you plan to
use mod_deflate later ro reduce bandwidth (which is surely not too much
of a problem - it's probably equivalent to resampling a few of your
images by 5% here and there, or optimising your caching!), but you can't
reduce the whitespace inside your application logic (which is where the
problem should be fixed) because you don't have control over the code.

You have 3 (1,2,4) really good (performance neutral) options not
mentioned so far,
1) use a whitespace stripping http proxy you run on your LAN
2) use mod security, removewhitespace in response body
3) use a rewrite rule to a reg exp based whitespace server-side script
which serves each page of your application.
4) similar to (3) use an autoprepend rule to serve your white space
laden pages through a reg exp based whitespace stripping script.

I would probably go for 1,3 or 4, because they are so easy.

(2) carries a performance hit, but use of mod security is highly
regarded and I would say is an esssential part of protecting an
application such as yours - one for which you do not own and cannot
change the code.

matt


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message