summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-12-09 08:56:32 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-12-09 08:56:32 -0800
commit18da57e1e7caf78bcdd74fb5f4b48d2c25b85bd6 (patch)
tree6288a533e99b50466340cb79ce052365aed956d9 /src
parentc8c2b86c4c1bea9cce4dc7c1147b358e31ba6923 (diff)
downloadDotNetOpenAuth-18da57e1e7caf78bcdd74fb5f4b48d2c25b85bd6.zip
DotNetOpenAuth-18da57e1e7caf78bcdd74fb5f4b48d2c25b85bd6.tar.gz
DotNetOpenAuth-18da57e1e7caf78bcdd74fb5f4b48d2c25b85bd6.tar.bz2
Fixed bug where SSL forwarders' port is incorrectly assumed to be port :80 instead of :443.
Fixes Trac #157
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
index 16b4546..64dcaaa 100644
--- a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
+++ b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
@@ -333,13 +333,12 @@ namespace DotNetOpenAuth.Messaging {
// the public URL:
if (request.ServerVariables["HTTP_HOST"] != null) {
ErrorUtilities.VerifySupported(request.Url.Scheme == Uri.UriSchemeHttps || request.Url.Scheme == Uri.UriSchemeHttp, "Only HTTP and HTTPS are supported protocols.");
+ string scheme = request.ServerVariables["HTTP_X_FORWARDED_PROTO"] ?? request.Url.Scheme;
+ Uri hostAndPort = new Uri(scheme + Uri.SchemeDelimiter + request.ServerVariables["HTTP_HOST"]);
UriBuilder publicRequestUri = new UriBuilder(request.Url);
- Uri hostAndPort = new Uri(request.Url.Scheme + Uri.SchemeDelimiter + request.ServerVariables["HTTP_HOST"]);
+ publicRequestUri.Scheme = scheme;
publicRequestUri.Host = hostAndPort.Host;
publicRequestUri.Port = hostAndPort.Port; // CC missing Uri.Port contract that's on UriBuilder.Port
- if (request.ServerVariables["HTTP_X_FORWARDED_PROTO"] != null) {
- publicRequestUri.Scheme = request.ServerVariables["HTTP_X_FORWARDED_PROTO"];
- }
return publicRequestUri.Uri;
} else {
// Failover to the method that works for non-web farm enviroments.