aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.apache/src
Commit message (Collapse)AuthorAgeFilesLines
* [errorprone] Suppress MissingSummary for translation bundlesMatthias Sohn2023-09-251-0/+1
| | | | Change-Id: I4da51c7e089366b016a0cc64f768a151c24bc956
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-162-28/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link <url>} to <a> ==================== @link does not support being given an external URL. Replaces them with HTML `<a>`. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p> instead - replace <tt>code</tt> by {@code code} - <table> tags don't allow summary attribute, specify caption as <caption>caption</caption> to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn <matthias.sohn@sap.com>
* TransportHttp: shared SSLContext during fetch or pushThomas Wolf2021-01-143-19/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TransportHttp makes several HTTP requests. The SSLContext and socket factory must be shared over these requests, otherwise authentication information may not be propagated correctly from one request to the next. This is important for authentication mechanisms that rely on client-side state, like NEGOTIATE (either NTLM, if the underlying HTTP library supports it, or Kerberos). In particular, SPNEGO cannot authenticate on a POST request; the authentication must come from the initial GET request, which implies that the POST request must use the same SSLContext and socket factory that was used for the GET. Change the way HTTPS connections are configured. Introduce the concept of a GitSession, which is a client-side HTTP session over several HTTPS requests. TransportHttp creates such a session and uses it to configure all HTTP requests during that session (fetch or push). This gives a way to abstract away the differences between JDK and Apache HTTP connections and to configure SSL setup outside. A GitSession can maintain state and thus give all HTTP requests in a session the same socket factory. Introduce an extension interface HttpConnectionFactory2 that adds a method to obtain a new GitSession. Implement this for both existing HTTP connection factories. Change TransportHttp to use the new GitSession to configure HTTP connections. The old methods for disabling SSL verification still exist to support possibly external connection and connection factory implementations that do not make use of the new GitSession yet. Bug: 535850 Change-Id: Iedf67464e4e353c1883447c13c86b5a838e678f1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-044-152/+20
| | | | | | | | | | 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>
* TLS support on IBM JDKsThomas Wolf2020-01-031-4/+36
| | | | | | | | | | | | | | | | | SSLContext.getInstance("TLS") by default behaves differently on IBM JDK than on Oracle or OpenJDK.[1] On IBM JDK one gets sockets that have only TLSv1 enabled, which makes HTTPS connections fail since most servers refuse this old protocol version. On Oracle JDK/OpenJDK, one gets sockets with all available protocol versions enabled. Explicitly enable all available TLS protocol versions to make HTTPS connections work also on IBM JDK. [1] https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jsse2Docs/matchsslcontext_tls.html#matchsslcontext_tls Bug: 558709 Change-Id: I5ffc57a78e67a6239b9dad54840a49a8ed28930a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Apache HTTP: support proxy authenticationThomas Wolf2019-10-071-0/+3
| | | | | | | | Add a credentials provider that forwards to the java.net.Authenticator. Needed to support proxies requiring authentication. Bug: 549832 Change-Id: I181ee27a6c9f1b3fa402ce58affdd5ff3f7c96c9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Apache HTTP: run more testsThomas Wolf2019-08-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out the test parameterization to use both connection factories into a common super class and use it in more tests. This made HttpClientTests.testV2HttpSubsequentResponse() fail for Apache HTTP. The test used the pattern - create POST connection - setDoOutput(true) - connect() - write output stream - get & read input stream This pattern is never used in JGit, which actually calls connect() only in one case in LFS, and that's on a HEAD request. The above pattern works on JDK, but fails on Apache HTTP because with Apache HTTP a connect() actually executes the full request including writing the entity. To work with Apache HTTP, the pattern would need to be - create POST connection - setDoOutput(true) - write output stream - connect() - get & read input stream which is fine for both. JDK connects implicitly in getOutputStream() and treats the later explicit connect() as a no-op, and Apache works because the entity is written when connect() is called. Because JDK connects implicitly on getOutputStream(), the following pattern also works with JDK: - create POST connection - setDoOutput(true) - write output stream - get & read input stream Support this with Apache HTTP too: let getInputStream() execute the request if it wasn't executed already. Remove explicit connect() calls from test code, since JGit doesn't do those either. Change-Id: Ica038c00a7b8edcc01d5660d18e961146305b87f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Add a method to get all values of HTTP header defined as listMatthias Sohn2018-11-261-1/+11
| | | | | | | | | | | | According to RFC 2616 [1] header field names are case insensitive. Header fields defined as a comma separated list can have multiple header fields with the same field name. Add a method to HttpConnection which retrieves all values with a given header field name with the field name compared case insensitive. [1] https://tools.ietf.org/html/rfc2616#section-4.2" Change-Id: I7f601b21cda99e84f43f866c7c7cb4cb0e3cf5c3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* HttpClientConnection.getHeaderFields should support multiple values for same ↵Gabriel Couto2018-07-231-3/+7
| | | | | | | | header Bug: 537166 Change-Id: I1ba645968efe01a88f2484f030b7572228ba169c Signed-off-by: Gabriel Couto <gmcouto@gmail.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-1/+1
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Fix javadoc in org.eclipse.jgit.http.apacheMatthias Sohn2017-12-174-7/+52
| | | | | Change-Id: I38a4854856b0103790a410b48c1c3d708b6500c1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove use of deprecated X509HostnameVerifierMatthias Sohn2017-12-131-29/+2
| | | | Change-Id: I318f5457ade3d11b2ac1c99f6ef382a0a147a352 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-201-2/+2
| | | | | | | | | | 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-193-0/+34
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix content length in HttpClientConnectionZhen Chen2016-11-221-2/+11
| | | | | | | | | | | | | Per the interface specification, the getContentLength method should return -1 if content length is unknown or greater than Integer.MAX_VALUE. For chunked transfer encoding, the content length is not included in the header, hence will cause a NullPointerException when trying to parse the content length header. Change-Id: Iaa36b5c146a8d654e364635fa0bd2d14129baf17 Signed-off-by: Zhen Chen <czhen@google.com>
* Use valueOf rather than constructor for Integer and BooleanDavid Pursehouse2016-10-182-4/+4
| | | | | Change-Id: I1c65b2e40ba6ec5860903b11b4631e014f3dc5ce Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* HttpClientConnection: Register connection socket factory for httpMatthias Sohn2016-10-131-1/+4
| | | | | | | It is necessary to register a socket connection factory to prevent the "http protocol is not supported" error when connecting over a proxy. Change-Id: Iedf554acef841f52c1f2e3401ef0a0583ac5253b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* HttpClientConnection: Don't use deprecated HttpClient classesDavid Pursehouse2016-09-221-30/+39
| | | | | | | | | - raise minimum version for HttpClient packages to 4.3 since some of the used classes aren't available in older versions - recompute OSGi uses clauses Change-Id: I8f0bff1433762561e02f7439db27a6a9e846c290 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix HttpClientConnection leaking temporary buffer filesMatthias Sohn2016-08-242-12/+33
| | | | | | | | | | HttpClientConnection uses a TemporaryBufferEntity which uses TemporaryBuffer.LocalFile to buffer an HttpEntity. It was leaking temporary files if the buffered entities were larger than 1MB since it failed to destroy the TemporaryBuffer.LocalFile. Bug: 500079 Change-Id: Ib963e04efc252bdd0420a5c69b1a19181e9e6169 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add support for HEAD requests to HttpClientConnectionMatthias Sohn2016-02-041-4/+12
| | | | | Change-Id: I501f37e06b686a3a0bb5fd857dd72e424da91d3e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix NPE in HttpSupportMatthias Sohn2015-12-161-13/+14
| | | | | Bug: 483366 Change-Id: I107f1b44e0e6371e3cfbd1cc18a970412e1fc679 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Apache HttpClientConnection: replace calls to deprecated LocalFile()Matthias Sohn2014-11-261-3/+3
| | | | Change-Id: I79f422e004f386b3f2875de6997e5a0949fff566
* Move Apache httpclient based HTTP support to a separate bundleMatthias Sohn2014-02-204-0/+603
This move avoids that all consumers of org.eclipse.jgit depend on Apache httpclient. Also add another feature to make this optional for OSGi consumers as well. Change-Id: I5ef5e00c53678b9e1d7cfd54bbca3ff6f1c1c967 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>