diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-20 19:18:00 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-20 19:18:00 -0700 |
commit | f7fa44d6001b0c104cbf209cd7455e536e02cbe9 (patch) | |
tree | f6739f0963a031b3d7155719a7dd302bab383666 /src/DotNetOAuth/Messaging/Channel.cs | |
parent | c9304587876374c2866f44135cf24372f432a77d (diff) | |
parent | f7326ec97ead94425cf8b22d0aea5f7bf67ebc8f (diff) | |
download | DotNetOpenAuth-f7fa44d6001b0c104cbf209cd7455e536e02cbe9.zip DotNetOpenAuth-f7fa44d6001b0c104cbf209cd7455e536e02cbe9.tar.gz DotNetOpenAuth-f7fa44d6001b0c104cbf209cd7455e536e02cbe9.tar.bz2 |
Merge branch 'sersync'
Diffstat (limited to 'src/DotNetOAuth/Messaging/Channel.cs')
-rw-r--r-- | src/DotNetOAuth/Messaging/Channel.cs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/DotNetOAuth/Messaging/Channel.cs b/src/DotNetOAuth/Messaging/Channel.cs index aebf6e4..db6cc10 100644 --- a/src/DotNetOAuth/Messaging/Channel.cs +++ b/src/DotNetOAuth/Messaging/Channel.cs @@ -15,6 +15,8 @@ namespace DotNetOAuth.Messaging { using System.Net;
using System.Text;
using System.Web;
+ using DotNetOAuth.Messaging.Reflection;
+ using DotNetOAuth.Messaging.Bindings;
/// <summary>
/// Manages sending direct messages to a remote party and receiving responses.
@@ -179,7 +181,10 @@ namespace DotNetOAuth.Messaging { /// <returns>The deserialized message, if one is found. Null otherwise.</returns>
protected internal IProtocolMessage ReadFromRequest(HttpRequestInfo httpRequest) {
IProtocolMessage requestMessage = this.ReadFromRequestInternal(httpRequest);
- this.VerifyMessageAfterReceiving(requestMessage);
+ if (requestMessage != null) {
+ this.VerifyMessageAfterReceiving(requestMessage);
+ }
+
return requestMessage;
}
@@ -497,6 +502,9 @@ namespace DotNetOAuth.Messaging { if ((message.RequiredProtection & appliedProtection) != message.RequiredProtection) {
throw new UnprotectedMessageException(message, appliedProtection);
}
+
+ EnsureValidMessageParts(message);
+ message.EnsureValidMessage();
}
/// <summary>
@@ -521,6 +529,17 @@ namespace DotNetOAuth.Messaging { if ((message.RequiredProtection & appliedProtection) != message.RequiredProtection) {
throw new UnprotectedMessageException(message, appliedProtection);
}
+
+ EnsureValidMessageParts(message);
+ message.EnsureValidMessage();
+ }
+
+ private void EnsureValidMessageParts(IProtocolMessage message) {
+ Debug.Assert(message != null, "message == null");
+
+ MessageDictionary dictionary = new MessageDictionary(message);
+ MessageDescription description = MessageDescription.Get(message.GetType());
+ description.EnsureRequiredMessagePartsArePresent(dictionary.Keys);
}
}
}
|