瀏覽代碼

Allow UploadPack requests with no options

UploadPack can be invoked with no capabilities selected by the
client if the client is an ancient version of Git that nobody in
their right mind should still be using. Or if the client is very
broken and does not want to use any of the newer features added to
the protocol since its inception.

Change-Id: I3baa6f90e6a41a37a8eab8449a3cc41f4efcb91a
tags/v3.1.0.201309270735-rc1
Shawn Pearce 10 年之前
父節點
當前提交
15adcefb73
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7
    4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

+ 7
- 4
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java 查看文件

@@ -868,10 +868,13 @@ public class UploadPack {
if (!line.startsWith("want ") || line.length() < 45) //$NON-NLS-1$
throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); //$NON-NLS-1$

if (isFirst && line.length() > 45) {
final FirstLine firstLine = new FirstLine(line);
options = firstLine.getOptions();
line = firstLine.getLine();
if (isFirst) {
if (line.length() > 45) {
FirstLine firstLine = new FirstLine(line);
options = firstLine.getOptions();
line = firstLine.getLine();
} else
options = Collections.emptySet();
}

wantIds.add(ObjectId.fromString(line.substring(5)));

Loading…
取消
儲存