[PATCH] hgweb: config option to control zlib compression level

Yuya Nishihara yuya at tcha.org
Mon Aug 15 05:45:49 EDT 2016


On Sun, 14 Aug 2016 14:36:03 -0700, Gregory Szorc wrote:
> On Mon, Aug 8, 2016 at 6:45 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> > On Sun, 07 Aug 2016 18:12:37 -0700, Gregory Szorc wrote:
> > > --- a/mercurial/hgweb/protocol.py
> > > +++ b/mercurial/hgweb/protocol.py
> > > @@ -69,17 +69,17 @@ class webproto(wireproto.abstractserverp
> > >      def redirect(self):
> > >          self.oldio = self.ui.fout, self.ui.ferr
> > >          self.ui.ferr = self.ui.fout = stringio()
> > >      def restore(self):
> > >          val = self.ui.fout.getvalue()
> > >          self.ui.ferr, self.ui.fout = self.oldio
> > >          return val
> > >      def groupchunks(self, cg):
> > > -        z = zlib.compressobj()
> > > +        z = zlib.compressobj(self.ui.configint('server', 'zliblevel',
> > -1))
> >
> > Any idea if untrusted hgrc should be allowed?
>
> I can go both ways on this. However, I'm inclined to say "no" because
> setting the compression level very high or disabling it could make a CPU or
> network usage increase significantly. I think server operators would want
> to retain control over this setting for that reason.

Okay, let's add a comment because hgweb generally reads config with
untrusted=True.


More information about the Mercurial-devel mailing list