From 27827ffb651dce76a5b6c75a0829dd7343481eb3 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 8 Sep 2014 19:58:00 +0000 Subject: [PATCH] OOPS! That's a NullRefException if you're _not_ using CloudFlare all of a sudden. That needs a fix NOW. --- Site5/Master-v5.master.cs | 10 +++++++++- Site5/Security/Login.aspx.cs | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Site5/Master-v5.master.cs b/Site5/Master-v5.master.cs index f5b86f99..d6228faf 100644 --- a/Site5/Master-v5.master.cs +++ b/Site5/Master-v5.master.cs @@ -64,7 +64,15 @@ namespace Swarmops // Special case for CloudFlare deployments - there is a case where somebody will get their connections de-SSLed at the server string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"]; - bool cloudFlareSsl = (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"") ? true : false); + bool cloudFlareSsl = false; + + if (!string.IsNullOrEmpty(cloudFlareVisitorScheme)) + { + if (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"")) + { + cloudFlareSsl = true; + } + } // TODO: Same thing for Pound deployments diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index ab92ed96..ba3bcf7c 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -35,7 +35,15 @@ namespace Swarmops.Pages.Security // Special case for CloudFlare deployments - there is a case where somebody will get their connections de-SSLed at the server string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"]; - bool cloudFlareSsl = (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"") ? true : false); + bool cloudFlareSsl = false; + + if (!string.IsNullOrEmpty(cloudFlareVisitorScheme)) + { + if (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"")) + { + cloudFlareSsl = true; + } + } // TODO: Same thing for Pound deployments