{"action":"created","comment":{"url":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/58864644","id":58864644,"diff_hunk":"@@ -26,24 +27,42 @@ Client::~Client() {\n bool Client::Connect() {\n   CHECK(!Connected());\n \n-  fd_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);\n-  PCHECK(fd_ >= 0) << \"Socket creation failed\";\n-\n-  static struct sockaddr_in server_socket;\n-  memset(&server_socket, 0, sizeof server_socket);\n-  server_socket.sin_family = AF_INET;\n-  server_socket.sin_port = htons(port_);\n-  CHECK_EQ(1, inet_aton(server_.c_str(), &server_socket.sin_addr))\n-      << \"Can't parse server address: \" << server_;\n+  static const addrinfo server_addr_hints = {\n+    AI_ADDRCONFIG, /* ai_flags */\n+    AF_UNSPEC,     /* ai_family */\n+    SOCK_STREAM,   /* ai_socktype */\n+    IPPROTO_TCP    /* ai_protocol */\n+  };\n+\n+  struct addrinfo* server_addr;\n+\n+  int ret = getaddrinfo(server_.c_str(), port_.c_str(), &server_addr_hints,","path":"cpp/client/client.cc","position":39,"original_position":39,"commit_id":"839f458e3c3a28bb6dcb83a7d9790f5e912c6179","original_commit_id":"839f458e3c3a28bb6dcb83a7d9790f5e912c6179","user":{"login":"pphaneuf","id":40400,"avatar_url":"https://avatars.githubusercontent.com/u/40400?v=3","gravatar_id":"","url":"https://api.github.com/users/pphaneuf","html_url":"https://github.com/pphaneuf","followers_url":"https://api.github.com/users/pphaneuf/followers","following_url":"https://api.github.com/users/pphaneuf/following{/other_user}","gists_url":"https://api.github.com/users/pphaneuf/gists{/gist_id}","starred_url":"https://api.github.com/users/pphaneuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pphaneuf/subscriptions","organizations_url":"https://api.github.com/users/pphaneuf/orgs","repos_url":"https://api.github.com/users/pphaneuf/repos","events_url":"https://api.github.com/users/pphaneuf/events{/privacy}","received_events_url":"https://api.github.com/users/pphaneuf/received_events","type":"User","site_admin":false},"body":"Make this `const`.","created_at":"2016-04-07T12:47:52Z","updated_at":"2016-04-07T12:47:52Z","html_url":"https://github.com/google/certificate-transparency/pull/1147#discussion_r58864644","pull_request_url":"https://api.github.com/repos/google/certificate-transparency/pulls/1147","_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/58864644"},"html":{"href":"https://github.com/google/certificate-transparency/pull/1147#discussion_r58864644"},"pull_request":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/1147"}}},"pull_request":{"url":"https://api.github.com/repos/google/certificate-transparency/pulls/1147","id":65601652,"html_url":"https://github.com/google/certificate-transparency/pull/1147","diff_url":"https://github.com/google/certificate-transparency/pull/1147.diff","patch_url":"https://github.com/google/certificate-transparency/pull/1147.patch","issue_url":"https://api.github.com/repos/google/certificate-transparency/issues/1147","number":1147,"state":"open","locked":false,"title":"Use getaddrinfo instead of inet_aton in Client::Connect","user":{"login":"RJPercival","id":1949076,"avatar_url":"https://avatars.githubusercontent.com/u/1949076?v=3","gravatar_id":"","url":"https://api.github.com/users/RJPercival","html_url":"https://github.com/RJPercival","followers_url":"https://api.github.com/users/RJPercival/followers","following_url":"https://api.github.com/users/RJPercival/following{/other_user}","gists_url":"https://api.github.com/users/RJPercival/gists{/gist_id}","starred_url":"https://api.github.com/users/RJPercival/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RJPercival/subscriptions","organizations_url":"https://api.github.com/users/RJPercival/orgs","repos_url":"https://api.github.com/users/RJPercival/repos","events_url":"https://api.github.com/users/RJPercival/events{/privacy}","received_events_url":"https://api.github.com/users/RJPercival/received_events","type":"User","site_admin":false},"body":"This following are now supported, in addition to IPv4 addresses:\r\n- hostnames\r\n- IPv6 addresses\r\n- service names instead of port numbers","created_at":"2016-04-07T09:47:04Z","updated_at":"2016-04-07T12:47:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22181df6ad0273e39e2f143ba8b81f09b67b4a25","assignee":{"login":"pphaneuf","id":40400,"avatar_url":"https://avatars.githubusercontent.com/u/40400?v=3","gravatar_id":"","url":"https://api.github.com/users/pphaneuf","html_url":"https://github.com/pphaneuf","followers_url":"https://api.github.com/users/pphaneuf/followers","following_url":"https://api.github.com/users/pphaneuf/following{/other_user}","gists_url":"https://api.github.com/users/pphaneuf/gists{/gist_id}","starred_url":"https://api.github.com/users/pphaneuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pphaneuf/subscriptions","organizations_url":"https://api.github.com/users/pphaneuf/orgs","repos_url":"https://api.github.com/users/pphaneuf/repos","events_url":"https://api.github.com/users/pphaneuf/events{/privacy}","received_events_url":"https://api.github.com/users/pphaneuf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/google/certificate-transparency/pulls/1147/commits","review_comments_url":"https://api.github.com/repos/google/certificate-transparency/pulls/1147/comments","review_comment_url":"https://api.github.com/repos/google/certificate-transparency/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/certificate-transparency/issues/1147/comments","statuses_url":"https://api.github.com/repos/google/certificate-transparency/statuses/839f458e3c3a28bb6dcb83a7d9790f5e912c6179","head":{"label":"RJPercival:getaddrinfo","ref":"getaddrinfo","sha":"839f458e3c3a28bb6dcb83a7d9790f5e912c6179","user":{"login":"RJPercival","id":1949076,"avatar_url":"https://avatars.githubusercontent.com/u/1949076?v=3","gravatar_id":"","url":"https://api.github.com/users/RJPercival","html_url":"https://github.com/RJPercival","followers_url":"https://api.github.com/users/RJPercival/followers","following_url":"https://api.github.com/users/RJPercival/following{/other_user}","gists_url":"https://api.github.com/users/RJPercival/gists{/gist_id}","starred_url":"https://api.github.com/users/RJPercival/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RJPercival/subscriptions","organizations_url":"https://api.github.com/users/RJPercival/orgs","repos_url":"https://api.github.com/users/RJPercival/repos","events_url":"https://api.github.com/users/RJPercival/events{/privacy}","received_events_url":"https://api.github.com/users/RJPercival/received_events","type":"User","site_admin":false},"repo":{"id":37668116,"name":"certificate-transparency","full_name":"RJPercival/certificate-transparency","owner":{"login":"RJPercival","id":1949076,"avatar_url":"https://avatars.githubusercontent.com/u/1949076?v=3","gravatar_id":"","url":"https://api.github.com/users/RJPercival","html_url":"https://github.com/RJPercival","followers_url":"https://api.github.com/users/RJPercival/followers","following_url":"https://api.github.com/users/RJPercival/following{/other_user}","gists_url":"https://api.github.com/users/RJPercival/gists{/gist_id}","starred_url":"https://api.github.com/users/RJPercival/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RJPercival/subscriptions","organizations_url":"https://api.github.com/users/RJPercival/orgs","repos_url":"https://api.github.com/users/RJPercival/repos","events_url":"https://api.github.com/users/RJPercival/events{/privacy}","received_events_url":"https://api.github.com/users/RJPercival/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RJPercival/certificate-transparency","description":"Auditing for TLS certificates.","fork":true,"url":"https://api.github.com/repos/RJPercival/certificate-transparency","forks_url":"https://api.github.com/repos/RJPercival/certificate-transparency/forks","keys_url":"https://api.github.com/repos/RJPercival/certificate-transparency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RJPercival/certificate-transparency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RJPercival/certificate-transparency/teams","hooks_url":"https://api.github.com/repos/RJPercival/certificate-transparency/hooks","issue_events_url":"https://api.github.com/repos/RJPercival/certificate-transparency/issues/events{/number}","events_url":"https://api.github.com/repos/RJPercival/certificate-transparency/events","assignees_url":"https://api.github.com/repos/RJPercival/certificate-transparency/assignees{/user}","branches_url":"https://api.github.com/repos/RJPercival/certificate-transparency/branches{/branch}","tags_url":"https://api.github.com/repos/RJPercival/certificate-transparency/tags","blobs_url":"https://api.github.com/repos/RJPercival/certificate-transparency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RJPercival/certificate-transparency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RJPercival/certificate-transparency/git/refs{/sha}","trees_url":"https://api.github.com/repos/RJPercival/certificate-transparency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RJPercival/certificate-transparency/statuses/{sha}","languages_url":"https://api.github.com/repos/RJPercival/certificate-transparency/languages","stargazers_url":"https://api.github.com/repos/RJPercival/certificate-transparency/stargazers","contributors_url":"https://api.github.com/repos/RJPercival/certificate-transparency/contributors","subscribers_url":"https://api.github.com/repos/RJPercival/certificate-transparency/subscribers","subscription_url":"https://api.github.com/repos/RJPercival/certificate-transparency/subscription","commits_url":"https://api.github.com/repos/RJPercival/certificate-transparency/commits{/sha}","git_commits_url":"https://api.github.com/repos/RJPercival/certificate-transparency/git/commits{/sha}","comments_url":"https://api.github.com/repos/RJPercival/certificate-transparency/comments{/number}","issue_comment_url":"https://api.github.com/repos/RJPercival/certificate-transparency/issues/comments{/number}","contents_url":"https://api.github.com/repos/RJPercival/certificate-transparency/contents/{+path}","compare_url":"https://api.github.com/repos/RJPercival/certificate-transparency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RJPercival/certificate-transparency/merges","archive_url":"https://api.github.com/repos/RJPercival/certificate-transparency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RJPercival/certificate-transparency/downloads","issues_url":"https://api.github.com/repos/RJPercival/certificate-transparency/issues{/number}","pulls_url":"https://api.github.com/repos/RJPercival/certificate-transparency/pulls{/number}","milestones_url":"https://api.github.com/repos/RJPercival/certificate-transparency/milestones{/number}","notifications_url":"https://api.github.com/repos/RJPercival/certificate-transparency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RJPercival/certificate-transparency/labels{/name}","releases_url":"https://api.github.com/repos/RJPercival/certificate-transparency/releases{/id}","deployments_url":"https://api.github.com/repos/RJPercival/certificate-transparency/deployments","created_at":"2015-06-18T15:32:26Z","updated_at":"2016-01-22T13:48:50Z","pushed_at":"2016-04-07T11:44:07Z","git_url":"git://github.com/RJPercival/certificate-transparency.git","ssh_url":"git@github.com:RJPercival/certificate-transparency.git","clone_url":"https://github.com/RJPercival/certificate-transparency.git","svn_url":"https://github.com/RJPercival/certificate-transparency","homepage":"http://www.certificate-transparency.org/","size":20034,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"7184a5b9f7ac5a6828901408090e17f630a6f324","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19989605,"name":"certificate-transparency","full_name":"google/certificate-transparency","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/certificate-transparency","description":"Auditing for TLS certificates.","fork":false,"url":"https://api.github.com/repos/google/certificate-transparency","forks_url":"https://api.github.com/repos/google/certificate-transparency/forks","keys_url":"https://api.github.com/repos/google/certificate-transparency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/certificate-transparency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/certificate-transparency/teams","hooks_url":"https://api.github.com/repos/google/certificate-transparency/hooks","issue_events_url":"https://api.github.com/repos/google/certificate-transparency/issues/events{/number}","events_url":"https://api.github.com/repos/google/certificate-transparency/events","assignees_url":"https://api.github.com/repos/google/certificate-transparency/assignees{/user}","branches_url":"https://api.github.com/repos/google/certificate-transparency/branches{/branch}","tags_url":"https://api.github.com/repos/google/certificate-transparency/tags","blobs_url":"https://api.github.com/repos/google/certificate-transparency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/certificate-transparency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/certificate-transparency/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/certificate-transparency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/certificate-transparency/statuses/{sha}","languages_url":"https://api.github.com/repos/google/certificate-transparency/languages","stargazers_url":"https://api.github.com/repos/google/certificate-transparency/stargazers","contributors_url":"https://api.github.com/repos/google/certificate-transparency/contributors","subscribers_url":"https://api.github.com/repos/google/certificate-transparency/subscribers","subscription_url":"https://api.github.com/repos/google/certificate-transparency/subscription","commits_url":"https://api.github.com/repos/google/certificate-transparency/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/certificate-transparency/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/certificate-transparency/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/certificate-transparency/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/certificate-transparency/contents/{+path}","compare_url":"https://api.github.com/repos/google/certificate-transparency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/certificate-transparency/merges","archive_url":"https://api.github.com/repos/google/certificate-transparency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/certificate-transparency/downloads","issues_url":"https://api.github.com/repos/google/certificate-transparency/issues{/number}","pulls_url":"https://api.github.com/repos/google/certificate-transparency/pulls{/number}","milestones_url":"https://api.github.com/repos/google/certificate-transparency/milestones{/number}","notifications_url":"https://api.github.com/repos/google/certificate-transparency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/certificate-transparency/labels{/name}","releases_url":"https://api.github.com/repos/google/certificate-transparency/releases{/id}","deployments_url":"https://api.github.com/repos/google/certificate-transparency/deployments","created_at":"2014-05-20T17:03:47Z","updated_at":"2016-04-05T04:27:04Z","pushed_at":"2016-04-07T11:44:27Z","git_url":"git://github.com/google/certificate-transparency.git","ssh_url":"git@github.com:google/certificate-transparency.git","clone_url":"https://github.com/google/certificate-transparency.git","svn_url":"https://github.com/google/certificate-transparency","homepage":"http://www.certificate-transparency.org/","size":22176,"stargazers_count":234,"watchers_count":234,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":87,"forks":85,"open_issues":87,"watchers":234,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/1147"},"html":{"href":"https://github.com/google/certificate-transparency/pull/1147"},"issue":{"href":"https://api.github.com/repos/google/certificate-transparency/issues/1147"},"comments":{"href":"https://api.github.com/repos/google/certificate-transparency/issues/1147/comments"},"review_comments":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/1147/comments"},"review_comment":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/1147/commits"},"statuses":{"href":"https://api.github.com/repos/google/certificate-transparency/statuses/839f458e3c3a28bb6dcb83a7d9790f5e912c6179"}}}}