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
This commit is contained in:
Shawn Pearce 2013-08-07 15:43:58 -07:00
parent ef7512b596
commit 15adcefb73
1 changed files with 7 additions and 4 deletions

View File

@ -868,10 +868,13 @@ private void recvWants() throws IOException {
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)));