{"action":"created","comment":{"url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/comments/40267061","id":40267061,"diff_hunk":"@@ -375,11 +376,71 @@ Meteor.startup(function () {\n     WebApp.rawConnectHandlers.use(BlackrockPayments.makeConnectHandler(globalDb));\n   }\n \n-  WebApp.rawConnectHandlers.use(function (req, res, next) {\n+  // This function serves responses on Sandstorm's main HTTP/HTTPS\n+  // port.\n+  var serveMeteorOrStaticPublishing = function(req, res, next) {\n+    return dispatchToMeteorOrStaticPublishing(req, res, next, false, true);\n+  }\n+\n+  // Bind listeners to FD #4 and higher, if we are supposed to be\n+  // listening on multiple ports.\n+  function getNumberOfAlternatePorts() {\n+    var numCommas = (process.env.PORT.match(/,/g) || {}).length;","path":"shell/server/pre-meteor.js","position":22,"original_position":22,"commit_id":"ae5eaa0c3c3cead04469826ba1682c8bdeeabc1f","original_commit_id":"ae5eaa0c3c3cead04469826ba1682c8bdeeabc1f","user":{"login":"paulproteus","id":25457,"avatar_url":"https://avatars.githubusercontent.com/u/25457?v=3","gravatar_id":"","url":"https://api.github.com/users/paulproteus","html_url":"https://github.com/paulproteus","followers_url":"https://api.github.com/users/paulproteus/followers","following_url":"https://api.github.com/users/paulproteus/following{/other_user}","gists_url":"https://api.github.com/users/paulproteus/gists{/gist_id}","starred_url":"https://api.github.com/users/paulproteus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulproteus/subscriptions","organizations_url":"https://api.github.com/users/paulproteus/orgs","repos_url":"https://api.github.com/users/paulproteus/repos","events_url":"https://api.github.com/users/paulproteus/events{/privacy}","received_events_url":"https://api.github.com/users/paulproteus/received_events","type":"User","site_admin":false},"body":"```\r\n> {}.length\r\nundefined\r\n> [].length\r\n0\r\n```\r\n\r\nClearly I did mean `|| {}`. Also +1 to `.split()`","created_at":"2015-09-23T22:38:37Z","updated_at":"2015-09-23T22:38:37Z","html_url":"https://github.com/sandstorm-io/sandstorm/pull/900#discussion_r40267061","pull_request_url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900","_links":{"self":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/comments/40267061"},"html":{"href":"https://github.com/sandstorm-io/sandstorm/pull/900#discussion_r40267061"},"pull_request":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900"}}},"pull_request":{"url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900","id":45462655,"html_url":"https://github.com/sandstorm-io/sandstorm/pull/900","diff_url":"https://github.com/sandstorm-io/sandstorm/pull/900.diff","patch_url":"https://github.com/sandstorm-io/sandstorm/pull/900.patch","issue_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/900","number":900,"state":"open","locked":false,"title":"Support serving HTTPS if configured to do so and listening on multiple ports","user":{"login":"paulproteus","id":25457,"avatar_url":"https://avatars.githubusercontent.com/u/25457?v=3","gravatar_id":"","url":"https://api.github.com/users/paulproteus","html_url":"https://github.com/paulproteus","followers_url":"https://api.github.com/users/paulproteus/followers","following_url":"https://api.github.com/users/paulproteus/following{/other_user}","gists_url":"https://api.github.com/users/paulproteus/gists{/gist_id}","starred_url":"https://api.github.com/users/paulproteus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulproteus/subscriptions","organizations_url":"https://api.github.com/users/paulproteus/orgs","repos_url":"https://api.github.com/users/paulproteus/repos","events_url":"https://api.github.com/users/paulproteus/events{/privacy}","received_events_url":"https://api.github.com/users/paulproteus/received_events","type":"User","site_admin":false},"body":"Changes:\r\n\r\n* Adjust run-bundle to listen on multiple ports and pass their sockets over.\r\n\r\n* Adjust meteor-bundle-main.js to optionally rebind http.createServer() to\r\n  return a HTTPS server.\r\n\r\n* Adjust pre-meteor.js to handle secondary HTTP services.\r\n\r\n* Adjust default ROOT_URL to be https:// if HTTPS is enabled.\r\n\r\n* Adjust run-bundle & install.sh to fix permissions problems in https dir.\r\n\r\n* Adjust install.sh to create the HTTPS keys with permissions that are readable by Sandstorm.\r\n\r\n* Serve static publishing on the first HTTPS port as well as the first HTTP port, even for custom user domain names.\r\n\r\n* Adjust run-dev.sh to do something reasonable when multiple ports are defined.","created_at":"2015-09-18T23:22:37Z","updated_at":"2015-09-23T22:38:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38226f5e9e5ebd118c92e24a477ad48a3945a893","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900/commits","review_comments_url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900/comments","review_comment_url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/900/comments","statuses_url":"https://api.github.com/repos/sandstorm-io/sandstorm/statuses/ae5eaa0c3c3cead04469826ba1682c8bdeeabc1f","head":{"label":"sandstorm-io:support-multiple-ports","ref":"support-multiple-ports","sha":"ae5eaa0c3c3cead04469826ba1682c8bdeeabc1f","user":{"login":"sandstorm-io","id":7479094,"avatar_url":"https://avatars.githubusercontent.com/u/7479094?v=3","gravatar_id":"","url":"https://api.github.com/users/sandstorm-io","html_url":"https://github.com/sandstorm-io","followers_url":"https://api.github.com/users/sandstorm-io/followers","following_url":"https://api.github.com/users/sandstorm-io/following{/other_user}","gists_url":"https://api.github.com/users/sandstorm-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sandstorm-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandstorm-io/subscriptions","organizations_url":"https://api.github.com/users/sandstorm-io/orgs","repos_url":"https://api.github.com/users/sandstorm-io/repos","events_url":"https://api.github.com/users/sandstorm-io/events{/privacy}","received_events_url":"https://api.github.com/users/sandstorm-io/received_events","type":"Organization","site_admin":false},"repo":{"id":15728293,"name":"sandstorm","full_name":"sandstorm-io/sandstorm","owner":{"login":"sandstorm-io","id":7479094,"avatar_url":"https://avatars.githubusercontent.com/u/7479094?v=3","gravatar_id":"","url":"https://api.github.com/users/sandstorm-io","html_url":"https://github.com/sandstorm-io","followers_url":"https://api.github.com/users/sandstorm-io/followers","following_url":"https://api.github.com/users/sandstorm-io/following{/other_user}","gists_url":"https://api.github.com/users/sandstorm-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sandstorm-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandstorm-io/subscriptions","organizations_url":"https://api.github.com/users/sandstorm-io/orgs","repos_url":"https://api.github.com/users/sandstorm-io/repos","events_url":"https://api.github.com/users/sandstorm-io/events{/privacy}","received_events_url":"https://api.github.com/users/sandstorm-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sandstorm-io/sandstorm","description":"Personal Cloud Sandbox","fork":false,"url":"https://api.github.com/repos/sandstorm-io/sandstorm","forks_url":"https://api.github.com/repos/sandstorm-io/sandstorm/forks","keys_url":"https://api.github.com/repos/sandstorm-io/sandstorm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sandstorm-io/sandstorm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sandstorm-io/sandstorm/teams","hooks_url":"https://api.github.com/repos/sandstorm-io/sandstorm/hooks","issue_events_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/events{/number}","events_url":"https://api.github.com/repos/sandstorm-io/sandstorm/events","assignees_url":"https://api.github.com/repos/sandstorm-io/sandstorm/assignees{/user}","branches_url":"https://api.github.com/repos/sandstorm-io/sandstorm/branches{/branch}","tags_url":"https://api.github.com/repos/sandstorm-io/sandstorm/tags","blobs_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/refs{/sha}","trees_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sandstorm-io/sandstorm/statuses/{sha}","languages_url":"https://api.github.com/repos/sandstorm-io/sandstorm/languages","stargazers_url":"https://api.github.com/repos/sandstorm-io/sandstorm/stargazers","contributors_url":"https://api.github.com/repos/sandstorm-io/sandstorm/contributors","subscribers_url":"https://api.github.com/repos/sandstorm-io/sandstorm/subscribers","subscription_url":"https://api.github.com/repos/sandstorm-io/sandstorm/subscription","commits_url":"https://api.github.com/repos/sandstorm-io/sandstorm/commits{/sha}","git_commits_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/commits{/sha}","comments_url":"https://api.github.com/repos/sandstorm-io/sandstorm/comments{/number}","issue_comment_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/comments{/number}","contents_url":"https://api.github.com/repos/sandstorm-io/sandstorm/contents/{+path}","compare_url":"https://api.github.com/repos/sandstorm-io/sandstorm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sandstorm-io/sandstorm/merges","archive_url":"https://api.github.com/repos/sandstorm-io/sandstorm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sandstorm-io/sandstorm/downloads","issues_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues{/number}","pulls_url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls{/number}","milestones_url":"https://api.github.com/repos/sandstorm-io/sandstorm/milestones{/number}","notifications_url":"https://api.github.com/repos/sandstorm-io/sandstorm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sandstorm-io/sandstorm/labels{/name}","releases_url":"https://api.github.com/repos/sandstorm-io/sandstorm/releases{/id}","created_at":"2014-01-08T07:10:33Z","updated_at":"2015-09-23T20:39:43Z","pushed_at":"2015-09-23T21:44:56Z","git_url":"git://github.com/sandstorm-io/sandstorm.git","ssh_url":"git@github.com:sandstorm-io/sandstorm.git","clone_url":"https://github.com/sandstorm-io/sandstorm.git","svn_url":"https://github.com/sandstorm-io/sandstorm","homepage":"https://sandstorm.io","size":36439,"stargazers_count":2865,"watchers_count":2865,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":215,"mirror_url":null,"open_issues_count":189,"forks":215,"open_issues":189,"watchers":2865,"default_branch":"master"}},"base":{"label":"sandstorm-io:master","ref":"master","sha":"26a5992e3c73305c014b0687dda28a48da0af43d","user":{"login":"sandstorm-io","id":7479094,"avatar_url":"https://avatars.githubusercontent.com/u/7479094?v=3","gravatar_id":"","url":"https://api.github.com/users/sandstorm-io","html_url":"https://github.com/sandstorm-io","followers_url":"https://api.github.com/users/sandstorm-io/followers","following_url":"https://api.github.com/users/sandstorm-io/following{/other_user}","gists_url":"https://api.github.com/users/sandstorm-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sandstorm-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandstorm-io/subscriptions","organizations_url":"https://api.github.com/users/sandstorm-io/orgs","repos_url":"https://api.github.com/users/sandstorm-io/repos","events_url":"https://api.github.com/users/sandstorm-io/events{/privacy}","received_events_url":"https://api.github.com/users/sandstorm-io/received_events","type":"Organization","site_admin":false},"repo":{"id":15728293,"name":"sandstorm","full_name":"sandstorm-io/sandstorm","owner":{"login":"sandstorm-io","id":7479094,"avatar_url":"https://avatars.githubusercontent.com/u/7479094?v=3","gravatar_id":"","url":"https://api.github.com/users/sandstorm-io","html_url":"https://github.com/sandstorm-io","followers_url":"https://api.github.com/users/sandstorm-io/followers","following_url":"https://api.github.com/users/sandstorm-io/following{/other_user}","gists_url":"https://api.github.com/users/sandstorm-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sandstorm-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandstorm-io/subscriptions","organizations_url":"https://api.github.com/users/sandstorm-io/orgs","repos_url":"https://api.github.com/users/sandstorm-io/repos","events_url":"https://api.github.com/users/sandstorm-io/events{/privacy}","received_events_url":"https://api.github.com/users/sandstorm-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sandstorm-io/sandstorm","description":"Personal Cloud Sandbox","fork":false,"url":"https://api.github.com/repos/sandstorm-io/sandstorm","forks_url":"https://api.github.com/repos/sandstorm-io/sandstorm/forks","keys_url":"https://api.github.com/repos/sandstorm-io/sandstorm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sandstorm-io/sandstorm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sandstorm-io/sandstorm/teams","hooks_url":"https://api.github.com/repos/sandstorm-io/sandstorm/hooks","issue_events_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/events{/number}","events_url":"https://api.github.com/repos/sandstorm-io/sandstorm/events","assignees_url":"https://api.github.com/repos/sandstorm-io/sandstorm/assignees{/user}","branches_url":"https://api.github.com/repos/sandstorm-io/sandstorm/branches{/branch}","tags_url":"https://api.github.com/repos/sandstorm-io/sandstorm/tags","blobs_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/refs{/sha}","trees_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sandstorm-io/sandstorm/statuses/{sha}","languages_url":"https://api.github.com/repos/sandstorm-io/sandstorm/languages","stargazers_url":"https://api.github.com/repos/sandstorm-io/sandstorm/stargazers","contributors_url":"https://api.github.com/repos/sandstorm-io/sandstorm/contributors","subscribers_url":"https://api.github.com/repos/sandstorm-io/sandstorm/subscribers","subscription_url":"https://api.github.com/repos/sandstorm-io/sandstorm/subscription","commits_url":"https://api.github.com/repos/sandstorm-io/sandstorm/commits{/sha}","git_commits_url":"https://api.github.com/repos/sandstorm-io/sandstorm/git/commits{/sha}","comments_url":"https://api.github.com/repos/sandstorm-io/sandstorm/comments{/number}","issue_comment_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/comments{/number}","contents_url":"https://api.github.com/repos/sandstorm-io/sandstorm/contents/{+path}","compare_url":"https://api.github.com/repos/sandstorm-io/sandstorm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sandstorm-io/sandstorm/merges","archive_url":"https://api.github.com/repos/sandstorm-io/sandstorm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sandstorm-io/sandstorm/downloads","issues_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues{/number}","pulls_url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls{/number}","milestones_url":"https://api.github.com/repos/sandstorm-io/sandstorm/milestones{/number}","notifications_url":"https://api.github.com/repos/sandstorm-io/sandstorm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sandstorm-io/sandstorm/labels{/name}","releases_url":"https://api.github.com/repos/sandstorm-io/sandstorm/releases{/id}","created_at":"2014-01-08T07:10:33Z","updated_at":"2015-09-23T20:39:43Z","pushed_at":"2015-09-23T21:44:56Z","git_url":"git://github.com/sandstorm-io/sandstorm.git","ssh_url":"git@github.com:sandstorm-io/sandstorm.git","clone_url":"https://github.com/sandstorm-io/sandstorm.git","svn_url":"https://github.com/sandstorm-io/sandstorm","homepage":"https://sandstorm.io","size":36439,"stargazers_count":2865,"watchers_count":2865,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":215,"mirror_url":null,"open_issues_count":189,"forks":215,"open_issues":189,"watchers":2865,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900"},"html":{"href":"https://github.com/sandstorm-io/sandstorm/pull/900"},"issue":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/900"},"comments":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/900/comments"},"review_comments":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900/comments"},"review_comment":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/900/commits"},"statuses":{"href":"https://api.github.com/repos/sandstorm-io/sandstorm/statuses/ae5eaa0c3c3cead04469826ba1682c8bdeeabc1f"}}}}