Hi,

So there is a problem with gzip and ESI. If the content is gziped,  
you can't ESI it. If it isn't you waste bandwidth and go slower. Once  
you have the esibits tree up and running, if each individual chunk is  
gziped, you can just blast it away. So here is a proposal.


Add a new action named encode; to be used after esi; .  encode will  
take the current object, clone it and encode it to match your accept- 
encoding, insert it into the objhead and then replace the current  
working object.

VCL example

sub recv {

        

        lookup;
}

sub miss {
        # save away the accept-encoding and make sure
        # we request it uncompressed so we can ESI it
        set req.http.tmp_accept_encoding = req.http.Accept-Encoding;
        set req.http.Accept-Encoding = "";
}

sub fetch {

        # xxx need a nicer way for this?

        esi;

        if(req.http.tmp_accept_encoding ~ /gzip/) {
                #client wants it gziped
                encode("gzip");
                set req.http.Accept-Encoding = "gzip";          
                set obj.http.Content-Encoding = "gzip";
        }
        insert;   # inserts both variants of the object  - in the future  
lookup will get the right version
}


The cloned object basically gets a copy of he store and the esibits,  
and then compresses each individual chunk.

Cheers
Artur
_______________________________________________
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev

Reply via email to