GitHub PullRequestReviewCommentEvent at 2014-11-01 16:06:45
Repository: cowboy
Actor: essen
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ninenines/cowboy/pulls/comments/19705102","id":19705102,"diff_hunk":"@@ -14,11 +14,130 @@\n \n -module(cowboy_middleware).\n \n+%% API.\n+-export([execute/6]).\n+-export([resume/7]).\n+\n+%% System.\n+-export([system_continue/3]).\n+-export([system_terminate/4]).\n+-export([system_code_change/4]).\n+-export([system_get_state/1]).\n+-export([system_replace_state/2]).\n+-export([format_status/2]).\n+\n -type env() :: [{atom(), any()}].\n -export_type([env/0]).\n \n -callback execute(Req, Env)\n \t-> {ok, Req, Env}\n \t| {suspend, module(), atom(), [any()]}\n+\t| {system, {pid(), any()}, any(), module(), Req, any()}\n \t| {halt, Req}\n \twhen Req::cowboy_req:req(), Env::env().\n+\n+-record(state, {\n+\t\t  req :: cowboy_req:req(),\n+\t\t  halt :: {module(), atom(), list()},\n+\t\t  tail :: [module()],\n+\t\t  module :: module(),\n+\t\t  module_state :: any()\n+\t\t }).\n+\n+%%API.","path":"src/cowboy_middleware.erl","position":34,"original_position":34,"commit_id":"0aa8fd9fde23f829d1b14884bcc4a650dfa30ba6","original_commit_id":"0aa8fd9fde23f829d1b14884bcc4a650dfa30ba6","user":{"login":"essen","id":141739,"avatar_url":"https://avatars.githubusercontent.com/u/141739?v=2","gravatar_id":"","url":"https://api.github.com/users/essen","html_url":"https://github.com/essen","followers_url":"https://api.github.com/users/essen/followers","following_url":"https://api.github.com/users/essen/following{/other_user}","gists_url":"https://api.github.com/users/essen/gists{/gist_id}","starred_url":"https://api.github.com/users/essen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/essen/subscriptions","organizations_url":"https://api.github.com/users/essen/orgs","repos_url":"https://api.github.com/users/essen/repos","events_url":"https://api.github.com/users/essen/events{/privacy}","received_events_url":"https://api.github.com/users/essen/received_events","type":"User","site_admin":false},"body":"Record: no alignment; comment: missing space. Same everywhere.","created_at":"2014-11-01T16:06:45Z","updated_at":"2014-11-01T16:06:45Z","html_url":"https://github.com/ninenines/cowboy/pull/754#discussion_r19705102","pull_request_url":"https://api.github.com/repos/ninenines/cowboy/pulls/754","_links":{"self":{"href":"https://api.github.com/repos/ninenines/cowboy/pulls/comments/19705102"},"html":{"href":"https://github.com/ninenines/cowboy/pull/754#discussion_r19705102"},"pull_request":{"href":"https://api.github.com/repos/ninenines/cowboy/pulls/754"}}},"pull_request":{"url":"https://api.github.com/repos/ninenines/cowboy/pulls/754","id":22554704,"html_url":"https://github.com/ninenines/cowboy/pull/754","diff_url":"https://github.com/ninenines/cowboy/pull/754.diff","patch_url":"https://github.com/ninenines/cowboy/pull/754.patch","issue_url":"https://api.github.com/repos/ninenines/cowboy/issues/754","number":754,"state":"open","locked":false,"title":"Add basic support for system messages","user":{"login":"fishcakez","id":2001229,"avatar_url":"https://avatars.githubusercontent.com/u/2001229?v=2","gravatar_id":"","url":"https://api.github.com/users/fishcakez","html_url":"https://github.com/fishcakez","followers_url":"https://api.github.com/users/fishcakez/followers","following_url":"https://api.github.com/users/fishcakez/following{/other_user}","gists_url":"https://api.github.com/users/fishcakez/gists{/gist_id}","starred_url":"https://api.github.com/users/fishcakez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fishcakez/subscriptions","organizations_url":"https://api.github.com/users/fishcakez/orgs","repos_url":"https://api.github.com/users/fishcakez/repos","events_url":"https://api.github.com/users/fishcakez/events{/privacy}","received_events_url":"https://api.github.com/users/fishcakez/received_events","type":"User","site_admin":false},"body":"This changes performs the first step of #750, a simplified version with much improved testing. All system messages are handled by `cowboy_protocol` or `cowboy_middleware`. Middlewares, sub_protocols (and handlers) can not change how system messages are handled.\r\n\r\nTo have `cowboy_middleware` handle a system message a middleware (or sub_protocol) returns:\r\n```erlang\r\n{system, From, Msg, Module, Req, State}\r\n```\r\nOnce the system message(s) have been handled control is passed back to the middleware via a `cowboy_sys` callback. Either to continue processing as before:\r\n```erlang\r\nsys_continue(Req, #state{env=Env}) ->\r\n    {ok, Req, Env}.\r\n```\r\nOr to terminate with reason `Reason`:\r\n```erlang\r\nsys_terminate(Reason, _Req, _State) ->\r\n    exit(Reason).\r\n```\r\n\r\nFor more information please see the commit message or the additions to the guide.\r\n\r\nHelp is required to test handling of system messages when a websocket handler receives the message in the  `websocket_payload_loop` receive clause.","created_at":"2014-10-10T11:37:42Z","updated_at":"2014-11-01T16:06:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"478b3ccfea2a8876336e2a294e93407cc05eed0f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ninenines/cowboy/pulls/754/commits","review_comments_url":"https://api.github.com/repos/ninenines/cowboy/pulls/754/comments","review_comment_url":"https://api.github.com/repos/ninenines/cowboy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ninenines/cowboy/issues/754/comments","statuses_url":"https://api.github.com/repos/ninenines/cowboy/statuses/0aa8fd9fde23f829d1b14884bcc4a650dfa30ba6","head":{"label":"fishcakez:sys_msgs","ref":"sys_msgs","sha":"0aa8fd9fde23f829d1b14884bcc4a650dfa30ba6","user":{"login":"fishcakez","id":2001229,"avatar_url":"https://avatars.githubusercontent.com/u/2001229?v=2","gravatar_id":"","url":"https://api.github.com/users/fishcakez","html_url":"https://github.com/fishcakez","followers_url":"https://api.github.com/users/fishcakez/followers","following_url":"https://api.github.com/users/fishcakez/following{/other_user}","gists_url":"https://api.github.com/users/fishcakez/gists{/gist_id}","starred_url":"https://api.github.com/users/fishcakez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fishcakez/subscriptions","organizations_url":"https://api.github.com/users/fishcakez/orgs","repos_url":"https://api.github.com/users/fishcakez/repos","events_url":"https://api.github.com/users/fishcakez/events{/privacy}","received_events_url":"https://api.github.com/users/fishcakez/received_events","type":"User","site_admin":false},"repo":{"id":8210440,"name":"cowboy","full_name":"fishcakez/cowboy","owner":{"login":"fishcakez","id":2001229,"avatar_url":"https://avatars.githubusercontent.com/u/2001229?v=2","gravatar_id":"","url":"https://api.github.com/users/fishcakez","html_url":"https://github.com/fishcakez","followers_url":"https://api.github.com/users/fishcakez/followers","following_url":"https://api.github.com/users/fishcakez/following{/other_user}","gists_url":"https://api.github.com/users/fishcakez/gists{/gist_id}","starred_url":"https://api.github.com/users/fishcakez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fishcakez/subscriptions","organizations_url":"https://api.github.com/users/fishcakez/orgs","repos_url":"https://api.github.com/users/fishcakez/repos","events_url":"https://api.github.com/users/fishcakez/events{/privacy}","received_events_url":"https://api.github.com/users/fishcakez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fishcakez/cowboy","description":"Small, fast, modular HTTP server written in Erlang.","fork":true,"url":"https://api.github.com/repos/fishcakez/cowboy","forks_url":"https://api.github.com/repos/fishcakez/cowboy/forks","keys_url":"https://api.github.com/repos/fishcakez/cowboy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fishcakez/cowboy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fishcakez/cowboy/teams","hooks_url":"https://api.github.com/repos/fishcakez/cowboy/hooks","issue_events_url":"https://api.github.com/repos/fishcakez/cowboy/issues/events{/number}","events_url":"https://api.github.com/repos/fishcakez/cowboy/events","assignees_url":"https://api.github.com/repos/fishcakez/cowboy/assignees{/user}","branches_url":"https://api.github.com/repos/fishcakez/cowboy/branches{/branch}","tags_url":"https://api.github.com/repos/fishcakez/cowboy/tags","blobs_url":"https://api.github.com/repos/fishcakez/cowboy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fishcakez/cowboy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fishcakez/cowboy/git/refs{/sha}","trees_url":"https://api.github.com/repos/fishcakez/cowboy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fishcakez/cowboy/statuses/{sha}","languages_url":"https://api.github.com/repos/fishcakez/cowboy/languages","stargazers_url":"https://api.github.com/repos/fishcakez/cowboy/stargazers","contributors_url":"https://api.github.com/repos/fishcakez/cowboy/contributors","subscribers_url":"https://api.github.com/repos/fishcakez/cowboy/subscribers","subscription_url":"https://api.github.com/repos/fishcakez/cowboy/subscription","commits_url":"https://api.github.com/repos/fishcakez/cowboy/commits{/sha}","git_commits_url":"https://api.github.com/repos/fishcakez/cowboy/git/commits{/sha}","comments_url":"https://api.github.com/repos/fishcakez/cowboy/comments{/number}","issue_comment_url":"https://api.github.com/repos/fishcakez/cowboy/issues/comments/{number}","contents_url":"https://api.github.com/repos/fishcakez/cowboy/contents/{+path}","compare_url":"https://api.github.com/repos/fishcakez/cowboy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fishcakez/cowboy/merges","archive_url":"https://api.github.com/repos/fishcakez/cowboy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fishcakez/cowboy/downloads","issues_url":"https://api.github.com/repos/fishcakez/cowboy/issues{/number}","pulls_url":"https://api.github.com/repos/fishcakez/cowboy/pulls{/number}","milestones_url":"https://api.github.com/repos/fishcakez/cowboy/milestones{/number}","notifications_url":"https://api.github.com/repos/fishcakez/cowboy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fishcakez/cowboy/labels{/name}","releases_url":"https://api.github.com/repos/fishcakez/cowboy/releases{/id}","created_at":"2013-02-15T00:15:48Z","updated_at":"2014-08-01T12:49:55Z","pushed_at":"2014-10-10T11:34:39Z","git_url":"git://github.com/fishcakez/cowboy.git","ssh_url":"git@github.com:fishcakez/cowboy.git","clone_url":"https://github.com/fishcakez/cowboy.git","svn_url":"https://github.com/fishcakez/cowboy","homepage":"http://ninenines.eu","size":5778,"stargazers_count":0,"watchers_count":0,"language":"Erlang","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":"ninenines:master","ref":"master","sha":"b87150c713fe16601b314451b2fe25b62bd820bb","user":{"login":"ninenines","id":1166740,"avatar_url":"https://avatars.githubusercontent.com/u/1166740?v=2","gravatar_id":"","url":"https://api.github.com/users/ninenines","html_url":"https://github.com/ninenines","followers_url":"https://api.github.com/users/ninenines/followers","following_url":"https://api.github.com/users/ninenines/following{/other_user}","gists_url":"https://api.github.com/users/ninenines/gists{/gist_id}","starred_url":"https://api.github.com/users/ninenines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ninenines/subscriptions","organizations_url":"https://api.github.com/users/ninenines/orgs","repos_url":"https://api.github.com/users/ninenines/repos","events_url":"https://api.github.com/users/ninenines/events{/privacy}","received_events_url":"https://api.github.com/users/ninenines/received_events","type":"Organization","site_admin":false},"repo":{"id":1460612,"name":"cowboy","full_name":"ninenines/cowboy","owner":{"login":"ninenines","id":1166740,"avatar_url":"https://avatars.githubusercontent.com/u/1166740?v=2","gravatar_id":"","url":"https://api.github.com/users/ninenines","html_url":"https://github.com/ninenines","followers_url":"https://api.github.com/users/ninenines/followers","following_url":"https://api.github.com/users/ninenines/following{/other_user}","gists_url":"https://api.github.com/users/ninenines/gists{/gist_id}","starred_url":"https://api.github.com/users/ninenines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ninenines/subscriptions","organizations_url":"https://api.github.com/users/ninenines/orgs","repos_url":"https://api.github.com/users/ninenines/repos","events_url":"https://api.github.com/users/ninenines/events{/privacy}","received_events_url":"https://api.github.com/users/ninenines/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ninenines/cowboy","description":"Small, fast, modular HTTP server written in Erlang.","fork":false,"url":"https://api.github.com/repos/ninenines/cowboy","forks_url":"https://api.github.com/repos/ninenines/cowboy/forks","keys_url":"https://api.github.com/repos/ninenines/cowboy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ninenines/cowboy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ninenines/cowboy/teams","hooks_url":"https://api.github.com/repos/ninenines/cowboy/hooks","issue_events_url":"https://api.github.com/repos/ninenines/cowboy/issues/events{/number}","events_url":"https://api.github.com/repos/ninenines/cowboy/events","assignees_url":"https://api.github.com/repos/ninenines/cowboy/assignees{/user}","branches_url":"https://api.github.com/repos/ninenines/cowboy/branches{/branch}","tags_url":"https://api.github.com/repos/ninenines/cowboy/tags","blobs_url":"https://api.github.com/repos/ninenines/cowboy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ninenines/cowboy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ninenines/cowboy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ninenines/cowboy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ninenines/cowboy/statuses/{sha}","languages_url":"https://api.github.com/repos/ninenines/cowboy/languages","stargazers_url":"https://api.github.com/repos/ninenines/cowboy/stargazers","contributors_url":"https://api.github.com/repos/ninenines/cowboy/contributors","subscribers_url":"https://api.github.com/repos/ninenines/cowboy/subscribers","subscription_url":"https://api.github.com/repos/ninenines/cowboy/subscription","commits_url":"https://api.github.com/repos/ninenines/cowboy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ninenines/cowboy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ninenines/cowboy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ninenines/cowboy/issues/comments/{number}","contents_url":"https://api.github.com/repos/ninenines/cowboy/contents/{+path}","compare_url":"https://api.github.com/repos/ninenines/cowboy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ninenines/cowboy/merges","archive_url":"https://api.github.com/repos/ninenines/cowboy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ninenines/cowboy/downloads","issues_url":"https://api.github.com/repos/ninenines/cowboy/issues{/number}","pulls_url":"https://api.github.com/repos/ninenines/cowboy/pulls{/number}","milestones_url":"https://api.github.com/repos/ninenines/cowboy/milestones{/number}","notifications_url":"https://api.github.com/repos/ninenines/cowboy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ninenines/cowboy/labels{/name}","releases_url":"https://api.github.com/repos/ninenines/cowboy/releases{/id}","created_at":"2011-03-09T19:55:52Z","updated_at":"2014-11-01T08:21:43Z","pushed_at":"2014-10-04T15:31:22Z","git_url":"git://github.com/ninenines/cowboy.git","ssh_url":"git@github.com:ninenines/cowboy.git","clone_url":"https://github.com/ninenines/cowboy.git","svn_url":"https://github.com/ninenines/cowboy","homepage":"http://ninenines.eu","size":9597,"stargazers_count":1747,"watchers_count":1747,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":481,"mirror_url":null,"open_issues_count":22,"forks":481,"open_issues":22,"watchers":1747,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ninenines/cowboy/pulls/754"},"html":{"href":"https://github.com/ninenines/cowboy/pull/754"},"issue":{"href":"https://api.github.com/repos/ninenines/cowboy/issues/754"},"comments":{"href":"https://api.github.com/repos/ninenines/cowboy/issues/754/comments"},"review_comments":{"href":"https://api.github.com/repos/ninenines/cowboy/pulls/754/comments"},"review_comment":{"href":"https://api.github.com/repos/ninenines/cowboy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ninenines/cowboy/pulls/754/commits"},"statuses":{"href":"https://api.github.com/repos/ninenines/cowboy/statuses/0aa8fd9fde23f829d1b14884bcc4a650dfa30ba6"}}}}