summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2018-04-20 16:34:15 -0700
committerJonathan Nieder <jrn@google.com>2018-04-23 10:26:51 -0700
commita99bbf162a6e949692a1bc883be888dbeb10ab8d (patch)
tree9e86de269567319732accec3da00f1b1457c7252 /org.eclipse.jgit
parent332bc611249d21f9b604f2c0207bf0bdfbfc3a78 (diff)
downloadjgit-a99bbf162a6e949692a1bc883be888dbeb10ab8d.tar.gz
jgit-a99bbf162a6e949692a1bc883be888dbeb10ab8d.zip
UploadPack: Don't buffer ls-refs output
Once we have read the user's entire command, there is no more need to buffer our response --- even the strictest servlet engine allows writing output once the input has been consumed. Noticed when the analogous code in the "fetch" command (introduced in a later patch) overflowed its buffer: java.lang.OutOfMemoryError at java.io.ByteArrayOutputStream.hugeCapacity(ByteArrayOutputStream.java:123) [...] at org.eclipse.jgit.transport.UploadPack.sendPack(UploadPack.java:1905) at org.eclipse.jgit.transport.UploadPack.sendPack(UploadPack.java:1741) at org.eclipse.jgit.transport.UploadPack.fetchV2(UploadPack.java:1001) at org.eclipse.jgit.transport.UploadPack.serviceV2(UploadPack.java:1030) at org.eclipse.jgit.transport.UploadPack.upload(UploadPack.java:726) at org.eclipse.jgit.http.server.UploadPackServlet.doPost(UploadPackServlet.java:195) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) Change-Id: I33df56f1cb1c6c2c25ee95426cb7ad665134ac6b
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index b2b346a6b3..07023286e9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -890,6 +890,7 @@ public class UploadPack {
} else if (line != PacketLineIn.END) {
throw new PackProtocolException("unexpected " + line);
}
+ rawOut.stopBuffering();
adv.send(refs);
adv.end();