From eb70a6419c94dd35495c8178ff070ba7b63ffdfc Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Thu, 17 Mar 2016 07:53:23 +0100 Subject: [PATCH] Fixed: Not uploading nzbs to Nzbget on linux since previous develop. --- src/NzbDrone.Common/Http/Dispatchers/CurlHttpDispatcher.cs | 4 +++- .../Http/Dispatchers/ManagedHttpDispatcher.cs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common/Http/Dispatchers/CurlHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/CurlHttpDispatcher.cs index 745894ac1..3b9583b66 100644 --- a/src/NzbDrone.Common/Http/Dispatchers/CurlHttpDispatcher.cs +++ b/src/NzbDrone.Common/Http/Dispatchers/CurlHttpDispatcher.cs @@ -43,7 +43,9 @@ public HttpResponse GetResponse(HttpRequest request, CookieContainer cookies) if (request.NetworkCredential != null) { - throw new NotImplementedException("Credentials not supported for curl dispatcher."); + var authInfo = request.NetworkCredential.UserName + ":" + request.NetworkCredential.Password; + authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); + request.Headers["Authorization"] = "Basic " + authInfo; } lock (CurlGlobalHandle.Instance) diff --git a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs index d563242df..eb735bf7a 100644 --- a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs +++ b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs @@ -23,6 +23,11 @@ public HttpResponse GetResponse(HttpRequest request, CookieContainer cookies) webRequest.ContentLength = 0; webRequest.CookieContainer = cookies; + if (request.NetworkCredential != null) + { + webRequest.PreAuthenticate = true; + } + if (request.RequestTimeout != TimeSpan.Zero) { webRequest.Timeout = (int)Math.Ceiling(request.RequestTimeout.TotalMilliseconds);