{"action":"created","comment":{"url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/comments/24361277","id":24361277,"diff_hunk":"@@ -157,10 +157,23 @@ protected function getUserAgent()\n \n     protected function getIpAddress()\n     {\n-        if (isset($_SERVER['REMOTE_ADDR'])) {\n-            return $_SERVER['REMOTE_ADDR'];\n-        }\n-        return null;\n+    \t$ip = null;\n+    \tif (function_exists('apache_request_headers')) {\n+\t\t$headers = apache_request_headers();\n+\t\tif (isset($headers['X-Forwarded-For']) && !empty($headers['X-Forwarded-For'])) {\n+\t\t\t$ip = reset(explode(',', $headers['X-Forwarded-For']));\n+\t\t} elseif (isset($headers['HTTP_X_FORWARDED_FOR']) && !empty($headers['HTTP_X_FORWARDED_FOR'])) {\n+\t\t\t$ip =  reset(explode(',', $headers['HTTP_X_FORWARDED_FOR']));\n+\t\t} else {\n+\t\t\t//\n+\t\t}\n+    \t} elseif (isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR'])) {\n+\t\t$ip = $_SERVER['REMOTE_ADDR'];","path":"src/SeatGeek/Sixpack/Session/Base.php","position":19,"original_position":19,"commit_id":"7c8f78acbdfcf27c9e26d797cb5ab0fc3987a58c","original_commit_id":"7c8f78acbdfcf27c9e26d797cb5ab0fc3987a58c","user":{"login":"barchard","id":17622,"avatar_url":"https://avatars.githubusercontent.com/u/17622?v=3","gravatar_id":"","url":"https://api.github.com/users/barchard","html_url":"https://github.com/barchard","followers_url":"https://api.github.com/users/barchard/followers","following_url":"https://api.github.com/users/barchard/following{/other_user}","gists_url":"https://api.github.com/users/barchard/gists{/gist_id}","starred_url":"https://api.github.com/users/barchard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barchard/subscriptions","organizations_url":"https://api.github.com/users/barchard/orgs","repos_url":"https://api.github.com/users/barchard/repos","events_url":"https://api.github.com/users/barchard/events{/privacy}","received_events_url":"https://api.github.com/users/barchard/received_events","type":"User","site_admin":false},"body":"Yea, good point. Trying to match the style in the file.","created_at":"2015-02-09T20:16:12Z","updated_at":"2015-02-09T20:16:12Z","html_url":"https://github.com/seatgeek/sixpack-php/pull/11#discussion_r24361277","pull_request_url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/comments/24361277"},"html":{"href":"https://github.com/seatgeek/sixpack-php/pull/11#discussion_r24361277"},"pull_request":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11","id":28947836,"html_url":"https://github.com/seatgeek/sixpack-php/pull/11","diff_url":"https://github.com/seatgeek/sixpack-php/pull/11.diff","patch_url":"https://github.com/seatgeek/sixpack-php/pull/11.patch","issue_url":"https://api.github.com/repos/seatgeek/sixpack-php/issues/11","number":11,"state":"open","locked":false,"title":"Add support for IPs masked via a Proxy","user":{"login":"barchard","id":17622,"avatar_url":"https://avatars.githubusercontent.com/u/17622?v=3","gravatar_id":"","url":"https://api.github.com/users/barchard","html_url":"https://github.com/barchard","followers_url":"https://api.github.com/users/barchard/followers","following_url":"https://api.github.com/users/barchard/following{/other_user}","gists_url":"https://api.github.com/users/barchard/gists{/gist_id}","starred_url":"https://api.github.com/users/barchard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barchard/subscriptions","organizations_url":"https://api.github.com/users/barchard/orgs","repos_url":"https://api.github.com/users/barchard/repos","events_url":"https://api.github.com/users/barchard/events{/privacy}","received_events_url":"https://api.github.com/users/barchard/received_events","type":"User","site_admin":false},"body":"If the user is behind a load balancer or proxy, $_SERVER['REMOTE_ADDR'] would be the IP address of the Proxy, not the user. Use the Apache headers first and fall back to $_SERVER['REMOTE_ADDR'] if necessary","created_at":"2015-02-09T19:15:01Z","updated_at":"2015-02-09T20:16:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf12922ec8cc99a8de0074a2bf502b8e8d2d4d4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11/commits","review_comments_url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11/comments","review_comment_url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/comments/{number}","comments_url":"https://api.github.com/repos/seatgeek/sixpack-php/issues/11/comments","statuses_url":"https://api.github.com/repos/seatgeek/sixpack-php/statuses/7c8f78acbdfcf27c9e26d797cb5ab0fc3987a58c","head":{"label":"barchard:patch-1","ref":"patch-1","sha":"7c8f78acbdfcf27c9e26d797cb5ab0fc3987a58c","user":{"login":"barchard","id":17622,"avatar_url":"https://avatars.githubusercontent.com/u/17622?v=3","gravatar_id":"","url":"https://api.github.com/users/barchard","html_url":"https://github.com/barchard","followers_url":"https://api.github.com/users/barchard/followers","following_url":"https://api.github.com/users/barchard/following{/other_user}","gists_url":"https://api.github.com/users/barchard/gists{/gist_id}","starred_url":"https://api.github.com/users/barchard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barchard/subscriptions","organizations_url":"https://api.github.com/users/barchard/orgs","repos_url":"https://api.github.com/users/barchard/repos","events_url":"https://api.github.com/users/barchard/events{/privacy}","received_events_url":"https://api.github.com/users/barchard/received_events","type":"User","site_admin":false},"repo":{"id":30553198,"name":"sixpack-php","full_name":"barchard/sixpack-php","owner":{"login":"barchard","id":17622,"avatar_url":"https://avatars.githubusercontent.com/u/17622?v=3","gravatar_id":"","url":"https://api.github.com/users/barchard","html_url":"https://github.com/barchard","followers_url":"https://api.github.com/users/barchard/followers","following_url":"https://api.github.com/users/barchard/following{/other_user}","gists_url":"https://api.github.com/users/barchard/gists{/gist_id}","starred_url":"https://api.github.com/users/barchard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barchard/subscriptions","organizations_url":"https://api.github.com/users/barchard/orgs","repos_url":"https://api.github.com/users/barchard/repos","events_url":"https://api.github.com/users/barchard/events{/privacy}","received_events_url":"https://api.github.com/users/barchard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/barchard/sixpack-php","description":"PHP client library for SeatGeek's Sixpack A/B testing framework","fork":true,"url":"https://api.github.com/repos/barchard/sixpack-php","forks_url":"https://api.github.com/repos/barchard/sixpack-php/forks","keys_url":"https://api.github.com/repos/barchard/sixpack-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/barchard/sixpack-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/barchard/sixpack-php/teams","hooks_url":"https://api.github.com/repos/barchard/sixpack-php/hooks","issue_events_url":"https://api.github.com/repos/barchard/sixpack-php/issues/events{/number}","events_url":"https://api.github.com/repos/barchard/sixpack-php/events","assignees_url":"https://api.github.com/repos/barchard/sixpack-php/assignees{/user}","branches_url":"https://api.github.com/repos/barchard/sixpack-php/branches{/branch}","tags_url":"https://api.github.com/repos/barchard/sixpack-php/tags","blobs_url":"https://api.github.com/repos/barchard/sixpack-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/barchard/sixpack-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/barchard/sixpack-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/barchard/sixpack-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/barchard/sixpack-php/statuses/{sha}","languages_url":"https://api.github.com/repos/barchard/sixpack-php/languages","stargazers_url":"https://api.github.com/repos/barchard/sixpack-php/stargazers","contributors_url":"https://api.github.com/repos/barchard/sixpack-php/contributors","subscribers_url":"https://api.github.com/repos/barchard/sixpack-php/subscribers","subscription_url":"https://api.github.com/repos/barchard/sixpack-php/subscription","commits_url":"https://api.github.com/repos/barchard/sixpack-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/barchard/sixpack-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/barchard/sixpack-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/barchard/sixpack-php/issues/comments/{number}","contents_url":"https://api.github.com/repos/barchard/sixpack-php/contents/{+path}","compare_url":"https://api.github.com/repos/barchard/sixpack-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/barchard/sixpack-php/merges","archive_url":"https://api.github.com/repos/barchard/sixpack-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/barchard/sixpack-php/downloads","issues_url":"https://api.github.com/repos/barchard/sixpack-php/issues{/number}","pulls_url":"https://api.github.com/repos/barchard/sixpack-php/pulls{/number}","milestones_url":"https://api.github.com/repos/barchard/sixpack-php/milestones{/number}","notifications_url":"https://api.github.com/repos/barchard/sixpack-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/barchard/sixpack-php/labels{/name}","releases_url":"https://api.github.com/repos/barchard/sixpack-php/releases{/id}","created_at":"2015-02-09T19:12:08Z","updated_at":"2015-02-09T19:12:09Z","pushed_at":"2015-02-09T19:47:32Z","git_url":"git://github.com/barchard/sixpack-php.git","ssh_url":"git@github.com:barchard/sixpack-php.git","clone_url":"https://github.com/barchard/sixpack-php.git","svn_url":"https://github.com/barchard/sixpack-php","homepage":"http://sixpack.seatgeek.com/","size":138,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"seatgeek:master","ref":"master","sha":"594b09e91cc08846dd387c3a2f8ada4dce5429fa","user":{"login":"seatgeek","id":447527,"avatar_url":"https://avatars.githubusercontent.com/u/447527?v=3","gravatar_id":"","url":"https://api.github.com/users/seatgeek","html_url":"https://github.com/seatgeek","followers_url":"https://api.github.com/users/seatgeek/followers","following_url":"https://api.github.com/users/seatgeek/following{/other_user}","gists_url":"https://api.github.com/users/seatgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/seatgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seatgeek/subscriptions","organizations_url":"https://api.github.com/users/seatgeek/orgs","repos_url":"https://api.github.com/users/seatgeek/repos","events_url":"https://api.github.com/users/seatgeek/events{/privacy}","received_events_url":"https://api.github.com/users/seatgeek/received_events","type":"Organization","site_admin":false},"repo":{"id":8016029,"name":"sixpack-php","full_name":"seatgeek/sixpack-php","owner":{"login":"seatgeek","id":447527,"avatar_url":"https://avatars.githubusercontent.com/u/447527?v=3","gravatar_id":"","url":"https://api.github.com/users/seatgeek","html_url":"https://github.com/seatgeek","followers_url":"https://api.github.com/users/seatgeek/followers","following_url":"https://api.github.com/users/seatgeek/following{/other_user}","gists_url":"https://api.github.com/users/seatgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/seatgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seatgeek/subscriptions","organizations_url":"https://api.github.com/users/seatgeek/orgs","repos_url":"https://api.github.com/users/seatgeek/repos","events_url":"https://api.github.com/users/seatgeek/events{/privacy}","received_events_url":"https://api.github.com/users/seatgeek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/seatgeek/sixpack-php","description":"PHP client library for SeatGeek's Sixpack A/B testing framework","fork":false,"url":"https://api.github.com/repos/seatgeek/sixpack-php","forks_url":"https://api.github.com/repos/seatgeek/sixpack-php/forks","keys_url":"https://api.github.com/repos/seatgeek/sixpack-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seatgeek/sixpack-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seatgeek/sixpack-php/teams","hooks_url":"https://api.github.com/repos/seatgeek/sixpack-php/hooks","issue_events_url":"https://api.github.com/repos/seatgeek/sixpack-php/issues/events{/number}","events_url":"https://api.github.com/repos/seatgeek/sixpack-php/events","assignees_url":"https://api.github.com/repos/seatgeek/sixpack-php/assignees{/user}","branches_url":"https://api.github.com/repos/seatgeek/sixpack-php/branches{/branch}","tags_url":"https://api.github.com/repos/seatgeek/sixpack-php/tags","blobs_url":"https://api.github.com/repos/seatgeek/sixpack-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seatgeek/sixpack-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seatgeek/sixpack-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/seatgeek/sixpack-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seatgeek/sixpack-php/statuses/{sha}","languages_url":"https://api.github.com/repos/seatgeek/sixpack-php/languages","stargazers_url":"https://api.github.com/repos/seatgeek/sixpack-php/stargazers","contributors_url":"https://api.github.com/repos/seatgeek/sixpack-php/contributors","subscribers_url":"https://api.github.com/repos/seatgeek/sixpack-php/subscribers","subscription_url":"https://api.github.com/repos/seatgeek/sixpack-php/subscription","commits_url":"https://api.github.com/repos/seatgeek/sixpack-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/seatgeek/sixpack-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/seatgeek/sixpack-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/seatgeek/sixpack-php/issues/comments/{number}","contents_url":"https://api.github.com/repos/seatgeek/sixpack-php/contents/{+path}","compare_url":"https://api.github.com/repos/seatgeek/sixpack-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seatgeek/sixpack-php/merges","archive_url":"https://api.github.com/repos/seatgeek/sixpack-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seatgeek/sixpack-php/downloads","issues_url":"https://api.github.com/repos/seatgeek/sixpack-php/issues{/number}","pulls_url":"https://api.github.com/repos/seatgeek/sixpack-php/pulls{/number}","milestones_url":"https://api.github.com/repos/seatgeek/sixpack-php/milestones{/number}","notifications_url":"https://api.github.com/repos/seatgeek/sixpack-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seatgeek/sixpack-php/labels{/name}","releases_url":"https://api.github.com/repos/seatgeek/sixpack-php/releases{/id}","created_at":"2013-02-04T20:56:00Z","updated_at":"2015-02-02T16:27:36Z","pushed_at":"2014-11-06T12:00:29Z","git_url":"git://github.com/seatgeek/sixpack-php.git","ssh_url":"git@github.com:seatgeek/sixpack-php.git","clone_url":"https://github.com/seatgeek/sixpack-php.git","svn_url":"https://github.com/seatgeek/sixpack-php","homepage":"http://sixpack.seatgeek.com/","size":369,"stargazers_count":35,"watchers_count":35,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":4,"forks":5,"open_issues":4,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11"},"html":{"href":"https://github.com/seatgeek/sixpack-php/pull/11"},"issue":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/issues/11"},"comments":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/seatgeek/sixpack-php/statuses/7c8f78acbdfcf27c9e26d797cb5ab0fc3987a58c"}}}}