Commit Graph

562 Commits

Author SHA1 Message Date
Shawn O. Pearce 14e469c44e Qualify builds as 0.8.0
Since the API is changing relative to 0.7.0, we'll call our next
release 0.8.1.  But until that gets released, builds from master
will be 0.8.0.qualifier.

Change-Id: I921e984f51ce498610c09e0db21be72a533fee88
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-03-20 19:06:58 -07:00
Shawn O. Pearce c0f093899f 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>
2010-03-12 16:08:14 -08:00
Shawn O. Pearce d8c3e98d73 Use "ERR message" for early ReceivePack problems
If the application wants to, it can use sendError(String) to send one
or more error messages to clients before the advertisements are sent.
These will cause a C Git client to break out of the advertisement
parsing loop, display "remote error: message\n", and terminate.

Servers can optionally use this to send a detailed error to a client
explaining why it cannot use the ReceivePack service on a repository.
Over smart HTTP these errors are sent in a 200 OK response, and
are in the payload, allowing the Git client to give the end-user
the custom message rather than the generic error "403 Forbidden".

Change-Id: I03f4345183765d21002118617174c77f71427b5a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-03-12 16:08:14 -08:00
Shawn O. Pearce 673b3984bd Capture non-progress side band #2 messages and put in result
Any messages received on side band #2 that aren't scraped as a
progress message into our ProgressMonitor are now forwarded to a
buffer which is later included into the OperationResult object.
Application callers can use this buffer to present the additional
messages from the remote peer after the push or fetch operation
has concluded.

The smart push connections using the native send-pack/receive-pack
protocol now request side-band-64k capability if it is available
and forward any messages received through that channel onto this
message buffer.  This makes hook messages available over smart HTTP,
or even over SSH.

The SSH transport was modified to redirect the remote command's
stderr stream into the message buffer, interleaved with any data
received over side band #2.  Due to buffering between these two
different channels in the SSH channel mux itself the order of any
writes between the two cannot be ensured, but it tries to stay close.

The local fork transport was also modified to redirect the local
receive-pack's stderr into the message buffer, rather than going to
the invoking JVM's System.err.  This gives applications a chance
to log the local error messages, rather than needing to redirect
their JVM's stderr before startup.

To keep things simple, the application has to wait for the entire
operation to complete before it can see the messages.  This may
be a downside if the user is trying to debug a remote hook that is
blocking indefinitely, the user would need to abort the connection
before they can inspect the message buffer in any sort of UI built
on top of JGit.

Change-Id: Ibc215f4569e63071da5b7e5c6674ce924ae39e11
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-03-12 16:08:13 -08:00
Shawn O. Pearce 3dd067042f http.test: Use JUnit 3 test runner
JGit relies on JUnit 3, not JUnit 4.

Change-Id: Ic5a0ae1564d7744c203321857fc603e7008dbf13
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-02-09 19:51:36 -08:00
Shawn O. Pearce 1ca22467f5 http.test: Add missing plugin.properties to build
Change-Id: I17e2c22498092d25dace88319698626ce55df822
2010-02-09 19:28:28 -08:00
Shawn O. Pearce d207c69ff4 http.test: Use JGit Format and compiler settings
Somehow we missed setting this up for the project.

Change-Id: Id55a6415f5fd03a7cd9d4d4ecbdd726cef79430d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-02-09 19:28:28 -08:00
Shawn O. Pearce 179a9ba4a2 Cleanup OSGi Import-Package specifications to use versions
Actually set the range of versions we are willing to accept for
each package we import, lest we import something in the future
that isn't compatible with our needs.

Change-Id: I25dbbb9eaabe852631b677e0c608792b3ed97532
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-02-02 20:03:03 -08:00
Shawn O. Pearce f2d5187ea1 Fix racy HTTP tests by waiting for requests to finish
Ensure the background Jetty threads have been able to write the
request log record before the JUnit thread tries to read the set
of requests back.  This wait is necessary because the JUnit thread
may be able to continue as soon as Jetty has finished writing
the response onto the socket, and hasn't necessarily finished the
post-response logging activity.

By using a semaphore with a fixed number of resources, and using
one resource per request, but all of them when we want to read the
log, we implement a simple lock that requires there be no active
requests when we want to get the log from the JUnit thread.

Change-Id: I499e1c96418557185d0e19ba8befe892f26ce7e4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-25 14:51:56 -08:00
Shawn O. Pearce 0238a21b62 Correct bundle, provider names to be consistent
Technically our project name is "JGit", not "Java Git".  In fact
there is already another project called "JavaGit" (no space) that we
don't want to become confused with.  Ensure we always call ourselves
"JGit" in user visible assets, like the bundle name.

Other Eclipse products list their provider as "Eclipse.org",
not "eclipse.org".  So list ourselves that way in all of our
plugin.properties files.

Change-Id: Ibcea1cd6dda2af757a8584099619fc23b7779a84
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 11:42:15 -08:00
Robin Rosenberg 56f6d9ebc3 Make HTTP test project work in Eclipse
The Jetty components are not available as part of Eclipse, but a
P2 packaged version can be found via [1] for Eclipse 3.5 and newer.

[1] http://wiki.eclipse.org/Jetty-OSGi_SDK

Change-Id: Ibd5930bb9fc9589125876ca50c52e58bd31b051c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 11:29:25 -08:00
Shawn O. Pearce f5eb0d9366 Add JUnit tests for HTTP transport
No Eclipse support for this project is provided, because the
Jetty project does not publish a complete P2 repository.

Change-Id: Ic5fe2e79bb216e36920fd4a70ec15dd6ccfd1468
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-12 12:30:42 -08:00