Browse Source

Strip pkt-line when negotiating Git protocol v2

This makes it so both "version 2" and "version 2\n" (and any
alternatives with more whitespace) are accepted as a successful v2
response.

Fixes #1423
Rémy Pecqueur 4 tháng trước cách đây
mục cha
commit
4cb28d178c
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      dulwich/client.py

+ 1 - 1
dulwich/client.py

@@ -260,7 +260,7 @@ class ReportStatusParser:
 
 def negotiate_protocol_version(proto):
     pkt = proto.read_pkt_line()
-    if pkt == b"version 2\n":
+    if pkt is not None and pkt.strip() == b"version 2":
         return 2
     proto.unread_pkt_line(pkt)
     return 0