Patchwork [2,of,2] hgewb: disable progress when serving (issue4582)

login
register
mail settings
Submitter Pierre-Yves David
Date June 8, 2015, 3:08 a.m.
Message ID <1b7e8e1e3b91b073b670.1433732887@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9551/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Pierre-Yves David - June 8, 2015, 3:08 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1433722457 25200
#      Sun Jun 07 17:14:17 2015 -0700
# Node ID 1b7e8e1e3b91b073b670bf3dba9013e9b8cd9a95
# Parent  567035f46c6e91ef9420739bb7f21b7e3b9a6d10
hgewb: disable progress when serving (issue4582)

Before this patch, progress bar could be displayed when serving, creating
hypothetical problems.
Augie Fackler - June 8, 2015, 2:38 p.m.
On Sun, Jun 07, 2015 at 08:08:07PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1433722457 25200
> #      Sun Jun 07 17:14:17 2015 -0700
> # Node ID 1b7e8e1e3b91b073b670bf3dba9013e9b8cd9a95
> # Parent  567035f46c6e91ef9420739bb7f21b7e3b9a6d10
> hgewb: disable progress when serving (issue4582)

How did you verify this fix? When I was trying very very similar
things, I was unable to convince myself I'd fixed the bug because I
couldn't reproduce the bug.

>
> Before this patch, progress bar could be displayed when serving, creating
> hypothetical problems.
>
> diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py
> +++ b/mercurial/hgweb/hgweb_mod.py
> @@ -67,10 +67,14 @@ class hgweb(object):
>          r = self._getview(r)
>          r.ui.setconfig('ui', 'report_untrusted', 'off', 'hgweb')
>          r.baseui.setconfig('ui', 'report_untrusted', 'off', 'hgweb')
>          r.ui.setconfig('ui', 'nontty', 'true', 'hgweb')
>          r.baseui.setconfig('ui', 'nontty', 'true', 'hgweb')
> +        # displaying bundling progress bar while serving feel wrong and may
> +        # break some wsgi implementation.
> +        r.ui.setconfig('progress', 'disable', 'true', 'hgweb')
> +        r.baseui.setconfig('progress', 'disable', 'true', 'hgweb')
>          self.repo = r
>          hook.redirect(True)
>          self.repostate = ((-1, -1), (-1, -1))
>          self.mtime = -1
>          self.reponame = name
> diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
> --- a/mercurial/hgweb/hgwebdir_mod.py
> +++ b/mercurial/hgweb/hgwebdir_mod.py
> @@ -96,10 +96,13 @@ class hgwebdir(object):
>              u = self.baseui.copy()
>          else:
>              u = ui.ui()
>              u.setconfig('ui', 'report_untrusted', 'off', 'hgwebdir')
>              u.setconfig('ui', 'nontty', 'true', 'hgwebdir')
> +            # displaying bundling progress bar while serving feel wrong and may
> +            # break some wsgi implementation.
> +            u.setconfig('progress', 'disable', 'true', 'hgweb')
>
>          if not isinstance(self.conf, (dict, list, tuple)):
>              map = {'paths': 'hgweb-paths'}
>              if not os.path.exists(self.conf):
>                  raise util.Abort(_('config file %s not found!') % self.conf)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -67,10 +67,14 @@  class hgweb(object):
         r = self._getview(r)
         r.ui.setconfig('ui', 'report_untrusted', 'off', 'hgweb')
         r.baseui.setconfig('ui', 'report_untrusted', 'off', 'hgweb')
         r.ui.setconfig('ui', 'nontty', 'true', 'hgweb')
         r.baseui.setconfig('ui', 'nontty', 'true', 'hgweb')
+        # displaying bundling progress bar while serving feel wrong and may
+        # break some wsgi implementation.
+        r.ui.setconfig('progress', 'disable', 'true', 'hgweb')
+        r.baseui.setconfig('progress', 'disable', 'true', 'hgweb')
         self.repo = r
         hook.redirect(True)
         self.repostate = ((-1, -1), (-1, -1))
         self.mtime = -1
         self.reponame = name
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -96,10 +96,13 @@  class hgwebdir(object):
             u = self.baseui.copy()
         else:
             u = ui.ui()
             u.setconfig('ui', 'report_untrusted', 'off', 'hgwebdir')
             u.setconfig('ui', 'nontty', 'true', 'hgwebdir')
+            # displaying bundling progress bar while serving feel wrong and may
+            # break some wsgi implementation.
+            u.setconfig('progress', 'disable', 'true', 'hgweb')
 
         if not isinstance(self.conf, (dict, list, tuple)):
             map = {'paths': 'hgweb-paths'}
             if not os.path.exists(self.conf):
                 raise util.Abort(_('config file %s not found!') % self.conf)