diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-21 18:19:23 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-21 18:19:23 -0800 |
commit | d6f93f8ae827f6778c586dbcee21124ef6bbe47d (patch) | |
tree | 5e8b50786b5da6258f7d072aa5590b95e99fb0c3 /src | |
parent | fc93c242c225f1fed31c9b37ddf80bd38a7b27d4 (diff) | |
download | DotNetOpenAuth-d6f93f8ae827f6778c586dbcee21124ef6bbe47d.zip DotNetOpenAuth-d6f93f8ae827f6778c586dbcee21124ef6bbe47d.tar.gz DotNetOpenAuth-d6f93f8ae827f6778c586dbcee21124ef6bbe47d.tar.bz2 |
Reporting HTTP result can now include a message that gets logged for the webmaster to review.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Reporting.cs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth/Reporting.cs b/src/DotNetOpenAuth/Reporting.cs index 5744cbb..a32945a 100644 --- a/src/DotNetOpenAuth/Reporting.cs +++ b/src/DotNetOpenAuth/Reporting.cs @@ -324,7 +324,26 @@ namespace DotNetOpenAuth { } using (var response = webRequestHandler.GetResponse(request)) { - // Currently we have no interest in the response stream content. + Logger.Library.Info("Statistical report submitted successfully."); + + // The response stream may contain a message for the webmaster. + // Since as part of the report we submit the library version number, + // the report receiving service may have alerts such as: + // "You're using an obsolete version with exploitable security vulnerabilities." + using (var responseReader = response.GetResponseReader()) { + string line = responseReader.ReadLine(); + if (line != null) { + if (line.StartsWith("INFO ")) { + Logger.Library.Info(line.Substring(5)); + } if (line.StartsWith("WARN ")) { + Logger.Library.Warn(line.Substring(5)); + } else if (line.StartsWith("ERROR ")) { + Logger.Library.Warn(line.Substring(6)); + } else if (line.StartsWith("FATAL ")) { + Logger.Library.Fatal(line.Substring(6)); + } + } + } } // Report submission was successful. Reset all counters. @@ -337,9 +356,9 @@ namespace DotNetOpenAuth { return true; } catch (ProtocolException ex) { - Logger.Library.Error("Unable to submit report due to an HTTP error.", ex); + Logger.Library.Error("Unable to submit statistical report due to an HTTP error.", ex); } catch (FileNotFoundException ex) { - Logger.Library.Error("Unable to submit report because the report file is missing.", ex); + Logger.Library.Error("Unable to submit statistical report because the report file is missing.", ex); } return false; |