Patchwork [07,of,11] protocol: declare transport protocol support for compression

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 20, 2016, 10:23 p.m.
Message ID <a550b00e82d531756e73.1479680624@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17658/
State Accepted
Headers show

Comments

Gregory Szorc - Nov. 20, 2016, 10:23 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1479679308 28800
#      Sun Nov 20 14:01:48 2016 -0800
# Node ID a550b00e82d531756e73869055123fa6682effe0
# Parent  952478a50f2583be4400c0f6fcc156d73d46711c
protocol: declare transport protocol support for compression

We add an attribute to the HTTP and SSH protocol implementations
indicating whether they support compression. This attribute will
be used in a later patch to conditionally advertise a server
capability.

(We won't advertise the capability on the SSH transport because the
SSH transport doesn't support compressible responses.)

Patch

diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -30,6 +30,8 @@  class webproto(wireproto.abstractserverp
         self.req = req
         self.response = ''
         self.ui = ui
+        self.supportscompression = True
+
     def getargs(self, args):
         knownargs = self._args()
         data = {}
diff --git a/mercurial/sshserver.py b/mercurial/sshserver.py
--- a/mercurial/sshserver.py
+++ b/mercurial/sshserver.py
@@ -26,6 +26,7 @@  class sshserver(wireproto.abstractserver
         self.lock = None
         self.fin = ui.fin
         self.fout = ui.fout
+        self.supportscompression = False
 
         hook.redirect(True)
         ui.fout = repo.ui.fout = ui.ferr