mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 17:13:44 -07:00
Moved some code around, for better re-usage. Also added some debug information, and wrote some comments. [skip ci]
This commit is contained in:
parent
6f8434d46f
commit
ea8c27449f
4 changed files with 196 additions and 160 deletions
|
@ -336,6 +336,20 @@ namespace GreenshotPlugin.Core {
|
|||
return GetResponse(webRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log the headers of the WebResponse, if IsDebugEnabled
|
||||
/// </summary>
|
||||
/// <param name="response">WebResponse</param>
|
||||
private static void DebugHeaders(WebResponse response) {
|
||||
if (!LOG.IsDebugEnabled) {
|
||||
return;
|
||||
}
|
||||
LOG.DebugFormat("Debug information on the response from {0} :", response.ResponseUri);
|
||||
foreach (string key in response.Headers.AllKeys) {
|
||||
LOG.DebugFormat("Reponse-header: {0}={1}", key, response.Headers[key]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process the web response.
|
||||
/// </summary>
|
||||
|
@ -348,6 +362,7 @@ namespace GreenshotPlugin.Core {
|
|||
HttpWebResponse response = (HttpWebResponse) webRequest.GetResponse();
|
||||
LOG.InfoFormat("Response status: {0}", response.StatusCode);
|
||||
bool isHttpError = (int) response.StatusCode >= 300;
|
||||
DebugHeaders(response);
|
||||
Stream responseStream = response.GetResponseStream();
|
||||
if (responseStream != null) {
|
||||
using (StreamReader reader = new StreamReader(responseStream, true)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue