summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId/RelyingParty/DirectRequest.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-05-26 23:15:21 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2008-05-26 23:15:21 -0700
commit24bcd4604eef4e77c0db3408df65ea3f7ff33e0e (patch)
tree2c7fddddd0351473966ecaa27cef9ec1836ab072 /src/DotNetOpenId/RelyingParty/DirectRequest.cs
parentea26f06c67848867d693c178335dad579e987154 (diff)
downloadDotNetOpenAuth-24bcd4604eef4e77c0db3408df65ea3f7ff33e0e.zip
DotNetOpenAuth-24bcd4604eef4e77c0db3408df65ea3f7ff33e0e.tar.gz
DotNetOpenAuth-24bcd4604eef4e77c0db3408df65ea3f7ff33e0e.tar.bz2
Breaking changes! OpenID indirect messages larger than 2KB are now sent via form POST instead of GET.
Refactored public API to allow for form POST responses. This scenario is not being tested.
Diffstat (limited to 'src/DotNetOpenId/RelyingParty/DirectRequest.cs')
-rw-r--r--src/DotNetOpenId/RelyingParty/DirectRequest.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/DotNetOpenId/RelyingParty/DirectRequest.cs b/src/DotNetOpenId/RelyingParty/DirectRequest.cs
index d9a8276..9b9d732 100644
--- a/src/DotNetOpenId/RelyingParty/DirectRequest.cs
+++ b/src/DotNetOpenId/RelyingParty/DirectRequest.cs
@@ -4,6 +4,7 @@ using System.Text;
using System.Net;
using System.Diagnostics;
using System.Globalization;
+using System.IO;
namespace DotNetOpenId.RelyingParty {
[DebuggerDisplay("OpenId: {Protocol.Version}")]
@@ -27,6 +28,14 @@ namespace DotNetOpenId.RelyingParty {
IDictionary<string, string> args = null;
try {
resp = UntrustedWebRequest.Request(Provider.ProviderEndpoint, body);
+ // If an internal server error occurred, there won't be any KV-form stream
+ // to read in. So instead, preserve whatever error the server did send back
+ // and throw it in the exception.
+ if (resp.StatusCode == HttpStatusCode.InternalServerError) {
+ string errorStream = new StreamReader(resp.ResponseStream).ReadToEnd();
+ throw new OpenIdException(string.Format(CultureInfo.CurrentCulture,
+ Strings.ProviderRespondedWithError, errorStream));
+ }
args = ProtocolMessages.KeyValueForm.GetDictionary(resp.ResponseStream);
} catch (ArgumentException e) {
throw new OpenIdException("Failure decoding Key-Value Form response from provider.", e);