From 93097f001854af47db782462e78d67e7171043a4 Mon Sep 17 00:00:00 2001 From: Josh Brown Date: Tue, 11 Oct 2022 14:56:09 -0700 Subject: ReceivePack: Receive and parse client session-id. Before this change JGit did not support the session-id capability implemented by native Git. This change implements advertising the capability from the server and parsing the session-id received from the client during a ReceivePack operation. Enable the transfer.advertisesid config setting to advertise the capability from the server. The client may send a session-id capability in response. If received, the value from this is parsed and available via the getClientSID method on the ReceivePack object. All capabilities in the form `capability=value` are now split into key value pairs at the first `=` character. This change replaces specific handling for the agent capability. This change does not add advertisement or parsing to UploadPack. This change also does not add the ability to send a session ID from the JGit client. https://git-scm.com/docs/protocol-v2/2.33.0#_session_idsession_id Change-Id: I56fb115e843b11b27e128c4ac427b05d5ec129d0 Signed-off-by: Josh Brown --- .../src/org/eclipse/jgit/http/server/GitSmartHttpTools.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'org.eclipse.jgit.http.server/src/org') 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 f1155dcf57..078b22a700 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 @@ -226,7 +226,8 @@ public class GitSmartHttpTools { // So, cheat and read the first line. String line = new PacketLineIn(req.getInputStream()).readString(); FirstCommand parsed = FirstCommand.fromLine(line); - return parsed.getCapabilities().contains(CAPABILITY_SIDE_BAND_64K); + return parsed.getCapabilities() + .containsKey(CAPABILITY_SIDE_BAND_64K); } catch (IOException e) { // Probably the connection is closed and a subsequent write will fail, but // try it just in case. -- cgit v1.2.3