{"action":"created","comment":{"url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/54844871","id":54844871,"diff_hunk":"@@ -157,134 +159,134 @@ public void SetLabel(string hash, string label, DelugeSettings settings)\n             ProcessRequest<object>(settings, \"label.set_torrent\", hash, label);\n         }\n \n-        protected DelugeResponse<TResult> ProcessRequest<TResult>(DelugeSettings settings, string action, params object[] arguments)\n+        private JsonRpcRequestBuilder BuildRequest(DelugeSettings settings)\n         {\n-            var client = BuildClient(settings);\n-\n-            DelugeResponse<TResult> response;\n+            var protocol = settings.UseSsl ? \"https\" : \"http\";\n \n-            try\n+            string url;\n+            if (!settings.UrlBase.IsNullOrWhiteSpace())\n             {\n-                response = ProcessRequest<TResult>(client, action, arguments);\n+                url = string.Format(@\"{0}://{1}:{2}/{3}/json\", protocol, settings.Host, settings.Port, settings.UrlBase.Trim('/'));\n             }\n-            catch (WebException ex)\n+            else\n             {\n-                if (ex.Status == WebExceptionStatus.Timeout)\n-                {\n-                    _logger.Debug(\"Deluge timeout during request, daemon connection may have been broken. Attempting to reconnect.\");\n-                    response = new DelugeResponse<TResult>();\n-                    response.Error = new DelugeError();\n-                    response.Error.Code = 2;\n-                }\n-                else\n-                {\n-                    throw;\n-                }\n+                url = string.Format(@\"{0}://{1}:{2}/json\", protocol, settings.Host, settings.Port);\n             }\n \n+            var builder = new JsonRpcRequestBuilder(url);\n+\n+            var httpRequest = new HttpRequest(url, HttpAccept.Json);\n+\n+#warning FIXME: Had a 15sec timeout.\n+            //restClient.Timeout = 15000;","path":"src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs","position":169,"original_position":169,"commit_id":"a75480aa782be3ed85c4c8a188539027e978f7c6","original_commit_id":"a75480aa782be3ed85c4c8a188539027e978f7c6","user":{"login":"Taloth","id":6383890,"avatar_url":"https://avatars.githubusercontent.com/u/6383890?v=3","gravatar_id":"","url":"https://api.github.com/users/Taloth","html_url":"https://github.com/Taloth","followers_url":"https://api.github.com/users/Taloth/followers","following_url":"https://api.github.com/users/Taloth/following{/other_user}","gists_url":"https://api.github.com/users/Taloth/gists{/gist_id}","starred_url":"https://api.github.com/users/Taloth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Taloth/subscriptions","organizations_url":"https://api.github.com/users/Taloth/orgs","repos_url":"https://api.github.com/users/Taloth/repos","events_url":"https://api.github.com/users/Taloth/events{/privacy}","received_events_url":"https://api.github.com/users/Taloth/received_events","type":"User","site_admin":false},"body":"Euh, no, coz HttpClient/Request doesn't hav a Timeout parameter (yet).","created_at":"2016-03-03T07:38:13Z","updated_at":"2016-03-03T07:38:13Z","html_url":"https://github.com/Sonarr/Sonarr/pull/1166#discussion_r54844871","pull_request_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166","_links":{"self":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/54844871"},"html":{"href":"https://github.com/Sonarr/Sonarr/pull/1166#discussion_r54844871"},"pull_request":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166"}}},"pull_request":{"url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166","id":61451717,"html_url":"https://github.com/Sonarr/Sonarr/pull/1166","diff_url":"https://github.com/Sonarr/Sonarr/pull/1166.diff","patch_url":"https://github.com/Sonarr/Sonarr/pull/1166.patch","issue_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1166","number":1166,"state":"open","locked":false,"title":"Deprecating RestSharp in Download Clients","user":{"login":"Taloth","id":6383890,"avatar_url":"https://avatars.githubusercontent.com/u/6383890?v=3","gravatar_id":"","url":"https://api.github.com/users/Taloth","html_url":"https://github.com/Taloth","followers_url":"https://api.github.com/users/Taloth/followers","following_url":"https://api.github.com/users/Taloth/following{/other_user}","gists_url":"https://api.github.com/users/Taloth/gists{/gist_id}","starred_url":"https://api.github.com/users/Taloth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Taloth/subscriptions","organizations_url":"https://api.github.com/users/Taloth/orgs","repos_url":"https://api.github.com/users/Taloth/repos","events_url":"https://api.github.com/users/Taloth/events{/privacy}","received_events_url":"https://api.github.com/users/Taloth/received_events","type":"User","site_admin":false},"body":"@kayone @markus101 \r\n\r\nLots of stuff happening here. Isolated several big chunks into separate commits.\r\n\r\nI'm generally happy with how most of the stuff is now in HttpRequestBuilder. And curl post works, so that's nice too.\r\n\r\nAddFormParameter & AddFormUpload, converted to a neat multipart formdata.\r\n\r\nI also removed Uri and replaced it with a custom HttpUri, at one point I started to wonder if that was smart. There might be odd urls I handle wrong. But I was kinda pissed off at Uri for it's weird behavior. At first I just wanted to encapsulate Uri, so I could prevent ppl from using the wrong methods (ToString() & AbsoluteUri), but eventually opted to roll my own.\r\n\r\nLemme know what you think and feel free to shoot at it.\r\n\r\nProxies using RestSharp:\r\n\r\n- [x] Sabnzbd\r\n- [x] NzbGet\r\n- [x] Deluge\r\n- [x] QbitTorrent\r\n- [ ] NzbVortexProxy\r\n- [x] TransmissionProxy\r\n- [x] UtorrentProxy\r\n\r\nThere are also several notifications using RestSharp, not sure if we should update those too. And finally the integration tests are using RestSharp.","created_at":"2016-03-02T19:18:13Z","updated_at":"2016-03-03T07:38:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22eaacfbeda301764cd40f93aa8cc55c96d72e7f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166/commits","review_comments_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166/comments","review_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1166/comments","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/a75480aa782be3ed85c4c8a188539027e978f7c6","head":{"label":"Sonarr:qbittorrent-http-client","ref":"qbittorrent-http-client","sha":"a75480aa782be3ed85c4c8a188539027e978f7c6","user":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"repo":{"id":2465723,"name":"Sonarr","full_name":"Sonarr/Sonarr","owner":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sonarr/Sonarr","description":"Smart PVR for newsgroup and bittorrent users.","fork":false,"url":"https://api.github.com/repos/Sonarr/Sonarr","forks_url":"https://api.github.com/repos/Sonarr/Sonarr/forks","keys_url":"https://api.github.com/repos/Sonarr/Sonarr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sonarr/Sonarr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sonarr/Sonarr/teams","hooks_url":"https://api.github.com/repos/Sonarr/Sonarr/hooks","issue_events_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/events{/number}","events_url":"https://api.github.com/repos/Sonarr/Sonarr/events","assignees_url":"https://api.github.com/repos/Sonarr/Sonarr/assignees{/user}","branches_url":"https://api.github.com/repos/Sonarr/Sonarr/branches{/branch}","tags_url":"https://api.github.com/repos/Sonarr/Sonarr/tags","blobs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sonarr/Sonarr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sonarr/Sonarr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/{sha}","languages_url":"https://api.github.com/repos/Sonarr/Sonarr/languages","stargazers_url":"https://api.github.com/repos/Sonarr/Sonarr/stargazers","contributors_url":"https://api.github.com/repos/Sonarr/Sonarr/contributors","subscribers_url":"https://api.github.com/repos/Sonarr/Sonarr/subscribers","subscription_url":"https://api.github.com/repos/Sonarr/Sonarr/subscription","commits_url":"https://api.github.com/repos/Sonarr/Sonarr/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sonarr/Sonarr/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sonarr/Sonarr/contents/{+path}","compare_url":"https://api.github.com/repos/Sonarr/Sonarr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sonarr/Sonarr/merges","archive_url":"https://api.github.com/repos/Sonarr/Sonarr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sonarr/Sonarr/downloads","issues_url":"https://api.github.com/repos/Sonarr/Sonarr/issues{/number}","pulls_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls{/number}","milestones_url":"https://api.github.com/repos/Sonarr/Sonarr/milestones{/number}","notifications_url":"https://api.github.com/repos/Sonarr/Sonarr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sonarr/Sonarr/labels{/name}","releases_url":"https://api.github.com/repos/Sonarr/Sonarr/releases{/id}","deployments_url":"https://api.github.com/repos/Sonarr/Sonarr/deployments","created_at":"2011-09-27T05:57:16Z","updated_at":"2016-03-03T04:51:46Z","pushed_at":"2016-03-02T21:37:27Z","git_url":"git://github.com/Sonarr/Sonarr.git","ssh_url":"git@github.com:Sonarr/Sonarr.git","clone_url":"https://github.com/Sonarr/Sonarr.git","svn_url":"https://github.com/Sonarr/Sonarr","homepage":"https://sonarr.tv","size":224607,"stargazers_count":1279,"watchers_count":1279,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":315,"mirror_url":null,"open_issues_count":408,"forks":315,"open_issues":408,"watchers":1279,"default_branch":"develop"}},"base":{"label":"Sonarr:develop","ref":"develop","sha":"47446515d1fa6bf5ffc2250ece58c0cfdb55c7b3","user":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"repo":{"id":2465723,"name":"Sonarr","full_name":"Sonarr/Sonarr","owner":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sonarr/Sonarr","description":"Smart PVR for newsgroup and bittorrent users.","fork":false,"url":"https://api.github.com/repos/Sonarr/Sonarr","forks_url":"https://api.github.com/repos/Sonarr/Sonarr/forks","keys_url":"https://api.github.com/repos/Sonarr/Sonarr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sonarr/Sonarr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sonarr/Sonarr/teams","hooks_url":"https://api.github.com/repos/Sonarr/Sonarr/hooks","issue_events_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/events{/number}","events_url":"https://api.github.com/repos/Sonarr/Sonarr/events","assignees_url":"https://api.github.com/repos/Sonarr/Sonarr/assignees{/user}","branches_url":"https://api.github.com/repos/Sonarr/Sonarr/branches{/branch}","tags_url":"https://api.github.com/repos/Sonarr/Sonarr/tags","blobs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sonarr/Sonarr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sonarr/Sonarr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/{sha}","languages_url":"https://api.github.com/repos/Sonarr/Sonarr/languages","stargazers_url":"https://api.github.com/repos/Sonarr/Sonarr/stargazers","contributors_url":"https://api.github.com/repos/Sonarr/Sonarr/contributors","subscribers_url":"https://api.github.com/repos/Sonarr/Sonarr/subscribers","subscription_url":"https://api.github.com/repos/Sonarr/Sonarr/subscription","commits_url":"https://api.github.com/repos/Sonarr/Sonarr/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sonarr/Sonarr/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sonarr/Sonarr/contents/{+path}","compare_url":"https://api.github.com/repos/Sonarr/Sonarr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sonarr/Sonarr/merges","archive_url":"https://api.github.com/repos/Sonarr/Sonarr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sonarr/Sonarr/downloads","issues_url":"https://api.github.com/repos/Sonarr/Sonarr/issues{/number}","pulls_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls{/number}","milestones_url":"https://api.github.com/repos/Sonarr/Sonarr/milestones{/number}","notifications_url":"https://api.github.com/repos/Sonarr/Sonarr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sonarr/Sonarr/labels{/name}","releases_url":"https://api.github.com/repos/Sonarr/Sonarr/releases{/id}","deployments_url":"https://api.github.com/repos/Sonarr/Sonarr/deployments","created_at":"2011-09-27T05:57:16Z","updated_at":"2016-03-03T04:51:46Z","pushed_at":"2016-03-02T21:37:27Z","git_url":"git://github.com/Sonarr/Sonarr.git","ssh_url":"git@github.com:Sonarr/Sonarr.git","clone_url":"https://github.com/Sonarr/Sonarr.git","svn_url":"https://github.com/Sonarr/Sonarr","homepage":"https://sonarr.tv","size":224607,"stargazers_count":1279,"watchers_count":1279,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":315,"mirror_url":null,"open_issues_count":408,"forks":315,"open_issues":408,"watchers":1279,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166"},"html":{"href":"https://github.com/Sonarr/Sonarr/pull/1166"},"issue":{"href":"https://api.github.com/repos/Sonarr/Sonarr/issues/1166"},"comments":{"href":"https://api.github.com/repos/Sonarr/Sonarr/issues/1166/comments"},"review_comments":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166/comments"},"review_comment":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/1166/commits"},"statuses":{"href":"https://api.github.com/repos/Sonarr/Sonarr/statuses/a75480aa782be3ed85c4c8a188539027e978f7c6"}}}}