summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs')
-rw-r--r--src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
index 34f55e9..c2a39d0 100644
--- a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
+++ b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
@@ -166,11 +166,7 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="httpMethod">The HTTP method that the incoming request came in on, whether or not <paramref name="message"/> is null.</param>
internal HttpRequestInfo(IDirectedProtocolMessage message, HttpDeliveryMethods httpMethod) {
this.message = message;
- if ((httpMethod & HttpDeliveryMethods.GetRequest) != 0) {
- this.HttpMethod = "GET";
- } else if ((httpMethod & HttpDeliveryMethods.PostRequest) != 0) {
- this.HttpMethod = "POST";
- }
+ this.HttpMethod = MessagingUtilities.GetHttpVerb(httpMethod);
}
/// <summary>
@@ -338,12 +334,11 @@ namespace DotNetOpenAuth.Messaging {
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.");
UriBuilder publicRequestUri = new UriBuilder(request.Url);
- string[] hostAndPort = request.ServerVariables["HTTP_HOST"].Split(new[] { ':' }, 2);
- publicRequestUri.Host = hostAndPort[0];
- if (hostAndPort.Length > 1) {
- publicRequestUri.Port = Convert.ToInt32(hostAndPort[1], CultureInfo.InvariantCulture);
- } else {
- publicRequestUri.Port = publicRequestUri.Scheme == Uri.UriSchemeHttps ? 443 : 80;
+ Uri hostAndPort = new Uri(request.Url.Scheme + Uri.SchemeDelimiter + request.ServerVariables["HTTP_HOST"]);
+ publicRequestUri.Host = hostAndPort.Host;
+ publicRequestUri.Port = hostAndPort.Port;
+ if (request.ServerVariables["HTTP_X_FORWARDED_PROTO"] != null) {
+ publicRequestUri.Scheme = request.ServerVariables["HTTP_X_FORWARDED_PROTO"];
}
return publicRequestUri.Uri;
} else {