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.UserAgent = UserAgentBuilder.UserAgent;
webRequest.KeepAlive = false; webRequest.KeepAlive = false;
webRequest.AllowAutoRedirect = request.AllowAutoRedirect; webRequest.AllowAutoRedirect = request.AllowAutoRedirect;
webRequest.ContentLength = 0;
webRequest.CookieContainer = cookies; webRequest.CookieContainer = cookies;
if (request.NetworkCredential != null) if (request.NetworkCredential != null)

View File

@ -3,6 +3,7 @@
using System.Net; using System.Net;
using NLog; using NLog;
using NzbDrone.Common.Cache; using NzbDrone.Common.Cache;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
@ -68,7 +69,7 @@ public void AddTorrentFromUrl(string torrentUrl, QBittorrentSettings settings)
{ {
var request = BuildRequest(settings).Resource("/command/download") var request = BuildRequest(settings).Resource("/command/download")
.Post() .Post()
.AddQueryParam("urls", torrentUrl); .AddFormParameter("urls", torrentUrl);
ProcessRequest<object>(request, settings); 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) 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 authKey = string.Format("{0}:{1}", requestBuilder.BaseUrl, settings.Password);
var cookies = _authCookieCache.Find(authKey); var cookies = _authCookieCache.Find(authKey);
@ -178,8 +184,8 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
var authLoginRequest = BuildRequest(settings).Resource("/login") var authLoginRequest = BuildRequest(settings).Resource("/login")
.Post() .Post()
.AddFormParameter("username", settings.Username) .AddFormParameter("username", settings.Username ?? string.Empty)
.AddFormParameter("password", settings.Password) .AddFormParameter("password", settings.Password ?? string.Empty)
.Build(); .Build();
HttpResponse response; HttpResponse response;