{"action":"created","comment":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/48701767","id":48701767,"diff_hunk":"@@ -76,65 +77,62 @@ DNSUpdater::~DNSUpdater()\n void DNSUpdater::checkPublicIP()\n {\n     Q_ASSERT(m_state == OK);\n-    QNetworkAccessManager *manager = new QNetworkAccessManager(this);\n-    connect(manager, SIGNAL(finished(QNetworkReply *)), SLOT(ipRequestFinished(QNetworkReply *)));\n+\n+    DownloadHandler *handler = DownloadManager::instance()->downloadUrl(\n+                \"http://checkip.dyndns.org\", false, 0, false,\n+                QString(\"qBittorrent/%1\").arg(VERSION));\n+    connect(handler, SIGNAL(downloadFinished(QString,QByteArray)), SLOT(ipRequestFinished(QString,QByteArray)));\n+    connect(handler, SIGNAL(downloadFailed(QString,QString)), SLOT(ipRequestFailed(QString,QString)));\n+\n     m_lastIPCheckTime = QDateTime::currentDateTime();\n-    QNetworkRequest request;\n-    request.setUrl(QUrl(\"http://checkip.dyndns.org\"));\n-    request.setRawHeader(\"User-Agent\", \"qBittorrent/\" VERSION);\n-    manager->get(request);\n }\n \n-void DNSUpdater::ipRequestFinished(QNetworkReply *reply)\n+void DNSUpdater::ipRequestFinished(const QString &url, const QByteArray &data)\n {\n-    qDebug() << Q_FUNC_INFO;\n-    if (reply->error()) {\n-        // Error\n-        qWarning() << Q_FUNC_INFO << \"Error:\" << reply->errorString();\n-    }\n-    else {\n-        // Parse response\n-        QRegExp ipregex(\"Current IP Address:\\\\s+([^<]+)</body>\");\n-        QString ret = reply->readAll();\n-        if (ipregex.indexIn(ret) >= 0) {\n-            QString ip_str = ipregex.cap(1);\n-            qDebug() << Q_FUNC_INFO << \"Regular expression captured the following IP:\" << ip_str;\n-            QHostAddress new_ip(ip_str);\n-            if (!new_ip.isNull()) {\n-                if (m_lastIP != new_ip) {\n-                    qDebug() << Q_FUNC_INFO << \"The IP address changed, report the change to DynDNS...\";\n-                    qDebug() << m_lastIP.toString() << \"->\" << new_ip.toString();\n-                    m_lastIP = new_ip;\n-                    updateDNSService();\n-                }\n-            }\n-            else {\n-                qWarning() << Q_FUNC_INFO << \"Failed to construct a QHostAddress from the IP string\";\n+    Q_UNUSED(url);\n+\n+    // Parse response\n+    QRegExp ipregex(\"Current IP Address:\\\\s+([^<]+)</body>\");\n+    if (ipregex.indexIn(data) >= 0) {\n+        QString ipStr = ipregex.cap(1);\n+        qDebug() << Q_FUNC_INFO << \"Regular expression captured the following IP:\" << ipStr;\n+        QHostAddress newIp(ipStr);\n+        if (!newIp.isNull()) {\n+            if (m_lastIP != newIp) {\n+                qDebug() << Q_FUNC_INFO << \"The IP address changed, report the change to DynDNS...\";\n+                qDebug() << m_lastIP.toString() << \"->\" << newIp.toString();\n+                m_lastIP = newIp;\n+                updateDNSService();\n             }\n         }\n         else {\n-            qWarning() << Q_FUNC_INFO << \"Regular expression failed to capture the IP address\";\n+            qWarning() << Q_FUNC_INFO << \"Failed to construct a QHostAddress from the IP string\";\n         }\n     }\n-    // Clean up\n-    reply->deleteLater();\n-    sender()->deleteLater();\n+    else {\n+        qWarning() << Q_FUNC_INFO << \"Regular expression failed to capture the IP address\";\n+    }\n+}\n+\n+void DNSUpdater::ipRequestFailed(const QString &url, const QString &error)\n+{\n+    Q_UNUSED(url);\n+    qWarning() << \"IP request failed:\" << error;\n }\n \n void DNSUpdater::updateDNSService()\n {\n     qDebug() << Q_FUNC_INFO;\n-    // Prepare request\n-    QNetworkAccessManager *manager = new QNetworkAccessManager(this);\n-    connect(manager, SIGNAL(finished(QNetworkReply *)), SLOT(ipUpdateFinished(QNetworkReply *)));\n+\n     m_lastIPCheckTime = QDateTime::currentDateTime();\n-    QNetworkRequest request;\n-    request.setUrl(getUpdateUrl());\n-    request.setRawHeader(\"User-Agent\", \"qBittorrent/\" VERSION);\n-    manager->get(request);\n+    DownloadHandler *handler = DownloadManager::instance()->downloadUrl(\n+                getUpdateUrl(), false, 0, false,\n+                QString(\"qBittorrent/%1\").arg(VERSION));\n+    connect(handler, SIGNAL(downloadFinished(QString,QByteArray)), SLOT(ipUpdateFinished(QString,QByteArray)));\n+    connect(handler, SIGNAL(downloadFailed(QString,QString)), SLOT(ipUpdateFailed(QString,QString)));","path":"src/base/net/dnsupdater.cpp","position":114,"original_position":114,"commit_id":"5c1e40320d93573dec2f9e080ae96d785f8a4d23","original_commit_id":"5c1e40320d93573dec2f9e080ae96d785f8a4d23","user":{"login":"glassez","id":5063477,"avatar_url":"https://avatars.githubusercontent.com/u/5063477?v=3","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"body":"Fixed.","created_at":"2016-01-04T02:52:45Z","updated_at":"2016-01-04T02:52:45Z","html_url":"https://github.com/qbittorrent/qBittorrent/pull/4413#discussion_r48701767","pull_request_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413","_links":{"self":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/48701767"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/4413#discussion_r48701767"},"pull_request":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413"}}},"pull_request":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413","id":54130380,"html_url":"https://github.com/qbittorrent/qBittorrent/pull/4413","diff_url":"https://github.com/qbittorrent/qBittorrent/pull/4413.diff","patch_url":"https://github.com/qbittorrent/qBittorrent/pull/4413.patch","issue_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4413","number":4413,"state":"open","locked":false,"title":"Improve Download Manager. Closes #4305","user":{"login":"glassez","id":5063477,"avatar_url":"https://avatars.githubusercontent.com/u/5063477?v=3","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-18T17:47:53Z","updated_at":"2016-01-04T02:52:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a0e04e2763cd7bffe4a2b1e2dbe6949f6dc0459","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413/commits","review_comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413/comments","review_comment_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4413/comments","statuses_url":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/5c1e40320d93573dec2f9e080ae96d785f8a4d23","head":{"label":"glassez:dlmgr","ref":"dlmgr","sha":"5c1e40320d93573dec2f9e080ae96d785f8a4d23","user":{"login":"glassez","id":5063477,"avatar_url":"https://avatars.githubusercontent.com/u/5063477?v=3","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"repo":{"id":11788320,"name":"qBittorrent","full_name":"glassez/qBittorrent","owner":{"login":"glassez","id":5063477,"avatar_url":"https://avatars.githubusercontent.com/u/5063477?v=3","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glassez/qBittorrent","description":"qBittorrent BitTorrent client","fork":true,"url":"https://api.github.com/repos/glassez/qBittorrent","forks_url":"https://api.github.com/repos/glassez/qBittorrent/forks","keys_url":"https://api.github.com/repos/glassez/qBittorrent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glassez/qBittorrent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glassez/qBittorrent/teams","hooks_url":"https://api.github.com/repos/glassez/qBittorrent/hooks","issue_events_url":"https://api.github.com/repos/glassez/qBittorrent/issues/events{/number}","events_url":"https://api.github.com/repos/glassez/qBittorrent/events","assignees_url":"https://api.github.com/repos/glassez/qBittorrent/assignees{/user}","branches_url":"https://api.github.com/repos/glassez/qBittorrent/branches{/branch}","tags_url":"https://api.github.com/repos/glassez/qBittorrent/tags","blobs_url":"https://api.github.com/repos/glassez/qBittorrent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glassez/qBittorrent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glassez/qBittorrent/git/refs{/sha}","trees_url":"https://api.github.com/repos/glassez/qBittorrent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glassez/qBittorrent/statuses/{sha}","languages_url":"https://api.github.com/repos/glassez/qBittorrent/languages","stargazers_url":"https://api.github.com/repos/glassez/qBittorrent/stargazers","contributors_url":"https://api.github.com/repos/glassez/qBittorrent/contributors","subscribers_url":"https://api.github.com/repos/glassez/qBittorrent/subscribers","subscription_url":"https://api.github.com/repos/glassez/qBittorrent/subscription","commits_url":"https://api.github.com/repos/glassez/qBittorrent/commits{/sha}","git_commits_url":"https://api.github.com/repos/glassez/qBittorrent/git/commits{/sha}","comments_url":"https://api.github.com/repos/glassez/qBittorrent/comments{/number}","issue_comment_url":"https://api.github.com/repos/glassez/qBittorrent/issues/comments{/number}","contents_url":"https://api.github.com/repos/glassez/qBittorrent/contents/{+path}","compare_url":"https://api.github.com/repos/glassez/qBittorrent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glassez/qBittorrent/merges","archive_url":"https://api.github.com/repos/glassez/qBittorrent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glassez/qBittorrent/downloads","issues_url":"https://api.github.com/repos/glassez/qBittorrent/issues{/number}","pulls_url":"https://api.github.com/repos/glassez/qBittorrent/pulls{/number}","milestones_url":"https://api.github.com/repos/glassez/qBittorrent/milestones{/number}","notifications_url":"https://api.github.com/repos/glassez/qBittorrent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glassez/qBittorrent/labels{/name}","releases_url":"https://api.github.com/repos/glassez/qBittorrent/releases{/id}","created_at":"2013-07-31T10:19:53Z","updated_at":"2015-02-06T06:53:17Z","pushed_at":"2016-01-01T13:29:24Z","git_url":"git://github.com/glassez/qBittorrent.git","ssh_url":"git@github.com:glassez/qBittorrent.git","clone_url":"https://github.com/glassez/qBittorrent.git","svn_url":"https://github.com/glassez/qBittorrent","homepage":"http://www.qbittorrent.org","size":105972,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"qbittorrent:master","ref":"master","sha":"db459b240089ecd68583e087d5694fda6d732749","user":{"login":"qbittorrent","id":2131270,"avatar_url":"https://avatars.githubusercontent.com/u/2131270?v=3","gravatar_id":"","url":"https://api.github.com/users/qbittorrent","html_url":"https://github.com/qbittorrent","followers_url":"https://api.github.com/users/qbittorrent/followers","following_url":"https://api.github.com/users/qbittorrent/following{/other_user}","gists_url":"https://api.github.com/users/qbittorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/qbittorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbittorrent/subscriptions","organizations_url":"https://api.github.com/users/qbittorrent/orgs","repos_url":"https://api.github.com/users/qbittorrent/repos","events_url":"https://api.github.com/users/qbittorrent/events{/privacy}","received_events_url":"https://api.github.com/users/qbittorrent/received_events","type":"Organization","site_admin":false},"repo":{"id":3351871,"name":"qBittorrent","full_name":"qbittorrent/qBittorrent","owner":{"login":"qbittorrent","id":2131270,"avatar_url":"https://avatars.githubusercontent.com/u/2131270?v=3","gravatar_id":"","url":"https://api.github.com/users/qbittorrent","html_url":"https://github.com/qbittorrent","followers_url":"https://api.github.com/users/qbittorrent/followers","following_url":"https://api.github.com/users/qbittorrent/following{/other_user}","gists_url":"https://api.github.com/users/qbittorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/qbittorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbittorrent/subscriptions","organizations_url":"https://api.github.com/users/qbittorrent/orgs","repos_url":"https://api.github.com/users/qbittorrent/repos","events_url":"https://api.github.com/users/qbittorrent/events{/privacy}","received_events_url":"https://api.github.com/users/qbittorrent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qbittorrent/qBittorrent","description":"qBittorrent BitTorrent client","fork":false,"url":"https://api.github.com/repos/qbittorrent/qBittorrent","forks_url":"https://api.github.com/repos/qbittorrent/qBittorrent/forks","keys_url":"https://api.github.com/repos/qbittorrent/qBittorrent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qbittorrent/qBittorrent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qbittorrent/qBittorrent/teams","hooks_url":"https://api.github.com/repos/qbittorrent/qBittorrent/hooks","issue_events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/events{/number}","events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/events","assignees_url":"https://api.github.com/repos/qbittorrent/qBittorrent/assignees{/user}","branches_url":"https://api.github.com/repos/qbittorrent/qBittorrent/branches{/branch}","tags_url":"https://api.github.com/repos/qbittorrent/qBittorrent/tags","blobs_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/refs{/sha}","trees_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/{sha}","languages_url":"https://api.github.com/repos/qbittorrent/qBittorrent/languages","stargazers_url":"https://api.github.com/repos/qbittorrent/qBittorrent/stargazers","contributors_url":"https://api.github.com/repos/qbittorrent/qBittorrent/contributors","subscribers_url":"https://api.github.com/repos/qbittorrent/qBittorrent/subscribers","subscription_url":"https://api.github.com/repos/qbittorrent/qBittorrent/subscription","commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/commits{/sha}","git_commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/commits{/sha}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/comments{/number}","issue_comment_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/comments{/number}","contents_url":"https://api.github.com/repos/qbittorrent/qBittorrent/contents/{+path}","compare_url":"https://api.github.com/repos/qbittorrent/qBittorrent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qbittorrent/qBittorrent/merges","archive_url":"https://api.github.com/repos/qbittorrent/qBittorrent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qbittorrent/qBittorrent/downloads","issues_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues{/number}","pulls_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls{/number}","milestones_url":"https://api.github.com/repos/qbittorrent/qBittorrent/milestones{/number}","notifications_url":"https://api.github.com/repos/qbittorrent/qBittorrent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qbittorrent/qBittorrent/labels{/name}","releases_url":"https://api.github.com/repos/qbittorrent/qBittorrent/releases{/id}","created_at":"2012-02-04T09:37:46Z","updated_at":"2016-01-03T17:55:19Z","pushed_at":"2016-01-03T23:44:10Z","git_url":"git://github.com/qbittorrent/qBittorrent.git","ssh_url":"git@github.com:qbittorrent/qBittorrent.git","clone_url":"https://github.com/qbittorrent/qBittorrent.git","svn_url":"https://github.com/qbittorrent/qBittorrent","homepage":"http://www.qbittorrent.org","size":122132,"stargazers_count":1438,"watchers_count":1438,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":401,"mirror_url":null,"open_issues_count":1267,"forks":401,"open_issues":1267,"watchers":1438,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/4413"},"issue":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4413"},"comments":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/4413/comments"},"review_comments":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413/comments"},"review_comment":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/4413/commits"},"statuses":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/5c1e40320d93573dec2f9e080ae96d785f8a4d23"}}}}