{"action":"created","comment":{"url":"https://api.github.com/repos/3scale/apicast/pulls/comments/93763886","pull_request_review_id":14298708,"id":93763886,"diff_hunk":"@@ -292,18 +294,34 @@ function _M.set_service(host)\n   ngx.ctx.service = service\n end\n \n-function _M.set_upstream()\n-  local service = ngx.ctx.service\n+function _M.get_upstream(service)\n+  service = service or ngx.ctx.service\n \n   -- The default values are only for tests. We need to set at least the scheme.\n   local scheme, _, _, host, port, path =\n-    unpack(configuration.url(service.api_backend) or { 'http' })\n+    unpack(resty_url.split(service.api_backend) or { 'http' })\n+\n+  if not port then\n+    port = resty_url.default_port(scheme)\n+  end\n+\n+  return {\n+    server = host,\n+    host = service.hostname_rewrite or host,\n+    name = scheme .. '://upstream' .. (path or ''),","path":"apicast/src/provider.lua","position":37,"original_position":37,"commit_id":"8c650935c4a96406dea0ed8b222499d90690758f","original_commit_id":"8c650935c4a96406dea0ed8b222499d90690758f","user":{"login":"mikz","id":154571,"avatar_url":"https://avatars.githubusercontent.com/u/154571?v=3","gravatar_id":"","url":"https://api.github.com/users/mikz","html_url":"https://github.com/mikz","followers_url":"https://api.github.com/users/mikz/followers","following_url":"https://api.github.com/users/mikz/following{/other_user}","gists_url":"https://api.github.com/users/mikz/gists{/gist_id}","starred_url":"https://api.github.com/users/mikz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikz/subscriptions","organizations_url":"https://api.github.com/users/mikz/orgs","repos_url":"https://api.github.com/users/mikz/repos","events_url":"https://api.github.com/users/mikz/events{/privacy}","received_events_url":"https://api.github.com/users/mikz/received_events","type":"User","site_admin":false},"body":"Ok 👍 ","created_at":"2016-12-23T13:10:41Z","updated_at":"2016-12-23T13:10:41Z","html_url":"https://github.com/3scale/apicast/pull/184#discussion_r93763886","pull_request_url":"https://api.github.com/repos/3scale/apicast/pulls/184","_links":{"self":{"href":"https://api.github.com/repos/3scale/apicast/pulls/comments/93763886"},"html":{"href":"https://github.com/3scale/apicast/pull/184#discussion_r93763886"},"pull_request":{"href":"https://api.github.com/repos/3scale/apicast/pulls/184"}}},"pull_request":{"url":"https://api.github.com/repos/3scale/apicast/pulls/184","id":99217090,"html_url":"https://github.com/3scale/apicast/pull/184","diff_url":"https://github.com/3scale/apicast/pull/184.diff","patch_url":"https://github.com/3scale/apicast/pull/184.patch","issue_url":"https://api.github.com/repos/3scale/apicast/issues/184","number":184,"state":"open","locked":false,"title":"try to guess port from scheme when not provided","user":{"login":"mikz","id":154571,"avatar_url":"https://avatars.githubusercontent.com/u/154571?v=3","gravatar_id":"","url":"https://api.github.com/users/mikz","html_url":"https://github.com/mikz","followers_url":"https://api.github.com/users/mikz/followers","following_url":"https://api.github.com/users/mikz/following{/other_user}","gists_url":"https://api.github.com/users/mikz/gists{/gist_id}","starred_url":"https://api.github.com/users/mikz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikz/subscriptions","organizations_url":"https://api.github.com/users/mikz/orgs","repos_url":"https://api.github.com/users/mikz/repos","events_url":"https://api.github.com/users/mikz/events{/privacy}","received_events_url":"https://api.github.com/users/mikz/received_events","type":"User","site_admin":false},"body":"fixes https://github.com/3scale/apicast/issues/183\r\n\r\nunfortunately I could not figure out an easy way to write the integration test as it would have to run as a root and listen on port 80 or 443\r\n\r\nbut at least we have a test with https on explicit port, should be easy to add more special cases (like http2)","created_at":"2016-12-23T09:02:06Z","updated_at":"2016-12-23T13:10:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28b592ebbac89f18392efa4c62dbc34bd9c2ec34","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/3scale/apicast/pulls/184/commits","review_comments_url":"https://api.github.com/repos/3scale/apicast/pulls/184/comments","review_comment_url":"https://api.github.com/repos/3scale/apicast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/3scale/apicast/issues/184/comments","statuses_url":"https://api.github.com/repos/3scale/apicast/statuses/8c650935c4a96406dea0ed8b222499d90690758f","head":{"label":"3scale:default-port","ref":"default-port","sha":"8c650935c4a96406dea0ed8b222499d90690758f","user":{"login":"3scale","id":21415,"avatar_url":"https://avatars.githubusercontent.com/u/21415?v=3","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":53965666,"name":"apicast","full_name":"3scale/apicast","owner":{"login":"3scale","id":21415,"avatar_url":"https://avatars.githubusercontent.com/u/21415?v=3","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/3scale/apicast","description":"3scale api gateway reloaded","fork":false,"url":"https://api.github.com/repos/3scale/apicast","forks_url":"https://api.github.com/repos/3scale/apicast/forks","keys_url":"https://api.github.com/repos/3scale/apicast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/apicast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/apicast/teams","hooks_url":"https://api.github.com/repos/3scale/apicast/hooks","issue_events_url":"https://api.github.com/repos/3scale/apicast/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/apicast/events","assignees_url":"https://api.github.com/repos/3scale/apicast/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/apicast/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/apicast/tags","blobs_url":"https://api.github.com/repos/3scale/apicast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/apicast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/apicast/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/apicast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/apicast/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/apicast/languages","stargazers_url":"https://api.github.com/repos/3scale/apicast/stargazers","contributors_url":"https://api.github.com/repos/3scale/apicast/contributors","subscribers_url":"https://api.github.com/repos/3scale/apicast/subscribers","subscription_url":"https://api.github.com/repos/3scale/apicast/subscription","commits_url":"https://api.github.com/repos/3scale/apicast/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/apicast/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/apicast/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/apicast/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/apicast/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/apicast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/apicast/merges","archive_url":"https://api.github.com/repos/3scale/apicast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/apicast/downloads","issues_url":"https://api.github.com/repos/3scale/apicast/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/apicast/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/apicast/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/apicast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/apicast/labels{/name}","releases_url":"https://api.github.com/repos/3scale/apicast/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/apicast/deployments","created_at":"2016-03-15T17:41:51Z","updated_at":"2016-12-06T07:51:15Z","pushed_at":"2016-12-23T09:02:07Z","git_url":"git://github.com/3scale/apicast.git","ssh_url":"git@github.com:3scale/apicast.git","clone_url":"https://github.com/3scale/apicast.git","svn_url":"https://github.com/3scale/apicast","homepage":"","size":542,"stargazers_count":7,"watchers_count":7,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":28,"forks":8,"open_issues":28,"watchers":7,"default_branch":"v2"}},"base":{"label":"3scale:v2","ref":"v2","sha":"fad80aba28f00671b63dd270f22ea39dc68b6ab6","user":{"login":"3scale","id":21415,"avatar_url":"https://avatars.githubusercontent.com/u/21415?v=3","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":53965666,"name":"apicast","full_name":"3scale/apicast","owner":{"login":"3scale","id":21415,"avatar_url":"https://avatars.githubusercontent.com/u/21415?v=3","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/3scale/apicast","description":"3scale api gateway reloaded","fork":false,"url":"https://api.github.com/repos/3scale/apicast","forks_url":"https://api.github.com/repos/3scale/apicast/forks","keys_url":"https://api.github.com/repos/3scale/apicast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/apicast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/apicast/teams","hooks_url":"https://api.github.com/repos/3scale/apicast/hooks","issue_events_url":"https://api.github.com/repos/3scale/apicast/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/apicast/events","assignees_url":"https://api.github.com/repos/3scale/apicast/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/apicast/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/apicast/tags","blobs_url":"https://api.github.com/repos/3scale/apicast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/apicast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/apicast/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/apicast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/apicast/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/apicast/languages","stargazers_url":"https://api.github.com/repos/3scale/apicast/stargazers","contributors_url":"https://api.github.com/repos/3scale/apicast/contributors","subscribers_url":"https://api.github.com/repos/3scale/apicast/subscribers","subscription_url":"https://api.github.com/repos/3scale/apicast/subscription","commits_url":"https://api.github.com/repos/3scale/apicast/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/apicast/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/apicast/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/apicast/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/apicast/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/apicast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/apicast/merges","archive_url":"https://api.github.com/repos/3scale/apicast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/apicast/downloads","issues_url":"https://api.github.com/repos/3scale/apicast/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/apicast/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/apicast/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/apicast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/apicast/labels{/name}","releases_url":"https://api.github.com/repos/3scale/apicast/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/apicast/deployments","created_at":"2016-03-15T17:41:51Z","updated_at":"2016-12-06T07:51:15Z","pushed_at":"2016-12-23T09:02:07Z","git_url":"git://github.com/3scale/apicast.git","ssh_url":"git@github.com:3scale/apicast.git","clone_url":"https://github.com/3scale/apicast.git","svn_url":"https://github.com/3scale/apicast","homepage":"","size":542,"stargazers_count":7,"watchers_count":7,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":28,"forks":8,"open_issues":28,"watchers":7,"default_branch":"v2"}},"_links":{"self":{"href":"https://api.github.com/repos/3scale/apicast/pulls/184"},"html":{"href":"https://github.com/3scale/apicast/pull/184"},"issue":{"href":"https://api.github.com/repos/3scale/apicast/issues/184"},"comments":{"href":"https://api.github.com/repos/3scale/apicast/issues/184/comments"},"review_comments":{"href":"https://api.github.com/repos/3scale/apicast/pulls/184/comments"},"review_comment":{"href":"https://api.github.com/repos/3scale/apicast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/3scale/apicast/pulls/184/commits"},"statuses":{"href":"https://api.github.com/repos/3scale/apicast/statuses/8c650935c4a96406dea0ed8b222499d90690758f"}}}}
{"actor":{"display_login":"mikz"}}