diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-05-04 14:12:43 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-05-04 14:12:43 -0700 |
commit | 25ad502db08fc517e41fe3419b5c8bc79e51a858 (patch) | |
tree | 67d2027fa37c85aaf600e72356cf8e4c0ae4f09d | |
parent | 2707e2c728f560e30e1559b266b6eb54ea2b1fee (diff) | |
download | DotNetOpenAuth-25ad502db08fc517e41fe3419b5c8bc79e51a858.zip DotNetOpenAuth-25ad502db08fc517e41fe3419b5c8bc79e51a858.tar.gz DotNetOpenAuth-25ad502db08fc517e41fe3419b5c8bc79e51a858.tar.bz2 |
Fixed bug where Authorization header POST requests would fail because of a missing Content-Length HTTP header.
-rw-r--r-- | src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs index 8bcae3e..42eb53b 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs @@ -319,10 +319,16 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { httpRequest.Headers.Add(HttpRequestHeader.Authorization, authorization.ToString()); - // WARNING: We only set up the request stream for the caller if there is - // extra data. If there isn't any extra data, the caller must do this themselves. - if (hasEntity && requestMessage.ExtraData.Count > 0) { - SendParametersInEntity(httpRequest, requestMessage.ExtraData); + if (hasEntity) { + // WARNING: We only set up the request stream for the caller if there is + // extra data. If there isn't any extra data, the caller must do this themselves. + if (requestMessage.ExtraData.Count > 0) { + SendParametersInEntity(httpRequest, requestMessage.ExtraData); + } else { + // We'll assume the content length is zero since the caller may not have + // anything. They're responsible to change it when the add the payload if they have one. + httpRequest.ContentLength = 0; + } } return httpRequest; |