{"action":"created","comment":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/27691401","id":27691401,"diff_hunk":"@@ -1,14 +1,85 @@\n-from twisted.internet import defer\n+import socket\n+from twisted.python import failure\n+from twisted.internet import defer, threads\n+from twisted.internet.error import DNSLookupError\n from twisted.internet.base import ThreadedResolver\n \n from scrapy.utils.datatypes import LocalCache\n \n+\n+IPV4_ONLY = 4\n+IPV6_ONLY = 6\n+IPV4_PREFERRED = 46\n+IPV6_PREFERRED = 64\n+\n+\n+class IPv6ThreadedResolver(ThreadedResolver):\n+    \"\"\"ThreadedResolver calling socket.getaddrinfo for IPv6 capability.\n+\n+    Uses a threadpool to perform name lookups without blocking the\n+    reactor thread. The underlying socket.getaddrinfo is a blocking call.\n+    \"\"\"\n+\n+    def __init__(self, reactor, protocol_preference=46):\n+        super(IPv6ThreadedResolver, self).__init__(reactor)\n+        if protocol_preference == 0:\n+            protocol_preference = 46","path":"scrapy/resolver.py","position":27,"original_position":27,"commit_id":"0b6a8b97a928154c2938ba31bf184655a948f4ef","original_commit_id":"0b6a8b97a928154c2938ba31bf184655a948f4ef","user":{"login":"kmike","id":107893,"avatar_url":"https://avatars.githubusercontent.com/u/107893?v=3","gravatar_id":"","url":"https://api.github.com/users/kmike","html_url":"https://github.com/kmike","followers_url":"https://api.github.com/users/kmike/followers","following_url":"https://api.github.com/users/kmike/following{/other_user}","gists_url":"https://api.github.com/users/kmike/gists{/gist_id}","starred_url":"https://api.github.com/users/kmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmike/subscriptions","organizations_url":"https://api.github.com/users/kmike/orgs","repos_url":"https://api.github.com/users/kmike/repos","events_url":"https://api.github.com/users/kmike/events{/privacy}","received_events_url":"https://api.github.com/users/kmike/received_events","type":"User","site_admin":false},"body":"IPV4_PREFERRED?","created_at":"2015-04-02T19:57:43Z","updated_at":"2015-04-02T19:57:43Z","html_url":"https://github.com/scrapy/scrapy/pull/1104#discussion_r27691401","pull_request_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1104","_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/27691401"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1104#discussion_r27691401"},"pull_request":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1104"}}},"pull_request":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/1104","id":31846987,"html_url":"https://github.com/scrapy/scrapy/pull/1104","diff_url":"https://github.com/scrapy/scrapy/pull/1104.diff","patch_url":"https://github.com/scrapy/scrapy/pull/1104.patch","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/1104","number":1104,"state":"open","locked":false,"title":"IPv6ThreadedResolver based on socket.getaddrinfo","user":{"login":"nyov","id":438293,"avatar_url":"https://avatars.githubusercontent.com/u/438293?v=3","gravatar_id":"","url":"https://api.github.com/users/nyov","html_url":"https://github.com/nyov","followers_url":"https://api.github.com/users/nyov/followers","following_url":"https://api.github.com/users/nyov/following{/other_user}","gists_url":"https://api.github.com/users/nyov/gists{/gist_id}","starred_url":"https://api.github.com/users/nyov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyov/subscriptions","organizations_url":"https://api.github.com/users/nyov/orgs","repos_url":"https://api.github.com/users/nyov/repos","events_url":"https://api.github.com/users/nyov/events{/privacy}","received_events_url":"https://api.github.com/users/nyov/received_events","type":"User","site_admin":false},"body":"For #1031\r\n\r\nI do not currently have the chance to test this in a v6-only environment.\r\nFeedback appreciated.","created_at":"2015-03-24T16:58:41Z","updated_at":"2015-04-02T19:57:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca5e694e1d5e5659f371621b9812265073f6f02f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1104/commits","review_comments_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1104/comments","review_comment_url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/1104/comments","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/0b6a8b97a928154c2938ba31bf184655a948f4ef","head":{"label":"nyov:nyov/v6resolver","ref":"nyov/v6resolver","sha":"0b6a8b97a928154c2938ba31bf184655a948f4ef","user":{"login":"nyov","id":438293,"avatar_url":"https://avatars.githubusercontent.com/u/438293?v=3","gravatar_id":"","url":"https://api.github.com/users/nyov","html_url":"https://github.com/nyov","followers_url":"https://api.github.com/users/nyov/followers","following_url":"https://api.github.com/users/nyov/following{/other_user}","gists_url":"https://api.github.com/users/nyov/gists{/gist_id}","starred_url":"https://api.github.com/users/nyov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyov/subscriptions","organizations_url":"https://api.github.com/users/nyov/orgs","repos_url":"https://api.github.com/users/nyov/repos","events_url":"https://api.github.com/users/nyov/events{/privacy}","received_events_url":"https://api.github.com/users/nyov/received_events","type":"User","site_admin":false},"repo":{"id":12548560,"name":"scrapy","full_name":"nyov/scrapy","owner":{"login":"nyov","id":438293,"avatar_url":"https://avatars.githubusercontent.com/u/438293?v=3","gravatar_id":"","url":"https://api.github.com/users/nyov","html_url":"https://github.com/nyov","followers_url":"https://api.github.com/users/nyov/followers","following_url":"https://api.github.com/users/nyov/following{/other_user}","gists_url":"https://api.github.com/users/nyov/gists{/gist_id}","starred_url":"https://api.github.com/users/nyov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyov/subscriptions","organizations_url":"https://api.github.com/users/nyov/orgs","repos_url":"https://api.github.com/users/nyov/repos","events_url":"https://api.github.com/users/nyov/events{/privacy}","received_events_url":"https://api.github.com/users/nyov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nyov/scrapy","description":"Scrapy, a fast high-level screen scraping and web crawling framework for Python.","fork":true,"url":"https://api.github.com/repos/nyov/scrapy","forks_url":"https://api.github.com/repos/nyov/scrapy/forks","keys_url":"https://api.github.com/repos/nyov/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nyov/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nyov/scrapy/teams","hooks_url":"https://api.github.com/repos/nyov/scrapy/hooks","issue_events_url":"https://api.github.com/repos/nyov/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/nyov/scrapy/events","assignees_url":"https://api.github.com/repos/nyov/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/nyov/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/nyov/scrapy/tags","blobs_url":"https://api.github.com/repos/nyov/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nyov/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nyov/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nyov/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nyov/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/nyov/scrapy/languages","stargazers_url":"https://api.github.com/repos/nyov/scrapy/stargazers","contributors_url":"https://api.github.com/repos/nyov/scrapy/contributors","subscribers_url":"https://api.github.com/repos/nyov/scrapy/subscribers","subscription_url":"https://api.github.com/repos/nyov/scrapy/subscription","commits_url":"https://api.github.com/repos/nyov/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nyov/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nyov/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nyov/scrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/nyov/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/nyov/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nyov/scrapy/merges","archive_url":"https://api.github.com/repos/nyov/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nyov/scrapy/downloads","issues_url":"https://api.github.com/repos/nyov/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/nyov/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/nyov/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/nyov/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nyov/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/nyov/scrapy/releases{/id}","created_at":"2013-09-02T20:33:18Z","updated_at":"2015-03-28T06:30:19Z","pushed_at":"2015-04-01T19:55:05Z","git_url":"git://github.com/nyov/scrapy.git","ssh_url":"git@github.com:nyov/scrapy.git","clone_url":"https://github.com/nyov/scrapy.git","svn_url":"https://github.com/nyov/scrapy","homepage":"http://scrapy.org","size":14028,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"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":"scrapy:master","ref":"master","sha":"27591b55fc806b153b007540012e1a728dbd1593","user":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"repo":{"id":529502,"name":"scrapy","full_name":"scrapy/scrapy","owner":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapy/scrapy","description":"Scrapy, a fast high-level web crawling and screen scraping framework for Python.","fork":false,"url":"https://api.github.com/repos/scrapy/scrapy","forks_url":"https://api.github.com/repos/scrapy/scrapy/forks","keys_url":"https://api.github.com/repos/scrapy/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapy/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapy/scrapy/teams","hooks_url":"https://api.github.com/repos/scrapy/scrapy/hooks","issue_events_url":"https://api.github.com/repos/scrapy/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/scrapy/scrapy/events","assignees_url":"https://api.github.com/repos/scrapy/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/scrapy/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/scrapy/scrapy/tags","blobs_url":"https://api.github.com/repos/scrapy/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapy/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapy/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapy/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapy/scrapy/languages","stargazers_url":"https://api.github.com/repos/scrapy/scrapy/stargazers","contributors_url":"https://api.github.com/repos/scrapy/scrapy/contributors","subscribers_url":"https://api.github.com/repos/scrapy/scrapy/subscribers","subscription_url":"https://api.github.com/repos/scrapy/scrapy/subscription","commits_url":"https://api.github.com/repos/scrapy/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapy/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapy/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapy/scrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrapy/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/scrapy/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapy/scrapy/merges","archive_url":"https://api.github.com/repos/scrapy/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapy/scrapy/downloads","issues_url":"https://api.github.com/repos/scrapy/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/scrapy/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapy/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapy/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapy/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/scrapy/scrapy/releases{/id}","created_at":"2010-02-22T02:01:14Z","updated_at":"2015-04-02T19:49:29Z","pushed_at":"2015-04-02T19:41:03Z","git_url":"git://github.com/scrapy/scrapy.git","ssh_url":"git@github.com:scrapy/scrapy.git","clone_url":"https://github.com/scrapy/scrapy.git","svn_url":"https://github.com/scrapy/scrapy","homepage":"http://scrapy.org","size":25396,"stargazers_count":8102,"watchers_count":8102,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":2270,"mirror_url":null,"open_issues_count":239,"forks":2270,"open_issues":239,"watchers":8102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1104"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1104"},"issue":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1104"},"comments":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1104/comments"},"review_comments":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1104/comments"},"review_comment":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1104/commits"},"statuses":{"href":"https://api.github.com/repos/scrapy/scrapy/statuses/0b6a8b97a928154c2938ba31bf184655a948f4ef"}}}}