Patchwork httppeer: make sure we limit argument for older server not supporting batch

login
register
mail settings
Submitter Pierre-Yves David
Date April 23, 2019, 10:37 p.m.
Message ID <26f277f0f415206036a5.1556059050@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39810/
State Accepted
Headers show

Comments

Pierre-Yves David - April 23, 2019, 10:37 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1556049342 -7200
#      Tue Apr 23 21:55:42 2019 +0200
# Node ID 26f277f0f415206036a57f17400284107816f00d
# Parent  84bd6ae2d1f656dff1d494a03558c4edb58ebd31
# EXP-Topic discovery-followup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 26f277f0f415
httppeer: make sure we limit argument for older server not supporting batch

Most commands will still have some argument restriction when using 'GET' method
instead of batching through POST.
Gregory Szorc - April 25, 2019, 2:19 a.m.
On Wed, Apr 24, 2019 at 12:29 AM Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1556049342 -7200
> #      Tue Apr 23 21:55:42 2019 +0200
> # Node ID 26f277f0f415206036a57f17400284107816f00d
> # Parent  84bd6ae2d1f656dff1d494a03558c4edb58ebd31
> # EXP-Topic discovery-followup
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 26f277f0f415
> httppeer: make sure we limit argument for older server not supporting batch
>

Queued.


>
> Most commands will still have some argument restriction when using 'GET'
> method
> instead of batching through POST.
>
> diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
> --- a/mercurial/httppeer.py
> +++ b/mercurial/httppeer.py
> @@ -382,7 +382,9 @@ class httppeer(wireprotov1peer.wirepeer)
>          self._path = path
>          self._url = url
>          self._caps = caps
> -        self.limitedarguments = caps is not None and 'httppostargs' not
> in caps
> +        self.limitedarguments = False
> +        if caps is None or 'batch' not in caps or 'httppostargs' not in
> caps:
> +            self.limitedarguments = True
>          self._urlopener = opener
>          self._requestbuilder = requestbuilder
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
via Mercurial-devel - April 25, 2019, 4:03 a.m.
On Wed, Apr 24, 2019 at 7:25 PM Gregory Szorc <gregory.szorc@gmail.com>
wrote:

> On Wed, Apr 24, 2019 at 12:29 AM Pierre-Yves David <
> pierre-yves.david@ens-lyon.org> wrote:
>
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>> # Date 1556049342 -7200
>> #      Tue Apr 23 21:55:42 2019 +0200
>> # Node ID 26f277f0f415206036a57f17400284107816f00d
>> # Parent  84bd6ae2d1f656dff1d494a03558c4edb58ebd31
>> # EXP-Topic discovery-followup
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
>> 26f277f0f415
>> httppeer: make sure we limit argument for older server not supporting
>> batch
>>
>
I believe this patch was in response to a question from me. I was asking if
'httppostargs' automatically upgraded the HTTP method from GET to POST and
I thought it did not and that we relied on the use of the 'batch' request
for that (which always used POST, I think). Joerg then replied that
'httppostargs' does upgrade from GET to POST, so I think this patch is not
needed. Do you (both Greg and Pierre-Yves) agree?


> Queued.
>
>
>>
>> Most commands will still have some argument restriction when using 'GET'
>> method
>> instead of batching through POST.
>>
>> diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
>> --- a/mercurial/httppeer.py
>> +++ b/mercurial/httppeer.py
>> @@ -382,7 +382,9 @@ class httppeer(wireprotov1peer.wirepeer)
>>          self._path = path
>>          self._url = url
>>          self._caps = caps
>> -        self.limitedarguments = caps is not None and 'httppostargs' not
>> in caps
>> +        self.limitedarguments = False
>> +        if caps is None or 'batch' not in caps or 'httppostargs' not in
>> caps:
>> +            self.limitedarguments = True
>>          self._urlopener = opener
>>          self._requestbuilder = requestbuilder
>>
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Pierre-Yves David - April 25, 2019, 7:58 a.m.
On 4/25/19 6:03 AM, Martin von Zweigbergk wrote:
> 
> 
> On Wed, Apr 24, 2019 at 7:25 PM Gregory Szorc <gregory.szorc@gmail.com 
> <mailto:gregory.szorc@gmail.com>> wrote:
> 
>     On Wed, Apr 24, 2019 at 12:29 AM Pierre-Yves David
>     <pierre-yves.david@ens-lyon.org
>     <mailto:pierre-yves.david@ens-lyon.org>> wrote:
> 
>         # HG changeset patch
>         # User Pierre-Yves David <pierre-yves.david@octobus.net
>         <mailto:pierre-yves.david@octobus.net>>
>         # Date 1556049342 -7200
>         #      Tue Apr 23 21:55:42 2019 +0200
>         # Node ID 26f277f0f415206036a57f17400284107816f00d
>         # Parent  84bd6ae2d1f656dff1d494a03558c4edb58ebd31
>         # EXP-Topic discovery-followup
>         # Available At https://bitbucket.org/octobus/mercurial-devel/
>         #              hg pull
>         https://bitbucket.org/octobus/mercurial-devel/ -r 26f277f0f415
>         httppeer: make sure we limit argument for older server not
>         supporting batch
> 
> 
> I believe this patch was in response to a question from me. I was asking 
> if 'httppostargs' automatically upgraded the HTTP method from GET to 
> POST and I thought it did not and that we relied on the use of the 
> 'batch' request for that (which always used POST, I think). Joerg then 
> replied that 'httppostargs' does upgrade from GET to POST, so I think 
> this patch is not needed. Do you (both Greg and Pierre-Yves) agree?

Yes, I agree, it can be dropped, I sent it before I saw Joerg and Martin 
reply.

> 
> 
>     Queued.
> 
> 
>         Most commands will still have some argument restriction when
>         using 'GET' method
>         instead of batching through POST.
> 
>         diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
>         --- a/mercurial/httppeer.py
>         +++ b/mercurial/httppeer.py
>         @@ -382,7 +382,9 @@ class httppeer(wireprotov1peer.wirepeer)
>                   self._path = path
>                   self._url = url
>                   self._caps = caps
>         -        self.limitedarguments = caps is not None and
>         'httppostargs' not in caps
>         +        self.limitedarguments = False
>         +        if caps is None or 'batch' not in caps or
>         'httppostargs' not in caps:
>         +            self.limitedarguments = True
>                   self._urlopener = opener
>                   self._requestbuilder = requestbuilder
> 
>         _______________________________________________
>         Mercurial-devel mailing list
>         Mercurial-devel@mercurial-scm.org
>         <mailto:Mercurial-devel@mercurial-scm.org>
>         https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> 
>     _______________________________________________
>     Mercurial-devel mailing list
>     Mercurial-devel@mercurial-scm.org
>     <mailto:Mercurial-devel@mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
via Mercurial-devel - April 25, 2019, 4:57 p.m.
On Thu, Apr 25, 2019 at 12:58 AM Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

>
>
> On 4/25/19 6:03 AM, Martin von Zweigbergk wrote:
> >
> >
> > On Wed, Apr 24, 2019 at 7:25 PM Gregory Szorc <gregory.szorc@gmail.com
> > <mailto:gregory.szorc@gmail.com>> wrote:
> >
> >     On Wed, Apr 24, 2019 at 12:29 AM Pierre-Yves David
> >     <pierre-yves.david@ens-lyon.org
> >     <mailto:pierre-yves.david@ens-lyon.org>> wrote:
> >
> >         # HG changeset patch
> >         # User Pierre-Yves David <pierre-yves.david@octobus.net
> >         <mailto:pierre-yves.david@octobus.net>>
> >         # Date 1556049342 -7200
> >         #      Tue Apr 23 21:55:42 2019 +0200
> >         # Node ID 26f277f0f415206036a57f17400284107816f00d
> >         # Parent  84bd6ae2d1f656dff1d494a03558c4edb58ebd31
> >         # EXP-Topic discovery-followup
> >         # Available At https://bitbucket.org/octobus/mercurial-devel/
> >         #              hg pull
> >         https://bitbucket.org/octobus/mercurial-devel/ -r 26f277f0f415
> >         httppeer: make sure we limit argument for older server not
> >         supporting batch
> >
> >
> > I believe this patch was in response to a question from me. I was asking
> > if 'httppostargs' automatically upgraded the HTTP method from GET to
> > POST and I thought it did not and that we relied on the use of the
> > 'batch' request for that (which always used POST, I think). Joerg then
> > replied that 'httppostargs' does upgrade from GET to POST, so I think
> > this patch is not needed. Do you (both Greg and Pierre-Yves) agree?
>
> Yes, I agree, it can be dropped, I sent it before I saw Joerg and Martin
> reply.
>

Dropped.

Patch

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -382,7 +382,9 @@  class httppeer(wireprotov1peer.wirepeer)
         self._path = path
         self._url = url
         self._caps = caps
-        self.limitedarguments = caps is not None and 'httppostargs' not in caps
+        self.limitedarguments = False
+        if caps is None or 'batch' not in caps or 'httppostargs' not in caps:
+            self.limitedarguments = True
         self._urlopener = opener
         self._requestbuilder = requestbuilder