{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/comments/222612580","pull_request_review_id":161539753,"id":222612580,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjYxMjU4MA==","diff_hunk":"@@ -410,104 +307,79 @@ function handle_connection(f::Function, c::Connection;\n     return\n end\n \n+\"creates an async thread that waits a specified amount of time before closing the connection\"\n+function check_readtimeout(c, readtimeout, wait_for_timeout)\n+    @async while wait_for_timeout[]\n+        if inactiveseconds(c) > readtimeout\n+            @warn \"Connection Timeout: $c\"\n+            try\n+                writeheaders(c.io, Response(408, [\"Connection\" => \"close\"]))\n+            finally\n+                close(c)\n+            end\n+            break\n+        end\n+        sleep(8 + rand() * 4)\n+    end\n+    return\n+end\n \n \"\"\"\n-Create a `HTTP.Stream` and parse the Request headers from a `HTTP.Transaction`.\n-If there is a parse error, send an error Response.\n-Otherwise, execute stream processing function `f`.\n+Transaction handler: creates a new Stream for the Transaction, calls startread on it,\n+then dispatches the stream to the user-provided handler function. Catches errors on all\n+IO operations and closes gracefully if encountered.\n \"\"\"\n-function handle_transaction(f::Function, t::Transaction;\n-                            final_transaction::Bool=false,\n-                            verbose::Bool=false, kw...)\n-\n-    request = HTTP.Request()\n-    http = Streams.Stream(request, t)\n+function handle(h, t::Transaction, last::Bool=false)\n+    request = Request()\n+    http = Stream(request, t)\n \n     try\n         startread(http)\n     catch e\n-        # @show typeof(e)\n-        # @show fieldnames(e)\n         if e isa EOFError && isempty(request.method)\n             return\n-# FIXME https://github.com/JuliaWeb/HTTP.jl/pull/178#pullrequestreview-92547066","path":"src/Servers.jl","position":619,"original_position":619,"commit_id":"c25362c72c493dcfffe93a777d06009aee6c69f5","original_commit_id":"c25362c72c493dcfffe93a777d06009aee6c69f5","user":{"login":"samoconnor","id":8266283,"node_id":"MDQ6VXNlcjgyNjYyODM=","avatar_url":"https://avatars2.githubusercontent.com/u/8266283?v=4","gravatar_id":"","url":"https://api.github.com/users/samoconnor","html_url":"https://github.com/samoconnor","followers_url":"https://api.github.com/users/samoconnor/followers","following_url":"https://api.github.com/users/samoconnor/following{/other_user}","gists_url":"https://api.github.com/users/samoconnor/gists{/gist_id}","starred_url":"https://api.github.com/users/samoconnor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samoconnor/subscriptions","organizations_url":"https://api.github.com/users/samoconnor/orgs","repos_url":"https://api.github.com/users/samoconnor/repos","events_url":"https://api.github.com/users/samoconnor/events{/privacy}","received_events_url":"https://api.github.com/users/samoconnor/received_events","type":"User","site_admin":false},"body":"Hmm, seems like this link has gone dead.","created_at":"2018-10-04T10:17:43Z","updated_at":"2018-10-04T10:17:43Z","html_url":"https://github.com/JuliaWeb/HTTP.jl/pull/301#discussion_r222612580","pull_request_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/comments/222612580"},"html":{"href":"https://github.com/JuliaWeb/HTTP.jl/pull/301#discussion_r222612580"},"pull_request":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301","id":215752679,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NzUyNjc5","html_url":"https://github.com/JuliaWeb/HTTP.jl/pull/301","diff_url":"https://github.com/JuliaWeb/HTTP.jl/pull/301.diff","patch_url":"https://github.com/JuliaWeb/HTTP.jl/pull/301.patch","issue_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/301","number":301,"state":"open","locked":false,"title":"Refactor HTTP.Servers & HTTP.Handlers","user":{"login":"quinnj","id":2896623,"node_id":"MDQ6VXNlcjI4OTY2MjM=","avatar_url":"https://avatars3.githubusercontent.com/u/2896623?v=4","gravatar_id":"","url":"https://api.github.com/users/quinnj","html_url":"https://github.com/quinnj","followers_url":"https://api.github.com/users/quinnj/followers","following_url":"https://api.github.com/users/quinnj/following{/other_user}","gists_url":"https://api.github.com/users/quinnj/gists{/gist_id}","starred_url":"https://api.github.com/users/quinnj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quinnj/subscriptions","organizations_url":"https://api.github.com/users/quinnj/orgs","repos_url":"https://api.github.com/users/quinnj/repos","events_url":"https://api.github.com/users/quinnj/events{/privacy}","received_events_url":"https://api.github.com/users/quinnj/received_events","type":"User","site_admin":false},"body":"Changes include:\r\n  * Finishing up the 0.6-dropping of compat blocks\r\n  * Refactoring the split between HTTP.Servers & HTTP.Handlers; `Handlers` is now an independent module that `Servers` imports; `Handlers` defines the `Handler` abstract type and `handle` interface function; it also now defines `RequestHandler <: Hanlder` and `StreamHandler <: Handler`, with corresponding `XFunction` wrapper definitions. This cleans up the awkwardness of using `applicable` in the lowest `handle_stream` method and makes everything generic: at the lowest level, we just call `handle(h, stream`, and there's a default `handle(h::RequestHandler, s::Stream)` definition that then calls `handle(h, req::Request)`. Quite a wonderful application of multiple dispatch if I do say so.\r\n  * Proper deprecation of `HTTP.serve` and removal of all the nonsense-constructors and such\r\n  * Refactors the HTTP.Router type to be precompile-friendly; registering routes is now `HTTP.@register!(r, path, handler)` instead of the functional form\r\n\r\nWill close:\r\n  * #294 \r\n  * #258\r\n  * #189 \r\n  * #91\r\n  * #137\r\n  * #157\r\n  * #163\r\n  * And provides a proper solution to https://github.com/JuliaWeb/HTTP.jl/issues/226\r\n\r\nI still plan on doing a thorough round of doc updates and some performance review.","created_at":"2018-09-15T06:09:40Z","updated_at":"2018-10-04T10:17:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4546fba0f3c6c775ebcb21adf9de3522551cb453","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301/commits","review_comments_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301/comments","review_comment_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/301/comments","statuses_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/statuses/c25362c72c493dcfffe93a777d06009aee6c69f5","head":{"label":"JuliaWeb:jq/servers","ref":"jq/servers","sha":"c25362c72c493dcfffe93a777d06009aee6c69f5","user":{"login":"JuliaWeb","id":8564604,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NjQ2MDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8564604?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaWeb","html_url":"https://github.com/JuliaWeb","followers_url":"https://api.github.com/users/JuliaWeb/followers","following_url":"https://api.github.com/users/JuliaWeb/following{/other_user}","gists_url":"https://api.github.com/users/JuliaWeb/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaWeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaWeb/subscriptions","organizations_url":"https://api.github.com/users/JuliaWeb/orgs","repos_url":"https://api.github.com/users/JuliaWeb/repos","events_url":"https://api.github.com/users/JuliaWeb/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaWeb/received_events","type":"Organization","site_admin":false},"repo":{"id":75249739,"node_id":"MDEwOlJlcG9zaXRvcnk3NTI0OTczOQ==","name":"HTTP.jl","full_name":"JuliaWeb/HTTP.jl","private":false,"owner":{"login":"JuliaWeb","id":8564604,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NjQ2MDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8564604?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaWeb","html_url":"https://github.com/JuliaWeb","followers_url":"https://api.github.com/users/JuliaWeb/followers","following_url":"https://api.github.com/users/JuliaWeb/following{/other_user}","gists_url":"https://api.github.com/users/JuliaWeb/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaWeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaWeb/subscriptions","organizations_url":"https://api.github.com/users/JuliaWeb/orgs","repos_url":"https://api.github.com/users/JuliaWeb/repos","events_url":"https://api.github.com/users/JuliaWeb/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaWeb/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/JuliaWeb/HTTP.jl","description":"HTTP for Julia","fork":false,"url":"https://api.github.com/repos/JuliaWeb/HTTP.jl","forks_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/forks","keys_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/teams","hooks_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/events","assignees_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/tags","blobs_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/subscription","commits_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/merges","archive_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/downloads","issues_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/deployments","created_at":"2016-12-01T03:05:14Z","updated_at":"2018-10-01T23:09:52Z","pushed_at":"2018-10-04T09:17:29Z","git_url":"git://github.com/JuliaWeb/HTTP.jl.git","ssh_url":"git@github.com:JuliaWeb/HTTP.jl.git","clone_url":"https://github.com/JuliaWeb/HTTP.jl.git","svn_url":"https://github.com/JuliaWeb/HTTP.jl","homepage":"https://juliaweb.github.io/HTTP.jl/stable/","size":2407,"stargazers_count":114,"watchers_count":114,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":42,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":42,"open_issues":42,"watchers":114,"default_branch":"master"}},"base":{"label":"JuliaWeb:master","ref":"master","sha":"01a2cff816e3cd6095990b80167f216cb26e906c","user":{"login":"JuliaWeb","id":8564604,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NjQ2MDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8564604?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaWeb","html_url":"https://github.com/JuliaWeb","followers_url":"https://api.github.com/users/JuliaWeb/followers","following_url":"https://api.github.com/users/JuliaWeb/following{/other_user}","gists_url":"https://api.github.com/users/JuliaWeb/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaWeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaWeb/subscriptions","organizations_url":"https://api.github.com/users/JuliaWeb/orgs","repos_url":"https://api.github.com/users/JuliaWeb/repos","events_url":"https://api.github.com/users/JuliaWeb/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaWeb/received_events","type":"Organization","site_admin":false},"repo":{"id":75249739,"node_id":"MDEwOlJlcG9zaXRvcnk3NTI0OTczOQ==","name":"HTTP.jl","full_name":"JuliaWeb/HTTP.jl","private":false,"owner":{"login":"JuliaWeb","id":8564604,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NjQ2MDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8564604?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaWeb","html_url":"https://github.com/JuliaWeb","followers_url":"https://api.github.com/users/JuliaWeb/followers","following_url":"https://api.github.com/users/JuliaWeb/following{/other_user}","gists_url":"https://api.github.com/users/JuliaWeb/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaWeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaWeb/subscriptions","organizations_url":"https://api.github.com/users/JuliaWeb/orgs","repos_url":"https://api.github.com/users/JuliaWeb/repos","events_url":"https://api.github.com/users/JuliaWeb/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaWeb/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/JuliaWeb/HTTP.jl","description":"HTTP for Julia","fork":false,"url":"https://api.github.com/repos/JuliaWeb/HTTP.jl","forks_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/forks","keys_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/teams","hooks_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/events","assignees_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/tags","blobs_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/subscription","commits_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/merges","archive_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/downloads","issues_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaWeb/HTTP.jl/deployments","created_at":"2016-12-01T03:05:14Z","updated_at":"2018-10-01T23:09:52Z","pushed_at":"2018-10-04T09:17:29Z","git_url":"git://github.com/JuliaWeb/HTTP.jl.git","ssh_url":"git@github.com:JuliaWeb/HTTP.jl.git","clone_url":"https://github.com/JuliaWeb/HTTP.jl.git","svn_url":"https://github.com/JuliaWeb/HTTP.jl","homepage":"https://juliaweb.github.io/HTTP.jl/stable/","size":2407,"stargazers_count":114,"watchers_count":114,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":42,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":42,"open_issues":42,"watchers":114,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301"},"html":{"href":"https://github.com/JuliaWeb/HTTP.jl/pull/301"},"issue":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/301"},"comments":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/issues/301/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/pulls/301/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaWeb/HTTP.jl/statuses/c25362c72c493dcfffe93a777d06009aee6c69f5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"samoconnor"}}