1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Adding magnet to qbit should use FormData not QueryParam.

This commit is contained in:
Taloth Saldono 2016-03-17 19:49:05 +01:00
parent d68ad98176
commit 70494c3674
2 changed files with 11 additions and 6 deletions

View File

@ -20,7 +20,6 @@ public HttpResponse GetResponse(HttpRequest request, CookieContainer cookies)
webRequest.UserAgent = UserAgentBuilder.UserAgent;
webRequest.KeepAlive = false;
webRequest.AllowAutoRedirect = request.AllowAutoRedirect;
webRequest.ContentLength = 0;
webRequest.CookieContainer = cookies;
if (request.NetworkCredential != null)

View File

@ -3,6 +3,7 @@
using System.Net;
using NLog;
using NzbDrone.Common.Cache;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
@ -68,7 +69,7 @@ public void AddTorrentFromUrl(string torrentUrl, QBittorrentSettings settings)
{
var request = BuildRequest(settings).Resource("/command/download")
.Post()
.AddQueryParam("urls", torrentUrl);
.AddFormParameter("urls", torrentUrl);
ProcessRequest<object>(request, settings);
}
@ -168,6 +169,11 @@ private TResult ProcessRequest<TResult>(HttpRequestBuilder requestBuilder, QBitt
private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSettings settings, bool reauthenticate = false)
{
if (settings.Username.IsNullOrWhiteSpace() || settings.Password.IsNullOrWhiteSpace())
{
return;
}
var authKey = string.Format("{0}:{1}", requestBuilder.BaseUrl, settings.Password);
var cookies = _authCookieCache.Find(authKey);
@ -177,10 +183,10 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
_authCookieCache.Remove(authKey);
var authLoginRequest = BuildRequest(settings).Resource("/login")
.Post()
.AddFormParameter("username", settings.Username)
.AddFormParameter("password", settings.Password)
.Build();
.Post()
.AddFormParameter("username", settings.Username ?? string.Empty)
.AddFormParameter("password", settings.Password ?? string.Empty)
.Build();
HttpResponse response;
try