{"action":"created","issue":{"url":"https://api.github.com/repos/pyr/net/issues/1","repository_url":"https://api.github.com/repos/pyr/net","labels_url":"https://api.github.com/repos/pyr/net/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/pyr/net/issues/1/comments","events_url":"https://api.github.com/repos/pyr/net/issues/1/events","html_url":"https://github.com/pyr/net/pull/1","id":192415153,"number":1,"title":"[WIP] http-server: core.async chunked server","user":{"login":"pyr","id":110280,"avatar_url":"https://avatars.githubusercontent.com/u/110280?v=3","gravatar_id":"","url":"https://api.github.com/users/pyr","html_url":"https://github.com/pyr","followers_url":"https://api.github.com/users/pyr/followers","following_url":"https://api.github.com/users/pyr/following{/other_user}","gists_url":"https://api.github.com/users/pyr/gists{/gist_id}","starred_url":"https://api.github.com/users/pyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyr/subscriptions","organizations_url":"https://api.github.com/users/pyr/orgs","repos_url":"https://api.github.com/users/pyr/repos","events_url":"https://api.github.com/users/pyr/events{/privacy}","received_events_url":"https://api.github.com/users/pyr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-29T22:04:21Z","updated_at":"2016-12-01T16:52:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyr/net/pulls/1","html_url":"https://github.com/pyr/net/pull/1","diff_url":"https://github.com/pyr/net/pull/1.diff","patch_url":"https://github.com/pyr/net/pull/1.patch"},"body":"This provides a more versatile `run-server` API which supports arbitrary body length.\r\nWhen receiving data in chunks, they may be adapted to a user-supplied length.\r\n\r\nThe previous server API which aggregated body is being decommissioned as part of this PR.\r\n\r\nHere is an example *echo* HTTP server which writes chunks back to the emitter.\r\n\r\n```clojure\r\n(require '[clojure.core.async :as a])\r\n(require '[net.http.server :as http])\r\n\r\n(defn async-handler\r\n  [{:keys [headers] :as request}]\r\n  (a/go\r\n    (let [body (a/chan 10)\r\n          type (:content-type headers \"application/binary\")]\r\n      (a/pipe (:body request) body) ;; pipe from request to response\r\n      {:status  200\r\n       :headers {\"Content-Type\" type\r\n                 \"Transfer-Encoding\" \"chunked\"}\r\n       :body body})))\r\n\r\n(def server (http/run-server {:ring-handler async-handler}))\r\n```\r\nTODO:\r\n\r\n- [x] Aggregate requests below a certain size threshold.\r\n- [x] Parse body params for small requests of type `application/x-www-form-urlencoded`.\r\n- [ ] Ensure unpooled `ByteBuf`s are properly released.\r\n- [x] Handle backpressure to avoid filling up channel buffers."},"comment":{"url":"https://api.github.com/repos/pyr/net/issues/comments/264227406","html_url":"https://github.com/pyr/net/pull/1#issuecomment-264227406","issue_url":"https://api.github.com/repos/pyr/net/issues/1","id":264227406,"user":{"login":"pyr","id":110280,"avatar_url":"https://avatars.githubusercontent.com/u/110280?v=3","gravatar_id":"","url":"https://api.github.com/users/pyr","html_url":"https://github.com/pyr","followers_url":"https://api.github.com/users/pyr/followers","following_url":"https://api.github.com/users/pyr/following{/other_user}","gists_url":"https://api.github.com/users/pyr/gists{/gist_id}","starred_url":"https://api.github.com/users/pyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyr/subscriptions","organizations_url":"https://api.github.com/users/pyr/orgs","repos_url":"https://api.github.com/users/pyr/repos","events_url":"https://api.github.com/users/pyr/events{/privacy}","received_events_url":"https://api.github.com/users/pyr/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T16:52:18Z","updated_at":"2016-12-01T16:52:18Z","body":"Thanks :-)"}}
{"actor":{"display_login":"pyr"}}