* [JGIT PATCH] Make UploadPack capability parsing more liberal
@ 2009-06-16 18:59 Shawn O. Pearce
0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2009-06-16 18:59 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
Prior to 220a6626c86b ("Fix BaseFetchPackConnection's output of
selected capabilities") the JGit pack client produced a capability
request header that JGit itself can't parse, but C Git can.
The parsing error was caused by a missing space after the want'd
SHA-1 and before the first capability name.
Even though JGit's pack client has been fixed in more recent
versions, we should still fix the server to be more libral in
what it accepts from clients, so that older JGit client builds
can still interoperate.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../src/org/spearce/jgit/transport/UploadPack.java | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
index fcc1ef7..159bd10 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
@@ -302,13 +302,13 @@ private void recvWants() throws IOException {
if (!line.startsWith("want ") || line.length() < 45)
throw new PackProtocolException("expected want; got " + line);
- if (isFirst) {
- final int sp = line.indexOf(' ', 45);
- if (sp >= 0) {
- for (String c : line.substring(sp + 1).split(" "))
- options.add(c);
- line = line.substring(0, sp);
- }
+ if (isFirst && line.length() > 45) {
+ String opt = line.substring(45);
+ if (opt.startsWith(" "))
+ opt = opt.substring(1);
+ for (String c : opt.split(" "))
+ options.add(c);
+ line = line.substring(0, 45);
}
final ObjectId id = ObjectId.fromString(line.substring(5));
--
1.6.3.2.406.gd6a466
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-16 18:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-16 18:59 [JGIT PATCH] Make UploadPack capability parsing more liberal Shawn O. Pearce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).