mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
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:
parent
1a97204be3
commit
6ceef4f65e
14 changed files with 267 additions and 60 deletions
|
@ -281,6 +281,28 @@ namespace GreenshotPlugin.Core {
|
|||
formDataStream.Write(Encoding.UTF8.GetBytes(footer), 0, Encoding.UTF8.GetByteCount(footer));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process the web response.
|
||||
/// </summary>
|
||||
/// <param name="webRequest">The request object.</param>
|
||||
/// <returns>The response data.</returns>
|
||||
public static string GetResponse(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, true).ReadToEnd());
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return responseData;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue