{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/discovery.etcd.io/issues/33","labels_url":"https://api.github.com/repos/coreos/discovery.etcd.io/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/coreos/discovery.etcd.io/issues/33/comments","events_url":"https://api.github.com/repos/coreos/discovery.etcd.io/issues/33/events","html_url":"https://github.com/coreos/discovery.etcd.io/pull/33","id":94867717,"number":33,"title":"handlers: flush header before copying body","user":{"login":"yichengq","id":2976232,"avatar_url":"https://avatars.githubusercontent.com/u/2976232?v=3","gravatar_id":"","url":"https://api.github.com/users/yichengq","html_url":"https://github.com/yichengq","followers_url":"https://api.github.com/users/yichengq/followers","following_url":"https://api.github.com/users/yichengq/following{/other_user}","gists_url":"https://api.github.com/users/yichengq/gists{/gist_id}","starred_url":"https://api.github.com/users/yichengq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yichengq/subscriptions","organizations_url":"https://api.github.com/users/yichengq/orgs","repos_url":"https://api.github.com/users/yichengq/repos","events_url":"https://api.github.com/users/yichengq/events{/privacy}","received_events_url":"https://api.github.com/users/yichengq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-14T04:51:27Z","updated_at":"2015-07-30T22:47:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/coreos/discovery.etcd.io/pulls/33","html_url":"https://github.com/coreos/discovery.etcd.io/pull/33","diff_url":"https://github.com/coreos/discovery.etcd.io/pull/33.diff","patch_url":"https://github.com/coreos/discovery.etcd.io/pull/33.patch"},"body":"This helps watch to return HTTP response header first, so client could\r\nknow that the watch is happening.\r\n\r\nMove the code from github.com/gorilla/handlers.loggingHandler into http pkg so i could add flush support on it. The reasons of move are two: 1. the repo has discussion about adding flush support, but ends up with no changes 2. the thing needs to be fixed before 2.1 release.\r\n\r\nThe watch now:\r\n```\r\n$ curl -v http://localhost:8000/9d7d774171b8b979294132884acbd2f8\\?wait\\=true\r\n* Hostname was NOT found in DNS cache\r\n*   Trying ::1...\r\n* connect to ::1 port 8000 failed: Connection refused\r\n*   Trying 127.0.0.1...\r\n* Connected to localhost (127.0.0.1) port 8000 (#0)\r\n> GET /9d7d774171b8b979294132884acbd2f8?wait=true HTTP/1.1\r\n> User-Agent: curl/7.39.0\r\n> Host: localhost:8000\r\n> Accept: */*\r\n>\r\n< HTTP/1.1 200 OK\r\n< Content-Type: application/json\r\n< Date: Tue, 14 Jul 2015 04:51:59 GMT\r\n< X-Etcd-Cluster-Id: 7e27652122e8b2ae\r\n< X-Etcd-Index: 5\r\n< X-Raft-Index: 7492\r\n< X-Raft-Term: 2\r\n< Transfer-Encoding: chunked\r\n<\r\n\r\n```\r\n\r\nfixes #32 \r\nhelps https://github.com/coreos/etcd/issues/3126"},"comment":{"url":"https://api.github.com/repos/coreos/discovery.etcd.io/issues/comments/126513224","html_url":"https://github.com/coreos/discovery.etcd.io/pull/33#issuecomment-126513224","issue_url":"https://api.github.com/repos/coreos/discovery.etcd.io/issues/33","id":126513224,"user":{"login":"yichengq","id":2976232,"avatar_url":"https://avatars.githubusercontent.com/u/2976232?v=3","gravatar_id":"","url":"https://api.github.com/users/yichengq","html_url":"https://github.com/yichengq","followers_url":"https://api.github.com/users/yichengq/followers","following_url":"https://api.github.com/users/yichengq/following{/other_user}","gists_url":"https://api.github.com/users/yichengq/gists{/gist_id}","starred_url":"https://api.github.com/users/yichengq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yichengq/subscriptions","organizations_url":"https://api.github.com/users/yichengq/orgs","repos_url":"https://api.github.com/users/yichengq/repos","events_url":"https://api.github.com/users/yichengq/events{/privacy}","received_events_url":"https://api.github.com/users/yichengq/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T22:47:37Z","updated_at":"2015-07-30T22:47:37Z","body":"1. This change is to let discovery service proxy the request better. The server side has the case that it may send header first and then body, and the client needs to receive header fast sometimes, so the proxy needs to be improved to satisfy the requirement.\r\n\r\n2. We follow HTTP Streaming specification to design this. You could check its details here: https://tools.ietf.org/html/rfc6202#section-3 The schematics here tries to use the underlying long-live connection best."}}