Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 6df6e7b

Browse files
author
Steffen Wilke
committed
Add https support to CCTray
This change adds security protocols to the CruiseServerHttpClient which allows the application to handle build servers that communicate over "https". (e.g. jenkins with cc.xml) Since there is currently an issue with the jenkins cc.xml returning "http"-urls for build jobs while the server is running over "https", this change also contains a workaround to handle this issue by changing "http" to "https" in case the build server is using "https".
1 parent 3cf8be7 commit 6df6e7b

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

project/CCTrayLib/Presentation/MainFormController.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,16 @@ private static void DisplayWebPageForProject(ISingleProjectDetail project)
386386
{
387387
if (project.IsConnected)
388388
{
389-
string url = project.WebURL;
389+
390+
// replace plain http by https in case the buildserver is using https
391+
string url = project.WebURL;
392+
if(url != null && project.Configuration?.BuildServer?.Url != null
393+
&& project.Configuration.BuildServer.Url.StartsWith("https:")
394+
&& url.StartsWith("http:"))
395+
{
396+
url = url.Replace("http:", "https:");
397+
}
398+
390399
Process.Start(url);
391400
}
392401
}

project/CommonAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[assembly: AssemblyProductAttribute("CruiseControl.NET")]
1515
[assembly: AssemblyCopyrightAttribute("Copyright © 2003 - 2014 ThoughtWorks Inc.")]
1616
[assembly: AssemblyTrademarkAttribute("")]
17-
[assembly: AssemblyVersionAttribute("0.0.0.0")]
18-
[assembly: AssemblyFileVersionAttribute("0.0.0.0")]
17+
[assembly: AssemblyVersionAttribute("1.8.5.1")]
18+
[assembly: AssemblyFileVersionAttribute("1.8.5.1")]
1919
[assembly: AssemblyInformationalVersionAttribute("Git hash : 0000000000000000000000000000000000000000")]
2020

project/Remote/CruiseServerHttpClient.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ public override CruiseServerSnapshot GetCruiseServerSnapshot()
206206
{
207207
// Retrieve the XML from the server - 1.3 or later
208208
var url = GenerateUrl("XmlServerReport.aspx");
209+
210+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
211+
209212
webFunctions.SetCredentials(client, new Uri(url), false);
210213
response = client.DownloadString(url);
211214
}

0 commit comments

Comments
 (0)