Patchwork [7,of,9,remotefilelog-ext,getfile-http] fileserverclient: refuse to operate on a non-sshpeer

login
register
mail settings
Submitter Augie Fackler
Date July 1, 2015, 8:05 p.m.
Message ID <d95d09694be01c842337.1435781144@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/9858/
State Not Applicable
Headers show

Comments

Augie Fackler - July 1, 2015, 8:05 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1435609544 14400
#      Mon Jun 29 16:25:44 2015 -0400
# Node ID d95d09694be01c8423372350ac9bffa876383e0e
# Parent  5e58703e43ff3ce67f212de4c4cbc4231b0cf526
fileserverclient: refuse to operate on a non-sshpeer

The way the protocol is defined for getfiles interleaves reading
filenames and sending file contents, which works fine over ssh but is
incompatible with http.

This change is probably not neccessary now that remotefilelog
correctly checks for its own capability first, but it helped me debug
so I left it in for completeness.

Patch

diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py
--- a/remotefilelog/fileserverclient.py
+++ b/remotefilelog/fileserverclient.py
@@ -177,6 +177,8 @@  class fileserverclient(object):
                     if not remote.capable("remotefilelog"):
                         raise util.Abort("configured remotefilelog server"
                                          " does not support remotefilelog")
+                    if not isinstance(remote, sshpeer.sshpeer):
+                        raise util.Abort('remotefilelog requires ssh servers')
                     remote._callstream("getfiles")
                 finally:
                     self.ui.verbose = verbose