summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit.http/src
Commit message (Collapse)AuthorAgeFilesLines
* [tests] Stabilize the HTTP server's request logThomas Wolf2022-07-312-12/+18
| | | | | | | | | | | | | | | | | | | | | | | The TestRequestLog added log entries only after a request had been handled. But the response is already sent at that point, so the following sequence was possible: client sends request A server thread T1 handles request A and sends back response client receives response client sends request B server thread T2 handles request B (and sends back response) server thread T2 logs B server thread T1 logs A Fix this by logging events before handling a request, and then filling in the response data after the request has been handled. This should avoid such inversions, at least for tests using a single single-threaded client. With multiple concurrent or multi-threaded clients, all bets about the log order would be off anyway. Bug: 528187 Change-Id: I99a46df17231fa7c4f75a8c37e2c14dc098c4e22 Signed-off-by: Thomas Wolf <twolf@apache.org>
* [test] Fix closing of test repositoriesNail Samatov2022-01-301-1/+4
| | | | | | | | | | | | | | | | Fix tests failing on Windows because Repository instance is created but not closed on tear down. Fix repositories closed twice, except in tests that test this behavior explicitly. Name the temporary directories the tests run in after the test method; that makes it easier to figure out in which tests repositories are closed twice if it should occur again in the future. Bug: 550111 Change-Id: I9398b58f0f36d2c29236d2a9a8599117d9083980 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [errorprone] Fix InfiniteRecursion error in RecordingLoggerMatthias Sohn2022-01-181-1/+5
| | | | Change-Id: I092389e428232a4fe7613d846c288d285ae9102c
* Implement RecordingLogger based on org.slf4j.LoggerMatthias Sohn2021-11-241-103/+95
| | | | | | | Jetty 10 uses slf4j for logging and deprecated its own Logger interface org.eclipse.jetty.util.log.Logger. Change-Id: I1b0c3a23e43190a50987175973725c3ad6e32f5f
* AppServer: fix keystore used to setup test SSL context factoryMatthias Sohn2021-11-241-2/+5
| | | | | | | | | | | | | - configure dName - add SANs ip:127.0.0.1, ip:[::1] See jetty's own test setup in https://github.com/eclipse/jetty.project/blob/1cd15e8d85feb308527c3df560734fc2ca1bc13c/jetty-client/src/test/resources/readme_keystores.txt#L6 and the fixes done in https://github.com/eclipse/jetty.project/commit/1cd15e8d85feb308527c3df560734fc2ca1bc13c Change-Id: Ie3260db7a7090dfa92b43eb32bf247640ebf8482
* Update Jetty to 10.0.6Matthias Sohn2021-11-221-18/+26
| | | | | | | | | | | | | - this is the same version eclipse platform currently uses - update servlet-api to 4.0 - configure keystore used by AppServer with Subject Alternative Names for host name and ip address to satisfy more strict SNI checking in Jetty 10. See https://github.com/eclipse/jetty.project/issues/5379 - add jetty bundles to JGit-dependency-bundles in the jgit p2 repository Bug: 571932 Bug: 576100 Change-Id: Ibd0240cf7ad4dc201947fd69707f517c3c1fc1c8
* Remove redundant type argumentsThomas Wolf2021-09-301-1/+2
| | | | | | | | In Java 11 type arguments for anonymous subclasses can be inferred and don't need to be specified. This resolves a number of compiler warnings. Change-Id: I55eff3babb7628aa0627085e65a1b45eb12c2cd3 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [test] Create keystore with the keytool of the running JDKThomas Wolf2021-07-251-1/+4
| | | | | | | | Call keytool with the absolute path of "java.home". Otherwise a keytool for a different, maybe even newer Java version might be picked up, and then the keystore may not be readable by the JVM used to run the tests. Change-Id: Iea77024947a34267f008847d81312fe0abadc615 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Use Map interface instead of ConcurrentHashMap classThomas Wolf2021-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android, the co-variant override of ConcurrentHashMap.keySet() introduced in Java 8 was undone. [1] If compiled Java code calls that co-variant override directly, one gets a NoSuchMethodError exception at run-time on Android. Making the code call that method via Map.keySet() side-steps this problem. This is similar to bug 496262, where the same problem cropped up when compiling with Java 8 against a Java 7 target, but here we cannot use bootclasspath. We build against Java 8, not against the Android version of it. Recent Android versions should have some bytecode "magic" that adds the co-variant override in bytecode (see the commit referenced in [1]), but on older Android version this problem may still occur. (Or perhaps the "magic" is ineffective...) There are two pull requests on Github for this problem, both from 2020, [2][3] while the Android commit [1] is from March 2018. Apparently people still occasionally run into this problem in the wild. [1] https://android.googlesource.com/platform/libcore/+/0e8b937ded4de39f1d1cea5f04800d67dd2ec570/ojluni/src/main/java/java/util/concurrent/ConcurrentHashMap.java#1244 [2] https://github.com/eclipse/jgit/pull/104 [3] https://github.com/eclipse/jgit/pull/100 Change-Id: I7c07e0cc59871cb7fe60795e22867827fa9c2458 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-047-266/+35
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* AppServer: Stop using deprecated SslContextFactory constructorDavid Pursehouse2019-10-171-1/+1
| | | | | | | | Use SslContextFactory.Client instead, as suggested in the deprecation javadoc. Change-Id: I746c953d3ad549c23d0e43eb4a18fc587e924f93 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix "Statement unnecessarily nested within else clause" warningsDavid Pursehouse2019-10-171-3/+3
| | | | | | | | | | | | | | | Since [1] the gerrit project includes jgit as a submodule, and has this warning enabled, resulting in 100s of warnings in the console. Also enable the warning here, and fix them. At the same time, add missing braces around adjacent and nearby one-line blocks. [1] https://gerrit-review.googlesource.com/c/gerrit/+/227897 Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Convert to lambda or member referenceCarsten Hammer2019-05-161-12/+5
| | | | | | | | | | | Convert anonymous inner classes to lambda expressions or member references Bug: 545856 CQ: 19537 Change-Id: I621431c178e8b99316314602f7c66c9a36f9ae98 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* HttpTestCase#fsck: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-3/+4
| | | | | Change-Id: Ibda8c9970322871abf0fcf1244977bed04eaedd2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* refactor: simplify collection.toArray()Michael Keppler2018-08-231-1/+1
| | | | | | | | | | | On recent VMs, collection.toArray(new T[0]) is faster than collection.toArray(new T[collection.size()]). Since it is also more readable, it should now be the preferred way of collection to array conversion. https://shipilev.net/blog/2016/arrays-wisdom-ancients/ Change-Id: I80388532fb4b2b0663ee1fe8baa94f5df55c8442 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
* Remove further unnecessary 'final' keywordsHan-Wen Nienhuys2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove it from * package private functions. * try blocks * for loops this was done with the following python script: $ cat f.py import sys import re import os def replaceFinal(m): return m.group(1) + "(" + m.group(2).replace('final ', '') + ")" methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)") def subst(fn): input = open(fn) os.rename(fn, fn + "~") dest = open(fn, 'w') for l in input: l = methodDecl.sub(replaceFinal, l) dest.write(l) dest.close() for root, dirs, files in os.walk(".", topdown=False): for f in files: if not f.endswith('.java'): continue full = os.path.join(root, f) print full subst(full) Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-153-5/+5
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Configure Semaphore used in TestRequestLog to be fairMatthias Sohn2018-02-221-1/+1
| | | | | Bug: 528187 Change-Id: I26c94ad7f802fc1dbe72d63a7ea346dc6e19ff94 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix indentation in TestRequestLogMatthias Sohn2018-02-221-75/+76
| | | | | | We use tabs to indent. Change-Id: I19b00e06becfb92fbabb99b5699385506fd85214 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix remaining javadoc errors raised by doclintMatthias Sohn2017-12-211-1/+1
| | | | | | | For now ignore doclint "missing" warnings. Change-Id: I0e5af7a757f4d92ffeeb113f30576a35414d6781 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove redundant @SuppressWarnings("unused")David Pursehouse2017-12-181-8/+4
| | | | | | | These are now redundant since the parameters have javadoc. Change-Id: I6bfde267e1712ee35871c30c8203c3b4dc5e136a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix javadoc in org.eclipse.jgit.junit.httpMatthias Sohn2017-12-177-16/+284
| | | | | Change-Id: I8af6d07676a285f79635405e5891535a5adfd7e9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Handle SSL handshake failures in TransportHttpThomas Wolf2017-09-131-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a https connection could not be established because the SSL handshake was unsuccessful, TransportHttp would unconditionally throw a TransportException. Other https clients like web browsers or also some SVN clients handle this more gracefully. If there's a problem with the server certificate, they inform the user and give him a possibility to connect to the server all the same. In git, this would correspond to dynamically setting http.sslVerify to false for the server. Implement this using the CredentialsProvider to inform and ask the user. We offer three choices: 1. skip SSL verification for the current git operation, or 2. skip SSL verification for the server always from now on for requests originating from the current repository, or 3. always skip SSL verification for the server from now on. For (1), we just suppress SSL verification for the current instance of TransportHttp. For (2), we store a http.<uri>.sslVerify = false setting for the original URI in the repo config. For (3), we store the http.<uri>.sslVerify setting in the git user config. Adapt the SmartClientSmartServerSslTest such that it uses this mechanism instead of setting http.sslVerify up front. Improve SimpleHttpServer to enable setting it up also with HTTPS support in anticipation of an EGit SWTbot UI test verifying that cloning via HTTPS from a server that has a certificate that doesn't validate pops up the correct dialog, and that cloning subsequently proceeds successfully if the user decides to skip SSL verification. Bug: 374703 Change-Id: Ie1abada9a3d389ad4d8d52c2d5265d2764e3fb0e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Do authentication re-tries on HTTP POSTThomas Wolf2017-08-221-10/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is at least one git server out there (GOGS) that does not require authentication on the initial GET for info/refs?service=git-receive-pack but that _does_ require authentication for the subsequent POST to actually do the push. This occurs on GOGS with public repositories; for private repositories it wants authentication up front. Handle this behavior by adding 401 handling to our POST request. Note that this is suboptimal; we'll re-send the push data at least twice if an authentication failure on POST occurs. It would be much better if the server required authentication up-front in the GET request. Added authentication unit tests (using BASIC auth) to the SmartClientSmartServerTest: - clone with authentication - clone with authentication but lacking CredentialsProvider - clone with authentication and wrong password - clone with authentication after redirect - clone with authentication only on POST, but not on GET Also tested manually in the wild using repositories at try.gogs.io. That server offers only BASIC auth, so the other paths (DIGEST, NEGOTIATE, fall back from DIGEST to BASIC) are untested and I have no way to test them. * public repository: GET unauthenticated, POST authenticated Also tested after clearing the credentials and then entering a wrong password: correctly asks three times during the HTTP POST for user name and password, then gives up. * private repository: authentication already on GET; then gets applied correctly initially to the POST request, which succeeds. Also fix the authentication to use the credentials for the redirected URI if redirects had occurred. We must not present the credentials for the original URI in that case. Consider a malicious redirect A->B: this would allow server B to harvest the user credentials for server A. The unit test for authentication after a redirect also tests for this. Bug: 513043 Change-Id: I97ee5058569efa1545a6c6f6edfd2b357c40592a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add support to follow HTTP redirectsThomas Wolf2017-08-172-12/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-core follows HTTP redirects so JGit should also provide this. Implement config setting http.followRedirects with possible values "false" (= never), "true" (= always), and "initial" (only on GET, but not on POST).[1] We must do our own redirect handling and cannot rely on the support that the underlying real connection may offer. At least the JDK's HttpURLConnection has two features that get in the way: * it does not allow cross-protocol redirects and thus fails on http->https redirects (for instance, on Github). * it translates a redirect after a POST to a GET unless the system property "http.strictPostRedirect" is set to true. We don't want to manipulate that system setting nor require it. Additionally, git has its own rules about what redirects it accepts;[2] for instance, it does not allow a redirect that adds query arguments. We handle response codes 301, 302, 303, and 307 as per RFC 2616.[3] On POST we do not handle 303, and we follow redirects only if http.followRedirects == true. Redirects are followed only a certain number of times. There are two ways to control that limit: * by default, the limit is given by the http.maxRedirects system property that is also used by the JDK. If the system property is not set, the default is 5. (This is much lower than the JDK default of 20, but I don't see the value of following so many redirects.) * this can be overwritten by a http.maxRedirects git config setting. The JGit http.* git config settings are currently all global; JGit has no support yet for URI-specific settings "http.<pattern>.name". Adding support for that is well beyond the scope of this change. Like git-core, we log every redirect attempt (LOG.info) so that users may know about the redirection having occurred. Extends the test framework to configure an AppServer with HTTPS support so that we can test cloning via HTTPS and redirections involving HTTPS. [1] https://git-scm.com/docs/git-config [2] https://kernel.googlesource.com/pub/scm/git/git/+/6628eb41db5189c0cdfdced6d8697e7c813c5f0f [3] https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html CQ: 13987 Bug: 465167 Change-Id: I86518cb76842f7d326b51f8715e3bbf8ada89859 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Add missing newlines at ends of Java filesDavid Pursehouse2017-07-251-1/+1
| | | | | Change-Id: Iead36f53d57ead0eb3edd3f9efb63b6630c9c20c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Update jetty to 9.4.5Mat Booth2017-05-112-16/+25
| | | | | | | | | | * Adapt to API removals in jetty 9.4+ * Manifests changed to restrict jetty to [9.4.5,10.0.0) Bug: 514336 Bug: 516514 Change-Id: Ifcfd968084dfa6db0ae07cf541d33a6cdedc1ee2 Signed-off-by: Mat Booth <mat.booth@redhat.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix unnecessary type paramatersShawn Pearce2017-04-221-1/+1
| | | | | | Can be inferred by the compiler. Change-Id: If880ddfb7d7af2be70729d0c9f73c7c821b9c652
* Add missing @Override annotations in AppServer.TestMappedLoginServiceMatthias Sohn2017-04-091-0/+2
| | | | Change-Id: Ia728f1d033ecdf96b22945bc1ae38e5cb11064dd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-4.6'Matthias Sohn2017-04-022-16/+21
|\ | | | | | | | | | | | | | | | | * stable-4.6: Update Jetty to 9.3.17.v20170317 Revert "Update Jetty to 9.4.1.v20170120 in buck build" Revert "Update Jetty to 9.4.1.v20170120" Change-Id: I9193b568cce9c72da899a8f3eaaf833956438e13 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Revert "Update Jetty to 9.4.1.v20170120"David Pursehouse2017-03-312-16/+20
| | | | | | | | | | | | This reverts commit e05caf91f1df86a95d3e0454000d345bb90a415e. Change-Id: Ia4287f130034a790759b5035505a093b4616a05a
| * Update Jetty to 9.4.1.v20170120Matthias Sohn2017-03-062-20/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | MappedLoginService is no longer available in Jetty 9.4 therefore base TestLoginService on AbstractLoginService. Apparently Jetty now uses slf4j hence adapt RecordingLogger accordingly so we can log error messages containing slf4j style formatting anchors "{}". Change-Id: Ibb36aba8782882936849b6102001a88b699bb65c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> (cherry picked from commit 5e8e2179b218ede7d14b69dc5149b0691b5859cf)
* | Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-206-11/+11
| | | | | | | | | | | | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-196-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set missingOverrideAnnotation=warning in Eclipse compiler preferences which enables the warning: The method <method> of type <type> should be tagged with @Override since it actually overrides a superclass method Justification for this warning is described in: http://stackoverflow.com/a/94411/381622 Enabling this causes in excess of 1000 warnings across the entire code-base. They are very easy to fix automatically with Eclipse's "Quick Fix" tool. Fix all of them except 2 which cause compilation failure when the project is built with mvn; add TODO comments on those for further investigation. Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Update Jetty to 9.4.1.v20170120Matthias Sohn2017-02-192-20/+16
|/ | | | | | | | | | | MappedLoginService is no longer available in Jetty 9.4 therefore base TestLoginService on AbstractLoginService. Apparently Jetty now uses slf4j hence adapt RecordingLogger accordingly so we can log error messages containing slf4j style formatting anchors "{}". Change-Id: Ibb36aba8782882936849b6102001a88b699bb65c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* AppServer: Remove unnecessary 'unused' suppressionsDavid Pursehouse2016-09-221-4/+2
| | | | | Change-Id: Ic27106f38af14833147f739179c3ef8ec6b6ee31 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix non-parameterized generic type warningMatthias Sohn2016-08-081-1/+3
| | | | Change-Id: Ib857166f64420aebf7c31d72825cac44bd770dbd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix AppServer build errors in Eclipse with <4.6 target platformsMatthias Sohn2016-07-141-18/+27
| | | | | | | | | | | | 9aa3748 added dummy implementations for loadRoleInfo() and loadUserInfo() to class MappedLoginService to fix compile errors in Eclipse when using 4.6 target platform which brings Jetty 9.3 adding these two methods. Unfortunately this causes errors when using non 4.6 target platform coming with an older Jetty version. Fix this by extracting the anonymous subclass of MappedLoginService which allows to suppress the unused private method errors in Eclipse. Change-Id: I75baeea7ff4502ce9ef2b541b3c0555da5535d79 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement new abstract MappedLoginService methods added in Jetty 9.3Matthias Sohn2016-07-111-0/+8
| | | | | | | | Eclipse Neon comes with Jetty 9.3 which is causing unimplemented abstract method errors in test class AppServer when using the JGit or EGit Neon target platform. Fix this by adding dummy implementations. Change-Id: Ie49107d814a846997de95f149e91fe1ec2fbe4d8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-4.2'Matthias Sohn2016-02-151-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.2: Don't use deprecated LockFile constructor Fix warnings about unchecked conversion of MergeResult MockServletConfig: Fix warning about unchecked conversion of Enumeration HugeFileTest: Make Git a class member and open in try-with-resource Suppress "unchecked cast" warnings related to UploadPackFactory.DISABLED DiffAlgorithms: Fix warnings about variable hiding DirCacheBasicTest: Open ObjectInserter.Formatter in try-with-resource DirCacheBuilderIteratorTest: Open TreeWalk in try-with-resource DirCacheCGitCompatabilityTest: Open TreeWalk in try-with-resource DirCacheCheckoutMaliciousPathTest: Open Git and RevWalk in t-w-r DirCacheIteratorTest: Open TreeWalk instances in try-with-resource ForPathTest: Open TreeWalk in try-with-resource GitConstructionTest: Open Git instance in try-with-resource IndexDiffTest: Open Git instances in try-with-resources ManifestParserTest: Don't use deprecated StringBufferInputStream InMemoryRepository: Remove unused RevWalk from batch method signature IndexModificationTimesTest: Open Git instances in try-with-resource InterIndexDiffFilterTest: Open TreeWalk in try-with-resource LockFileTest: Open Git instance in try-with-resource JGit v4.1.2.201602141800-r MergeCommandTest: Use JUnit's assume to check preconditions MergeCommandTest: Open Git instances in try-with-resource Change-Id: Ie5dba6b9132a29e86958a04fa2b76465bcd2c6b5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * MockServletConfig: Fix warning about unchecked conversion of EnumerationDavid Pursehouse2016-02-151-1/+1
| | | | | | | | | | Change-Id: Ic5ce6d220e3b644032819ce4b2f31c669be1cdb9 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | Support LFS protocol and a file system based LFS storageMatthias Sohn2016-02-041-1/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement LfsProtocolServlet handling the "Git LFS v1 Batch API" protocol [1]. Add a simple file system based LFS content store and the debug-lfs-store command to simplify testing. Introduce a LargeFileRepository interface to enable additional storage implementation while reusing the same protocol implementation. At the client side we have to configure the lfs.url, specify that we use the batch API and we don't use authentication: [lfs] url = http://host:port/lfs batch = true [lfs "http://host:port/lfs"] access = none the git-lfs client appends the "objects/batch" to the lfs.url. Hard code an Authorization header in the FileLfsRepository.getAction because then git-lfs client will skip asking for credentials. It will just forward the Authorization header from the response to the download/upload request. The FileLfsServlet supports file content storage for "Large File Storage" (LFS) server as defined by the Github LFS API [2]. - upload and download of large files is probably network bound hence use an asynchronous servlet for good scalability - simple object storage in file system with 2 level fan-out - use LockFile to protect writing large objects against multiple concurrent uploads of the same object - to prevent corrupt uploads the uploaded file is rejected if its hash doesn't match id given in URL The debug-lfs-store command is used to run the LfsProtocolServlet and, optionally, the FileLfsServlet which makes it easier to setup a local test server. [1] https://github.com/github/git-lfs/blob/master/docs/api/http-v1-batch.md [2] https://github.com/github/git-lfs/tree/master/docs/api Bug: 472961 Change-Id: I7378da5575159d2195138d799704880c5c82d5f3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Update to Jetty 9.2.10Matthias Sohn2015-05-103-7/+20
| | | | Change-Id: Iace29e6e99836019bb603ce06a08b91bada7c627 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove some unnecessary dependencies on FileRepostoryRobin Rosenberg2013-04-181-3/+2
| | | | | Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* SimpleHttpServer API shouldn't expose internalsMatthias Sohn2013-03-221-4/+3
| | | | Change-Id: I5963ae720f33cb148de08b4c64d02c81d6791139 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit 3.0: move internal classes into an internal subpackageShawn Pearce2013-03-182-2/+2
| | | | | | | | This breaks all existing callers once. Applications are not supposed to build against the internal storage API unless they can accept API churn and make necessary updates as versions change. Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9
* cleanup: Remove unused declarationsRobin Rosenberg2012-06-061-1/+0
| | | | Change-Id: I3b54cb9f73cb433c71a441a11ddc74cfecdaa1dc
* Revert Jetty from 8.1.3.v20120416 to 7.6.0.v20120127Matthias Sohn2012-06-031-1/+1
| | | | | | | | | | | This reverts commit 24a0f47e32ab7cdf20c2201d7100599ea057f8a3 and updates JGit dependencies to use the latest available Jetty 7.x release. We can't use Jetty 8.x since it depends on Servlet API 3.0 which requires Java 6 but JGit still wants to support Java 5. Use one of the target platforms defined in Ibf67a6d3539fa0708a3e5dbe44fb899c56fbd8ed to work with that in Eclipse. Change-Id: I343273d994dc7b6e0287c604e5926ff77d5b585b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use default thread pool to prevent thread pool starvationMatthias Sohn2012-06-031-17/+1
| | | | | | | Bug: 380302 Change-Id: Ie66d495481776469ff2aa603c550557cff82cafc Suggested-By: Joakim Erdfelt <joakim@intalio.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Update Jetty to 8.1.3.v20120416Matthias Sohn2012-05-232-3/+3
| | | | | | | | Jetty 8.1.3 comes with Juno M7 and this version can be installed from http://download.eclipse.org/jetty/updates/jetty-bundles-8.x/8.1.3.v20120416/ Change-Id: Ifc4bfbb3efbab0f5bfbde74f0b2ddc5a2f9ee6a5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>