Browse Source

ReceivePack: enable capabilities immediately on first line

Instead of deferring until after command parsing, enable the
capabilities after the first pkt-line has been read from the client.
This allows the server to setup the side-band-64k channel immediately.

Change-Id: I141b7fc92e983a41d3a58da8e1464a6917422b6c
stable-4.5
Shawn Pearce 8 years ago
parent
commit
306932c701
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

8
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

@ -1077,7 +1077,7 @@ public abstract class BaseReceivePack {
*/
protected void recvCommands() throws IOException {
PushCertificateParser certParser = getPushCertificateParser();
FirstLine firstLine = null;
boolean firstPkt = true;
try {
for (;;) {
String line;
@ -1097,10 +1097,12 @@ public abstract class BaseReceivePack {
continue;
}
if (firstLine == null) {
firstLine = new FirstLine(line);
if (firstPkt) {
firstPkt = false;
FirstLine firstLine = new FirstLine(line);
enabledCapabilities = firstLine.getCapabilities();
line = firstLine.getLine();
enableCapabilities();
if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) {
certParser.receiveHeader(pckIn, !isBiDirectionalPipe());

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

@ -184,8 +184,6 @@ public class ReceivePack extends BaseReceivePack {
return;
recvCommands();
if (hasCommands()) {
enableCapabilities();
Throwable unpackError = null;
if (needPack()) {
try {

Loading…
Cancel
Save