浏览代码

Ignore agent= capability if sent by client.

Jelmer Vernooij 4 年之前
父节点
当前提交
44704556c2
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 3 0
      NEWS
  2. 3 0
      dulwich/server.py

+ 3 - 0
NEWS

@@ -5,6 +5,9 @@
  * Only return files from the loose store that look like git objects.
  * Only return files from the loose store that look like git objects.
    (Nicolas Dandrimont)
    (Nicolas Dandrimont)
 
 
+ * Ignore agent= capability if sent by client.
+   (Jelmer Vernooij)
+
 0.19.17	UNRELEASED
 0.19.17	UNRELEASED
 
 
  * Don't break when encountering block devices.
  * Don't break when encountering block devices.

+ 3 - 0
dulwich/server.py

@@ -73,6 +73,7 @@ from dulwich.protocol import (  # noqa: F401
     BufferedPktLineWriter,
     BufferedPktLineWriter,
     capability_agent,
     capability_agent,
     CAPABILITIES_REF,
     CAPABILITIES_REF,
+    CAPABILITY_AGENT,
     CAPABILITY_DELETE_REFS,
     CAPABILITY_DELETE_REFS,
     CAPABILITY_INCLUDE_TAG,
     CAPABILITY_INCLUDE_TAG,
     CAPABILITY_MULTI_ACK_DETAILED,
     CAPABILITY_MULTI_ACK_DETAILED,
@@ -258,6 +259,8 @@ class PackHandler(Handler):
         allowable_caps = set(self.innocuous_capabilities())
         allowable_caps = set(self.innocuous_capabilities())
         allowable_caps.update(self.capabilities())
         allowable_caps.update(self.capabilities())
         for cap in caps:
         for cap in caps:
+            if cap.startswith(CAPABILITY_AGENT + b'='):
+                continue
             if cap not in allowable_caps:
             if cap not in allowable_caps:
                 raise GitProtocolError('Client asked for capability %s that '
                 raise GitProtocolError('Client asked for capability %s that '
                                        'was not advertised.' % cap)
                                        'was not advertised.' % cap)