summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Core/Messaging/Channel.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-02-19 20:21:31 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-02-19 20:21:31 -0800
commit061794ec18d2e3286194f6db849d9b3b0bedb7b3 (patch)
tree650eb0450a9540d77aec72d669761bd8be7bdb66 /src/DotNetOpenAuth.Core/Messaging/Channel.cs
parent4ae2b7675f436906c19c91e3d9605eae247d37f1 (diff)
downloadDotNetOpenAuth-061794ec18d2e3286194f6db849d9b3b0bedb7b3.zip
DotNetOpenAuth-061794ec18d2e3286194f6db849d9b3b0bedb7b3.tar.gz
DotNetOpenAuth-061794ec18d2e3286194f6db849d9b3b0bedb7b3.tar.bz2
Fixed up the various protocol channels to correctly apply HTTP headers prescribed by the messages.
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/Channel.cs')
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Channel.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/Channel.cs b/src/DotNetOpenAuth.Core/Messaging/Channel.cs
index 201d861..26a8179 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Channel.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Channel.cs
@@ -1038,6 +1038,22 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
+ /// Applies message prescribed HTTP response headers to an outgoing web response.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="response">The HTTP response.</param>
+ protected void ApplyMessageTemplate(IMessage message, OutgoingWebResponse response) {
+ Requires.NotNull(message, "message");
+ var httpMessage = message as IHttpDirectResponse;
+ if (httpMessage != null) {
+ response.Status = httpMessage.HttpStatusCode;
+ foreach (string headerName in httpMessage.Headers) {
+ response.Headers.Add(headerName, httpMessage.Headers[headerName]);
+ }
+ }
+ }
+
+ /// <summary>
/// Prepares to send a request to the Service Provider as the query string in a GET request.
/// </summary>
/// <param name="requestMessage">The message to be transmitted to the ServiceProvider.</param>