Browse Source

Use readString() to trim trailing LF from first line

The fetch-pack/upload-pack stream usually has an LF at the
end of the first "want" line. Trim this when checking to
see if side-band or side-band-64k was used.

Perform the same trim for send-pack/receive-pack, as it is
harmless in this context to ignore an LF just before doing
an error report.

Change-Id: I6ef946bb6124fa72c52bd5320187eaac3ed906e7
stable-2.0
Shawn O. Pearce 13 years ago
parent
commit
c1ed9483ff
  1. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java

@ -245,7 +245,7 @@ public class GitSmartHttpTools {
// capability and are expecting a response in the sideband, but we might
// not have an UploadPack, or it might not have read any of the request.
// So, cheat and read the first line.
String line = new PacketLineIn(req.getInputStream()).readStringRaw();
String line = new PacketLineIn(req.getInputStream()).readString();
UploadPack.FirstLine parsed = new UploadPack.FirstLine(line);
return (parsed.getOptions().contains(OPTION_SIDE_BAND)
|| parsed.getOptions().contains(OPTION_SIDE_BAND_64K));
@ -285,7 +285,7 @@ public class GitSmartHttpTools {
// capability and are expecting a response in the sideband, but we might
// not have a ReceivePack, or it might not have read any of the request.
// So, cheat and read the first line.
String line = new PacketLineIn(req.getInputStream()).readStringRaw();
String line = new PacketLineIn(req.getInputStream()).readString();
ReceivePack.FirstLine parsed = new ReceivePack.FirstLine(line);
return parsed.getCapabilities().contains(CAPABILITY_SIDE_BAND_64K);
} catch (IOException e) {

Loading…
Cancel
Save