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 @@ namespace NzbDrone.Common.Http.Dispatchers
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.Collections.Generic;
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 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
{
var request = BuildRequest(settings).Resource("/command/download")
.Post()
.AddQueryParam("urls", torrentUrl);
.AddFormParameter("urls", torrentUrl);
ProcessRequest<object>(request, settings);
}
@ -168,6 +169,11 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
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 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
_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