GitHub PullRequestReviewCommentEvent at 2014-09-12 20:54:38
Repository: etcd
Actor: jonboulle
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd/pulls/comments/17502050","id":17502050,"diff_hunk":"@@ -0,0 +1,120 @@\n+package proxy\n+\n+import (\n+\t\"io\"\n+\t\"log\"\n+\t\"net\"\n+\t\"net/http\"\n+\t\"net/url\"\n+\t\"strings\"\n+)\n+\n+// Hop-by-hop headers. These are removed when sent to the backend.\n+// http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html\n+// This list of headers borrowed from stdlib httputil.ReverseProxy\n+var singleHopHeaders = []string{\n+\t\"Connection\",\n+\t\"Keep-Alive\",\n+\t\"Proxy-Authenticate\",\n+\t\"Proxy-Authorization\",\n+\t\"Te\", // canonicalized version of \"TE\"\n+\t\"Trailers\",\n+\t\"Transfer-Encoding\",\n+\t\"Upgrade\",\n+}\n+\n+func removeSingleHopHeaders(hdrs *http.Header) {\n+\tfor _, h := range singleHopHeaders {\n+\t\thdrs.Del(h)\n+\t}\n+}\n+\n+type reverseProxy struct {\n+\tdirector  *director\n+\ttransport http.RoundTripper\n+}\n+\n+func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request) {\n+\tproxyreq := new(http.Request)\n+\t*proxyreq = *clientreq\n+\n+\t// deep-copy the headers, as these will be modified below\n+\tproxyreq.Header = make(http.Header)\n+\tcopyHeader(proxyreq.Header, clientreq.Header)\n+\n+\tnormalizeRequest(proxyreq)\n+\tremoveSingleHopHeaders(&proxyreq.Header)\n+\tmaybeSetForwardedFor(proxyreq)\n+\n+\tendpoints := p.director.endpoints()\n+\tif len(endpoints) == 0 {\n+\t\tlog.Printf(\"proxy: zero endpoints currently available\")\n+\t\trw.WriteHeader(http.StatusServiceUnavailable)\n+\t\treturn\n+\t}\n+\n+\tvar res *http.Response\n+\tvar err error\n+\n+\tfor _, ep := range endpoints {\n+\t\tredirectRequest(proxyreq, ep.URL)\n+\n+\t\tres, err = p.transport.RoundTrip(proxyreq)\n+\t\tif err != nil {","path":"proxy/reverse.go","position":63,"original_position":63,"commit_id":"f7b10dce54a157f84976e771463ba2617f06b4c6","original_commit_id":"f7b10dce54a157f84976e771463ba2617f06b4c6","user":{"login":"jonboulle","id":2601015,"avatar_url":"https://avatars.githubusercontent.com/u/2601015?v=2","gravatar_id":"0f0b8b324fd58974000aacebb9b66c65","url":"https://api.github.com/users/jonboulle","html_url":"https://github.com/jonboulle","followers_url":"https://api.github.com/users/jonboulle/followers","following_url":"https://api.github.com/users/jonboulle/following{/other_user}","gists_url":"https://api.github.com/users/jonboulle/gists{/gist_id}","starred_url":"https://api.github.com/users/jonboulle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonboulle/subscriptions","organizations_url":"https://api.github.com/users/jonboulle/orgs","repos_url":"https://api.github.com/users/jonboulle/repos","events_url":"https://api.github.com/users/jonboulle/events{/privacy}","received_events_url":"https://api.github.com/users/jonboulle/received_events","type":"User","site_admin":false},"body":"I'm just looking at the cases in which RoundTrip will throw an error: http://golang.org/src/pkg/net/http/transport.go?s=5487:5558#L154","created_at":"2014-09-12T20:54:38Z","updated_at":"2014-09-12T20:54:38Z","html_url":"https://github.com/coreos/etcd/pull/1055#discussion_r17502050","pull_request_url":"https://api.github.com/repos/coreos/etcd/pulls/1055","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/17502050"},"html":{"href":"https://github.com/coreos/etcd/pull/1055#discussion_r17502050"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd/pulls/1055"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/1055","id":21100026,"html_url":"https://github.com/coreos/etcd/pull/1055","diff_url":"https://github.com/coreos/etcd/pull/1055.diff","patch_url":"https://github.com/coreos/etcd/pull/1055.patch","issue_url":"https://api.github.com/repos/coreos/etcd/issues/1055","number":1055,"state":"open","locked":false,"title":"proxy mode, pt 2","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=2","gravatar_id":"3fa4bd3403b1a81ac43f4769c8f74b66","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"body":"The ReverseProxy code from the standard library doesn't actually\r\ngive us the control that we want. Pull it down and rip out what\r\nwe don't need, adding tests in the process.","created_at":"2014-09-11T16:30:47Z","updated_at":"2014-09-12T20:54:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1cbbf82a31cde4b9607717c3c9a0e0ca53a53ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd/pulls/1055/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd/pulls/1055/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd/pulls/comments/{number}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/1055/comments","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/f7b10dce54a157f84976e771463ba2617f06b4c6","head":{"label":"bcwaldon:proxy-monster","ref":"proxy-monster","sha":"f7b10dce54a157f84976e771463ba2617f06b4c6","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=2","gravatar_id":"3fa4bd3403b1a81ac43f4769c8f74b66","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"repo":{"id":14072631,"name":"etcd","full_name":"bcwaldon/etcd","owner":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=2","gravatar_id":"3fa4bd3403b1a81ac43f4769c8f74b66","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bcwaldon/etcd","description":"A highly-available key value store for shared configuration and service discovery","fork":true,"url":"https://api.github.com/repos/bcwaldon/etcd","forks_url":"https://api.github.com/repos/bcwaldon/etcd/forks","keys_url":"https://api.github.com/repos/bcwaldon/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bcwaldon/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bcwaldon/etcd/teams","hooks_url":"https://api.github.com/repos/bcwaldon/etcd/hooks","issue_events_url":"https://api.github.com/repos/bcwaldon/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/bcwaldon/etcd/events","assignees_url":"https://api.github.com/repos/bcwaldon/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/bcwaldon/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/bcwaldon/etcd/tags","blobs_url":"https://api.github.com/repos/bcwaldon/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bcwaldon/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bcwaldon/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/bcwaldon/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bcwaldon/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/bcwaldon/etcd/languages","stargazers_url":"https://api.github.com/repos/bcwaldon/etcd/stargazers","contributors_url":"https://api.github.com/repos/bcwaldon/etcd/contributors","subscribers_url":"https://api.github.com/repos/bcwaldon/etcd/subscribers","subscription_url":"https://api.github.com/repos/bcwaldon/etcd/subscription","commits_url":"https://api.github.com/repos/bcwaldon/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/bcwaldon/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/bcwaldon/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/bcwaldon/etcd/issues/comments/{number}","contents_url":"https://api.github.com/repos/bcwaldon/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/bcwaldon/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bcwaldon/etcd/merges","archive_url":"https://api.github.com/repos/bcwaldon/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bcwaldon/etcd/downloads","issues_url":"https://api.github.com/repos/bcwaldon/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/bcwaldon/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/bcwaldon/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/bcwaldon/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bcwaldon/etcd/labels{/name}","releases_url":"https://api.github.com/repos/bcwaldon/etcd/releases{/id}","created_at":"2013-11-02T18:58:03Z","updated_at":"2014-09-04T17:04:41Z","pushed_at":"2014-09-12T17:39:33Z","git_url":"git://github.com/bcwaldon/etcd.git","ssh_url":"git@github.com:bcwaldon/etcd.git","clone_url":"https://github.com/bcwaldon/etcd.git","svn_url":"https://github.com/bcwaldon/etcd","homepage":"http://coreos.com/docs/etcd/","size":11605,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"71a1c1aa8496b6330d8fcd9868432c7aaf768967","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=2","gravatar_id":"f477564b23efc2dd243407e926976125","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":11225014,"name":"etcd","full_name":"coreos/etcd","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=2","gravatar_id":"f477564b23efc2dd243407e926976125","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/etcd","description":"A highly-available key value store for shared configuration and service discovery","fork":false,"url":"https://api.github.com/repos/coreos/etcd","forks_url":"https://api.github.com/repos/coreos/etcd/forks","keys_url":"https://api.github.com/repos/coreos/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/etcd/teams","hooks_url":"https://api.github.com/repos/coreos/etcd/hooks","issue_events_url":"https://api.github.com/repos/coreos/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/etcd/events","assignees_url":"https://api.github.com/repos/coreos/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/etcd/tags","blobs_url":"https://api.github.com/repos/coreos/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/etcd/languages","stargazers_url":"https://api.github.com/repos/coreos/etcd/stargazers","contributors_url":"https://api.github.com/repos/coreos/etcd/contributors","subscribers_url":"https://api.github.com/repos/coreos/etcd/subscribers","subscription_url":"https://api.github.com/repos/coreos/etcd/subscription","commits_url":"https://api.github.com/repos/coreos/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/etcd/issues/comments/{number}","contents_url":"https://api.github.com/repos/coreos/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/etcd/merges","archive_url":"https://api.github.com/repos/coreos/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/etcd/downloads","issues_url":"https://api.github.com/repos/coreos/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/etcd/labels{/name}","releases_url":"https://api.github.com/repos/coreos/etcd/releases{/id}","created_at":"2013-07-06T21:57:21Z","updated_at":"2014-09-12T18:27:24Z","pushed_at":"2014-09-12T20:34:05Z","git_url":"git://github.com/coreos/etcd.git","ssh_url":"git@github.com:coreos/etcd.git","clone_url":"https://github.com/coreos/etcd.git","svn_url":"https://github.com/coreos/etcd","homepage":"","size":22012,"stargazers_count":4155,"watchers_count":4155,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":415,"mirror_url":null,"open_issues_count":124,"forks":415,"open_issues":124,"watchers":4155,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/1055"},"html":{"href":"https://github.com/coreos/etcd/pull/1055"},"issue":{"href":"https://api.github.com/repos/coreos/etcd/issues/1055"},"comments":{"href":"https://api.github.com/repos/coreos/etcd/issues/1055/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd/pulls/1055/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd/pulls/1055/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd/statuses/f7b10dce54a157f84976e771463ba2617f06b4c6"}}}}