Fix: Disable HTTP KeepAlive

To improve support for proxy servers which do not support this
optimisation.
See:
http://discoict.com.au/forum/support/2013/2/connection-issues,-lwt,-updates-etc.aspx
This commit is contained in:
Gary Sharp
2013-02-08 12:32:54 +11:00
parent 8089544dab
commit eb03365513
7 changed files with 684 additions and 655 deletions
+14 -1
View File
@@ -31,7 +31,7 @@ namespace Disco.BI.Interop.Community
}
}
catch (Exception)
{} // Ignore Errors
{ } // Ignore Errors
return "http://discoict.com.au/base/DiscoUpdate/V1";
}
@@ -56,6 +56,15 @@ namespace Disco.BI.Interop.Community
var DiscoBIVersion = CurrentDiscoVersion();
HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(UpdateUrl(db));
// Added: 2013-02-08 G#
// Fix for Proxy Servers which dont support KeepAlive
webRequest.KeepAlive = false;
// End Added: 2013-02-08 G#
if (!UseProxy)
webRequest.Proxy = new WebProxy();
webRequest.ContentType = "application/json";
webRequest.Method = WebRequestMethods.Http.Post;
webRequest.UserAgent = string.Format("Disco/{0} (Update)", DiscoBIVersion);
@@ -151,6 +160,10 @@ namespace Disco.BI.Interop.Community
var DiscoBIVersion = CurrentDiscoVersion();
HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php");
// Added: 2013-02-08 G#
// Fix for Proxy Servers which dont support KeepAlive
webRequest.KeepAlive = false;
// End Added: 2013-02-08 G#
if (!useProxy)
wReq.Proxy = new WebProxy(); // Empty Proxy Config
wReq.Method = WebRequestMethods.Http.Post;
@@ -75,8 +75,9 @@ namespace Disco.BI.Interop.Community
{
UpdateCheck.Check(db, true, this.Status);
}
catch (Exception)
catch (Exception ex)
{
ScheduledTasksLog.LogScheduledTaskException(this.Status.TaskName, this.Status.SessionId, this.Status.TaskType, ex);
// Could be proxy error - try again without proxy:
UpdateCheck.Check(db, false, this.Status);
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0207.1853")]
[assembly: AssemblyFileVersion("1.2.0207.1853")]
[assembly: AssemblyVersion("1.2.0208.1156")]
[assembly: AssemblyFileVersion("1.2.0208.1156")]
+8 -1
View File
@@ -158,11 +158,18 @@ namespace Disco.Web
}
if (!string.IsNullOrWhiteSpace(Address))
{
WebProxy p = new WebProxy(new Uri(string.Format("http://{0}:{1}", Address, Port)));
WebProxy p = new WebProxy(Address, Port);
p.BypassProxyOnLocal = true;
if (!string.IsNullOrWhiteSpace(Username))
{
p.Credentials = new NetworkCredential(Username, Password);
}
else
{
// Added 2013-02-08 G#
// Improve support for Integrated Windows Authentication
p.UseDefaultCredentials = true;
}
WebRequest.DefaultWebProxy = p;
}
else
@@ -57,6 +57,10 @@ namespace Disco.Web.Models.InitialConfig
try
{
HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("http://discoict.com.au/");
// Added: 2013-02-08 G#
// Fix for Proxy Servers which dont support KeepAlive
wReq.KeepAlive = false;
// End Added: 2013-02-08 G#
wReq.Method = WebRequestMethods.Http.Get;
wReq.UserAgent = string.Format("Disco/{0} (Initial Config; Org: {1})", DiscoApplication.Version, DiscoApplication.OrganisationName);
using (HttpWebResponse wRes = (HttpWebResponse)wReq.GetResponse())
@@ -57,6 +57,10 @@ namespace Disco.Web.Models.InitialConfig
try
{
HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php");
// Added: 2013-02-08 G#
// Fix for Proxy Servers which dont support KeepAlive
wReq.KeepAlive = false;
// End Added: 2013-02-08 G#
if (!useProxy)
wReq.Proxy = new WebProxy(); // Empty Proxy Config
wReq.Method = WebRequestMethods.Http.Post;
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0207.1727")]
[assembly: AssemblyFileVersion("1.2.0207.1727")]
[assembly: AssemblyVersion("1.2.0208.1156")]
[assembly: AssemblyFileVersion("1.2.0208.1156")]