diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2017-08-30 07:47:26 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-09-10 17:37:54 -0400 |
commit | fdcd4f9a3444c442a13bee8f041e31be12256464 (patch) | |
tree | f03eeed783456d6d5395cb2d98a6cf1eb8951abd /org.eclipse.jgit.http.test/tst | |
parent | 2dbfe49a42d99d75192beca5f8ed4e562595c50f (diff) | |
download | jgit-fdcd4f9a3444c442a13bee8f041e31be12256464.tar.gz jgit-fdcd4f9a3444c442a13bee8f041e31be12256464.zip |
Support http.<url>.* configs
Git has a rather elaborate mechanism to specify HTTP configuration
options per URL, based on pattern matching the URL against "http"
subsection names.[1] The URLs used for this matching are always the
original URLs; redirected URLs do not participate.
* Scheme and host must match exactly case-insensitively.
* An optional user name must match exactly.
* Ports must match exactly after default ports have been filled in.
* The path of a subsection, if any, must match a segment prefix of
the path of the URL.
* Matches with user name take precedence over equal-length path
matches without, but longer path matches are preferred over
shorter matches with user name.
Implement this for JGit. Factor out the HttpConfig from TransportHttp
and implement the matching and override mechanism.
The set of supported settings is still the same; JGit currently
supports only followRedirects, postBuffer, and sslVerify, plus the
JGit-specific maxRedirects key.
Add tests for path normalization and prefix matching only on segment
separators, and use the new mechanism in SmartClientSmartServerSslTest
to disable sslVerify selectively for only the test server URLs.
Compare also bug 374703 and bug 465492. With this commit it would be
possible to set sslVerify to false for only the git server using a
self-signed certificate instead of having to switch it off globally
via http.sslVerify.
[1] https://git-scm.com/docs/git-config
Change-Id: I42a3c2399cb937cd7884116a2a32fcaa7a418fcb
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.http.test/tst')
-rw-r--r-- | org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerSslTest.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerSslTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerSslTest.java index 42064581c9..47a84354fb 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerSslTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerSslTest.java @@ -153,7 +153,12 @@ public class SmartClientSmartServerSslTest extends HttpTestCase { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); - userConfig.setBoolean("http", null, "sslVerify", false); + userConfig.setBoolean("http", + "https://" + secureURI.getHost() + ':' + server.getSecurePort(), + "sslVerify", false); + userConfig.setBoolean("http", + "http://" + remoteURI.getHost() + ':' + server.getPort(), + "sslVerify", false); userConfig.save(); } |