diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-01-26 16:49:29 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-26 16:51:40 -0800 |
commit | 61f0444b559ececbe29464cd3d79ed9c9baf6e56 (patch) | |
tree | d65a96ee4660b18f923f53094b16601f792da913 /src | |
parent | b8c94f9de8f2eb93629cef20e546dfa4a9e06611 (diff) | |
download | DotNetOpenAuth-61f0444b559ececbe29464cd3d79ed9c9baf6e56.zip DotNetOpenAuth-61f0444b559ececbe29464cd3d79ed9c9baf6e56.tar.gz DotNetOpenAuth-61f0444b559ececbe29464cd3d79ed9c9baf6e56.tar.bz2 |
Avoid copying HTTP headers that must be set via properties.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Messaging/MessagingUtilities.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs index 48922f6..b08c2b0 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs @@ -51,6 +51,8 @@ namespace DotNetOpenAuth.Messaging { { "=", @"\x3d" }, }; + private static readonly string[] HeadersToNotCopy = new string[] { "Host", "Connection" }; + /// <summary> /// Gets the original request URL, as seen from the browser before any URL rewrites on the server if any. /// Cookieless session directory (if applicable) is also included. @@ -299,7 +301,7 @@ namespace DotNetOpenAuth.Messaging { // of setting these properties, so as to avoid exceptions thrown because // there are properties .NET wants us to use rather than direct headers. foreach (string header in request.Headers) { - if (string.IsNullOrEmpty(newRequest.Headers[header])) { + if (!HeadersToNotCopy.Contains(header) && string.IsNullOrEmpty(newRequest.Headers[header])) { newRequest.Headers.Add(header, request.Headers[header]); } } |