From c1ed9483ff77487b38587a96a74b6ebb813985da Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 7 Mar 2012 19:51:12 -0800 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/http/server/GitSmartHttpTools.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java index e6b287ff0..ab4d0da34 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java +++ b/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) {