summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId/UntrustedWebResponse.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-12-28 08:18:35 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-12-28 08:18:35 -0800
commitd855f2c295e0bbb7a3b73f8dfc933a539c2a2efe (patch)
tree6d309115c206711a6e6a7bba33ac45a7eaddf9f7 /src/DotNetOpenId/UntrustedWebResponse.cs
parent66f7179ed6fa8bc8bcd7e831ebb8ac4548067d85 (diff)
parent360a625667a5e3fcb169710dd35536fc32df8759 (diff)
downloadDotNetOpenAuth-origin/v2.6.zip
DotNetOpenAuth-origin/v2.6.tar.gz
DotNetOpenAuth-origin/v2.6.tar.bz2
Merge branch 'v2.5' into v2.6origin/v2.6
Conflicts: src/version.txt
Diffstat (limited to 'src/DotNetOpenId/UntrustedWebResponse.cs')
-rw-r--r--src/DotNetOpenId/UntrustedWebResponse.cs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/DotNetOpenId/UntrustedWebResponse.cs b/src/DotNetOpenId/UntrustedWebResponse.cs
index 5214114..0834125 100644
--- a/src/DotNetOpenId/UntrustedWebResponse.cs
+++ b/src/DotNetOpenId/UntrustedWebResponse.cs
@@ -21,18 +21,24 @@ namespace DotNetOpenId {
public Uri RequestUri { get; private set; }
public Uri FinalUri { get; private set; }
- public UntrustedWebResponse(Uri requestUri, HttpWebResponse response, Stream responseStream) {
+ public UntrustedWebResponse(Uri requestUri, Uri finalRequestUri, HttpWebResponse response, Stream responseStream) {
if (requestUri == null) throw new ArgumentNullException("requestUri");
+ if (finalRequestUri == null) throw new ArgumentNullException("finalRequestUri");
if (response == null) throw new ArgumentNullException("response");
if (responseStream == null) throw new ArgumentNullException("responseStream");
this.RequestUri = requestUri;
this.ResponseStream = responseStream;
StatusCode = response.StatusCode;
- if (!string.IsNullOrEmpty(response.ContentType))
- ContentType = new ContentType(response.ContentType);
+ if (!string.IsNullOrEmpty(response.ContentType)) {
+ try {
+ ContentType = new ContentType(response.ContentType);
+ } catch (FormatException) {
+ Logger.ErrorFormat("HTTP response to {0} included an invalid Content-Type header value: {1}", response.ResponseUri.AbsoluteUri, response.ContentType);
+ }
+ }
ContentEncoding = string.IsNullOrEmpty(response.ContentEncoding) ? DefaultContentEncoding : response.ContentEncoding;
Headers = response.Headers;
- FinalUri = response.ResponseUri;
+ FinalUri = finalRequestUri;
}
/// <summary>
@@ -45,8 +51,13 @@ namespace DotNetOpenId {
RequestUri = requestUri;
ResponseStream = responseStream;
StatusCode = statusCode;
- if (!string.IsNullOrEmpty(contentType))
- ContentType = new ContentType(contentType);
+ if (!string.IsNullOrEmpty(contentType)) {
+ try {
+ ContentType = new ContentType(contentType);
+ } catch (FormatException) {
+ Logger.ErrorFormat("HTTP response to {0} included an invalid Content-Type header value: {1}", responseUri.AbsoluteUri, contentType);
+ }
+ }
ContentEncoding = string.IsNullOrEmpty(contentEncoding) ? DefaultContentEncoding : contentEncoding;
Headers = headers;
FinalUri = responseUri;