You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Joey Hewitt <jo...@joeyhewitt.com> on 2004/06/29 22:21:18 UTC

[users@httpd] HTML compression module?

Hi,

I found a site that lets you paste (X)HTML or CSS into a textarea and submit
it to a script that strips out newlines and other stuff that is not strictly
necessary for correct parsing.  This effectively "compresses" the stuff - I
lopped 40% off of my css file.  It's at
http://www.peterbe.com/plog/blogitem-040406-1/compressor - I'm sure there's
lots of other sites offering this type of thing.  I just Googled upon this
one first.

Anyhow, does anyone know of a module for Apache that does this to content as
it leaves the server?  It's an interesting alternative, or perhaps additive,
to gzip'ping the content, for browsers that don't support that (which, btw,
does anyone know which versions of IE support compression?)  I'd do it
on-disk instead of live, but my setup consists of PHP programs feeding
Smarty data from themselves and textfiles, so the HTML is too spread out to
make that a convenient and attractive solution.

I'm thinking the overhead of the server doing this might outweigh or hardly
make a dent in the bandwidth savings enough to make this feasible, but it's
a worth a shot.  I might even write the module myself if there isn't already
one and it proves to be worthwhile enough.  What do you guys think?

Thanks,
Joey


---------------------------------------------------------------------
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


Re: [users@httpd] HTML compression module?

Posted by Darin Holloway <jd...@blue.net>.
http://www.chami.com/html-kit/plugins/info/cmcodecrusher/

Is a GPL'ed whitespace compressor written for my html editor of choice 
(HTML-Kit), looks like it is written in its native scripting language 
(HKScript), but look at it as a pseudo code implementation and re-write in 
your language of choice and write a module wrapper around it.

Joey Hewitt wrote:

> Nick Kew <ni...@webthing.com> wrote:
> 
>>On Tue, 29 Jun 2004, Joey Hewitt wrote:
>>
>>
>>>Hi,
>>>
>>>I found a site that lets you paste (X)HTML or CSS into a textarea and
> 
> submit
> 
>>>it to a script that strips out newlines and other stuff that is not
> 
> strictly
> 
>>>necessary for correct parsing.  This effectively "compresses" the
> 
> stuff - I
> 
>>>lopped 40% off of my css file.
>>
>>I guess you have lots of whitespace:-)
> 
> 
> I do. ;)
> 
> 
>>>Anyhow, does anyone know of a module for Apache that does this to
> 
> content as
> 
>>>it leaves the server?
>>
>>Yes, but it's part of something bigger, and not published.
>>
>>
>>>  It's an interesting alternative, or perhaps additive,
>>>to gzip'ping the content, for browsers that don't support that
>>
>>Actually it'll gain a lot less than you'd think, because once you've
>>stripped down the whitespace, the compression you get by gzipping it
>>will be correspondingly less.
>>
> 
> 
> That makes sense.
> 
> 
>>As an alternative - yes, it's a possibility.
>>
>>
>>>I'm thinking the overhead of the server doing this might outweigh or
> 
> hardly
> 
>>>make a dent in the bandwidth savings enough to make this feasible, but
> 
> it's
> 
>>>a worth a shot.
>>
>>Actually the server overhead could be pretty negligible: certainly less
>>than gzipping it.
> 
> 
> Agreed, now that I think about it. ;)
> 
> 
>>>   I might even write the module myself if there isn't already
>>>one and it proves to be worthwhile enough.  What do you guys think?
>>
>>If you take a simplistic approach (and don't mind screwing up <PRE>), the
>>module would be maybe an hours work.  You could perhaps take mod_txt as a
>>startingpoint for manipulation like this.
>>
>>Alternatively, grease my palm and I'll write it for you:-)
>>--
>>Nick Kew
> 
> 
> Actually, unless you're dying to ;) , I think I'll give it a try.  Then I
> can say I have my own code helping serve up my content. ;)
> 
> Anyway, I use whitespace liberally, so my savings may amount to more than
> the average person's, but I still don't think I'll get much.  I don't even
> have a heavy-traffic site or pay by the amount of bandwidth I use, so it's
> not even real important to me, just an interesting idea I want to see work.
> :)
> 
> Cheers,
> Joey
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
Darin Holloway
Systems Administrator and Web Developer
Bluegrass Network, LLC


---------------------------------------------------------------------
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


Re: [users@httpd] HTML compression module?

Posted by Joey Hewitt <jo...@joeyhewitt.com>.
Nick Kew <ni...@webthing.com> wrote:
> On Tue, 29 Jun 2004, Joey Hewitt wrote:
>
> > Hi,
> >
> > I found a site that lets you paste (X)HTML or CSS into a textarea and
submit
> > it to a script that strips out newlines and other stuff that is not
strictly
> > necessary for correct parsing.  This effectively "compresses" the
stuff - I
> > lopped 40% off of my css file.
>
> I guess you have lots of whitespace:-)

I do. ;)

> > Anyhow, does anyone know of a module for Apache that does this to
content as
> > it leaves the server?
>
> Yes, but it's part of something bigger, and not published.
>
> >   It's an interesting alternative, or perhaps additive,
> > to gzip'ping the content, for browsers that don't support that
>
> Actually it'll gain a lot less than you'd think, because once you've
> stripped down the whitespace, the compression you get by gzipping it
> will be correspondingly less.
>

That makes sense.

> As an alternative - yes, it's a possibility.
>
> > I'm thinking the overhead of the server doing this might outweigh or
hardly
> > make a dent in the bandwidth savings enough to make this feasible, but
it's
> > a worth a shot.
>
> Actually the server overhead could be pretty negligible: certainly less
> than gzipping it.

Agreed, now that I think about it. ;)

>
> >    I might even write the module myself if there isn't already
> > one and it proves to be worthwhile enough.  What do you guys think?
>
> If you take a simplistic approach (and don't mind screwing up <PRE>), the
> module would be maybe an hours work.  You could perhaps take mod_txt as a
> startingpoint for manipulation like this.
>
> Alternatively, grease my palm and I'll write it for you:-)
> --
> Nick Kew

Actually, unless you're dying to ;) , I think I'll give it a try.  Then I
can say I have my own code helping serve up my content. ;)

Anyway, I use whitespace liberally, so my savings may amount to more than
the average person's, but I still don't think I'll get much.  I don't even
have a heavy-traffic site or pay by the amount of bandwidth I use, so it's
not even real important to me, just an interesting idea I want to see work.
:)

Cheers,
Joey


---------------------------------------------------------------------
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


Re: [users@httpd] HTML compression module?

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 29 Jun 2004, Joey Hewitt wrote:

> Hi,
>
> I found a site that lets you paste (X)HTML or CSS into a textarea and submit
> it to a script that strips out newlines and other stuff that is not strictly
> necessary for correct parsing.  This effectively "compresses" the stuff - I
> lopped 40% off of my css file.

I guess you have lots of whitespace:-)

> Anyhow, does anyone know of a module for Apache that does this to content as
> it leaves the server?

Yes, but it's part of something bigger, and not published.

>	  It's an interesting alternative, or perhaps additive,
> to gzip'ping the content, for browsers that don't support that

Actually it'll gain a lot less than you'd think, because once you've
stripped down the whitespace, the compression you get by gzipping it
will be correspondingly less.

As an alternative - yes, it's a possibility.

> I'm thinking the overhead of the server doing this might outweigh or hardly
> make a dent in the bandwidth savings enough to make this feasible, but it's
> a worth a shot.

Actually the server overhead could be pretty negligible: certainly less
than gzipping it.

>    I might even write the module myself if there isn't already
> one and it proves to be worthwhile enough.  What do you guys think?

If you take a simplistic approach (and don't mind screwing up <PRE>), the
module would be maybe an hours work.  You could perhaps take mod_txt as a
startingpoint for manipulation like this.

Alternatively, grease my palm and I'll write it for you:-)

-- 
Nick Kew

---------------------------------------------------------------------
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