|
|
@ -93,35 +93,12 @@ namespace NzbDrone.Common
|
|
|
|
|
|
|
|
|
|
|
|
byte[] byteArray = Encoding.ASCII.GetBytes(command);
|
|
|
|
byte[] byteArray = Encoding.ASCII.GetBytes(command);
|
|
|
|
|
|
|
|
|
|
|
|
var request = (HttpWebRequest)WebRequest.Create(address);
|
|
|
|
var wc = new WebClient();
|
|
|
|
request.Method = "POST";
|
|
|
|
wc.Credentials = new NetworkCredential(username, password);
|
|
|
|
request.Credentials = new NetworkCredential(username, password);
|
|
|
|
var response = wc.UploadData(address, "POST", byteArray);
|
|
|
|
request.ContentType = "application/json";
|
|
|
|
var text = Encoding.ASCII.GetString(response);
|
|
|
|
request.Timeout = 20000;
|
|
|
|
|
|
|
|
request.KeepAlive = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Used to hold the JSON response
|
|
|
|
return text.Replace(" ", " ");
|
|
|
|
string responseFromServer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var requestStream = request.GetRequestStream())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
requestStream.Write(byteArray, 0, byteArray.Length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var response = request.GetResponse())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (var responseStream = response.GetResponseStream())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (var reader = new StreamReader(responseStream))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
responseFromServer = reader.ReadToEnd();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return responseFromServer.Replace(" ", " ");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|