Still fixing some issues with having the wrong Platform or Configuration, also moved some code to the NetworkHelper. Deleted a file which should not be there.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2137 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-10-11 13:59:58 +00:00
commit 6ceef4f65e
14 changed files with 267 additions and 60 deletions

View file

@ -566,35 +566,13 @@ namespace GreenshotPlugin.Core {
webRequest.ContentLength = 0;
}
string responseData = WebResponseGet(webRequest);
string responseData = NetworkHelper.GetResponse(webRequest);
LOG.DebugFormat("Response: {0}", responseData);
webRequest = null;
return responseData;
}
/// <summary>
/// Process the web response.
/// </summary>
/// <param name="webRequest">The request object.</param>
/// <returns>The response data.</returns>
protected string WebResponseGet(HttpWebRequest webRequest) {
string responseData;
try {
using (StreamReader reader = new StreamReader(webRequest.GetResponse().GetResponseStream(), true)) {
responseData = reader.ReadToEnd();
}
} catch (WebException e) {
HttpWebResponse response = (HttpWebResponse)e.Response;
using (Stream responseStream = response.GetResponseStream()) {
LOG.ErrorFormat("HTTP error {0} with content: {1}", response.StatusCode, new StreamReader(responseStream).ReadToEnd());
}
throw e;
}
return responseData;
}
}
}