diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-31 08:17:25 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-31 08:17:25 -0800 |
commit | 90b6aa8ba9d15e0254eccf05b73b24f334128654 (patch) | |
tree | 45676300b8dbd27931607958f1b66b4f288c259e /src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs | |
parent | 187d3c24b6a76ec0898399f738b3a4f82031ceb0 (diff) | |
download | DotNetOpenAuth-90b6aa8ba9d15e0254eccf05b73b24f334128654.zip DotNetOpenAuth-90b6aa8ba9d15e0254eccf05b73b24f334128654.tar.gz DotNetOpenAuth-90b6aa8ba9d15e0254eccf05b73b24f334128654.tar.bz2 |
Fixes build breaks in DNOA.OpenId.
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs')
-rw-r--r-- | src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs index 3da62e9..267b003 100644 --- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs @@ -378,6 +378,29 @@ namespace DotNetOpenAuth.Messaging { return GetPublicFacingUrl(request, request.ServerVariables); } + internal static void DisposeIfNotNull(this IDisposable disposable) { + if (disposable != null) { + disposable.Dispose(); + } + } + + internal static HttpRequestMessage Clone(this HttpRequestMessage original, Uri newRequestUri = null) { + Requires.NotNull(original, "original"); + + var clone = new HttpRequestMessage(original.Method, newRequestUri ?? original.RequestUri); + clone.Content = original.Content; + foreach (var header in original.Headers) { + clone.Headers.Add(header.Key, header.Value); + } + + foreach (var property in original.Properties) { + clone.Properties[property.Key] = property.Value; + } + + clone.Version = original.Version; + return clone; + } + /// <summary> /// Gets the URL to the root of a web site, which may include a virtual directory path. /// </summary> |