From f69a58abcd2535cc47c8e5b47e0be4259a4b6a90 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Tue, 29 Aug 2017 16:56:29 +0300 Subject: [PATCH] IDEA-163490 Force the use of https in connections to PivotalTracker Old Apache HttpClient doesn't allow to enable following redirects for HTTP requests containing entities. Instead I replace "http:" with "https:" in server URLs of existing connectors so as not to make their users re-configure everything or modify the address manually. --- .../tasks/pivotal/PivotalTrackerRepository.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java index f16fa55c7e54..04e125accb60 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java @@ -51,7 +51,7 @@ public class PivotalTrackerRepository extends BaseRepositoryImpl { { if (StringUtil.isEmpty(getUrl())) { - setUrl("http://www.pivotaltracker.com"); + setUrl("https://www.pivotaltracker.com"); } } @@ -292,6 +292,7 @@ public class PivotalTrackerRepository extends BaseRepositoryImpl { @Override protected void configureHttpMethod(final HttpMethod method) { method.addRequestHeader("X-TrackerToken", myAPIKey); + //method.setFollowRedirects(true); } public String getProjectId() { @@ -384,4 +385,12 @@ public class PivotalTrackerRepository extends BaseRepositoryImpl { protected int getFeatures() { return super.getFeatures() | BASIC_HTTP_AUTHORIZATION | STATE_UPDATING; } + + @Override + public void setUrl(String url) { + if (url.startsWith("http:")) { + url = "https:" + StringUtil.trimStart(url, "http:"); + } + super.setUrl(url); + } }