summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.test
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-02-11 18:53:22 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-03-12 16:08:14 -0800
commitc0f093899f8c027fb4e0f4418ac19b0f8ad6be16 (patch)
treec59d951f2e05cfb4c66a102b2d3312bf632d0c35 /org.eclipse.jgit.http.test
parent2156aa894cefbabd322fc405138c306bb4e939cd (diff)
downloadjgit-c0f093899f8c027fb4e0f4418ac19b0f8ad6be16.tar.gz
jgit-c0f093899f8c027fb4e0f4418ac19b0f8ad6be16.zip
http.server: Use TemporaryBuffer and compress some responses
The HTTP server side code now uses the same approach that the smart HTTP client code uses when preparing a request body. The payload is streamed into a TemporaryBuffer of limited size. If the entire data fits, its compressed with gzip if the user agent supports that, and a Content-Length header is used to transmit the fixed length body to the peer. If however the data overflows the limited memory segment, its streamed uncompressed to the peer. One might initially think that larger contents which overflow the buffer should also be compressed, rather than sent raw, since they were deemed "large". But usually these larger contents are actually a pack file which has been already heavily compressed by Git specific routines. Trying to deflate that with gzip is probably going to take up more space, not less, so the compression overhead isn't worthwhile. This buffer and compress optimization helps repositories with a large number of references, as their text based advertisements compress well. For example jgit's own native repository currently requires 32,628 bytes for its full advertisement of 489 references. Most repositories have fewer references, and thus could compress their entire response in one buffer. Change-Id: I790609c9f763339e0a1db9172aa570e29af96f42 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.http.test')
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index fd78bb4515..f7b3bdb203 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010, Google Inc.
+ * Copyright (C) 2010, Google Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -253,8 +253,6 @@ public class SmartClientSmartServerTest extends HttpTestCase {
assertEquals(200, service.getStatus());
assertEquals("application/x-git-upload-pack-result", service
.getResponseHeader(HDR_CONTENT_TYPE));
- assertNull("no compression (never compressed)", service
- .getResponseHeader(HDR_CONTENT_ENCODING));
}
public void testFetchUpdateExisting() throws Exception {