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.
This commit is contained in:
Mikhail Golubev
2017-08-29 18:25:21 +03:00
parent b681e943f3
commit f69a58abcd
@@ -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);
}
}