{"action":"created","comment":{"url":"https://api.github.com/repos/actix/examples/pulls/comments/230577701","pull_request_review_id":171351782,"id":230577701,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDU3NzcwMQ==","diff_hunk":"@@ -0,0 +1,104 @@\n+#![deny(warnings)]\n+extern crate actix;\n+extern crate actix_web;\n+extern crate clap;\n+extern crate failure;\n+extern crate futures;\n+extern crate url;\n+\n+use actix_web::{\n+    client, server, App, AsyncResponder, Error, HttpMessage, HttpRequest, HttpResponse,\n+};\n+use clap::{value_t, Arg};\n+use futures::Future;\n+use std::net::ToSocketAddrs;\n+use url::Url;\n+\n+struct AppState {\n+    forward_url: Url,\n+}\n+\n+impl AppState {\n+    pub fn init(forward_url: Url) -> AppState {\n+        AppState { forward_url }\n+    }\n+}\n+\n+fn forward(\n+    req: &HttpRequest<AppState>,\n+) -> Box<Future<Item = HttpResponse, Error = Error>> {\n+    let mut new_url = req.state().forward_url.clone();\n+    new_url.set_path(req.uri().path());\n+    new_url.set_query(req.uri().query());\n+\n+    client::ClientRequest::build_from(req)\n+        .uri(new_url)\n+        .streaming(req.payload())\n+        .unwrap()\n+        .send()\n+        .map_err(Error::from)\n+        .and_then(move |resp| {\n+            resp.body().from_err().and_then(move |body| {","path":"http-full-proxy/src/main.rs","position":41,"original_position":41,"commit_id":"72cdc3698fc3082bbcdd58f07effcff2535106d1","original_commit_id":"72cdc3698fc3082bbcdd58f07effcff2535106d1","user":{"login":"vmalloc","id":28710,"node_id":"MDQ6VXNlcjI4NzEw","avatar_url":"https://avatars2.githubusercontent.com/u/28710?v=4","gravatar_id":"","url":"https://api.github.com/users/vmalloc","html_url":"https://github.com/vmalloc","followers_url":"https://api.github.com/users/vmalloc/followers","following_url":"https://api.github.com/users/vmalloc/following{/other_user}","gists_url":"https://api.github.com/users/vmalloc/gists{/gist_id}","starred_url":"https://api.github.com/users/vmalloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmalloc/subscriptions","organizations_url":"https://api.github.com/users/vmalloc/orgs","repos_url":"https://api.github.com/users/vmalloc/repos","events_url":"https://api.github.com/users/vmalloc/events{/privacy}","received_events_url":"https://api.github.com/users/vmalloc/received_events","type":"User","site_admin":false},"body":"@DoumanAsh oh yeah good point. Isn't it simpler to just do `.streaming(req.payload())`?","created_at":"2018-11-04T07:08:59Z","updated_at":"2018-11-04T07:08:59Z","html_url":"https://github.com/actix/examples/pull/58#discussion_r230577701","pull_request_url":"https://api.github.com/repos/actix/examples/pulls/58","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/actix/examples/pulls/comments/230577701"},"html":{"href":"https://github.com/actix/examples/pull/58#discussion_r230577701"},"pull_request":{"href":"https://api.github.com/repos/actix/examples/pulls/58"}},"in_reply_to_id":230575888},"pull_request":{"url":"https://api.github.com/repos/actix/examples/pulls/58","id":227645092,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3NjQ1MDky","html_url":"https://github.com/actix/examples/pull/58","diff_url":"https://github.com/actix/examples/pull/58.diff","patch_url":"https://github.com/actix/examples/pull/58.patch","issue_url":"https://api.github.com/repos/actix/examples/issues/58","number":58,"state":"open","locked":false,"title":"Add example of a full HTTP proxy, proxying body, header and method","user":{"login":"vmalloc","id":28710,"node_id":"MDQ6VXNlcjI4NzEw","avatar_url":"https://avatars2.githubusercontent.com/u/28710?v=4","gravatar_id":"","url":"https://api.github.com/users/vmalloc","html_url":"https://github.com/vmalloc","followers_url":"https://api.github.com/users/vmalloc/followers","following_url":"https://api.github.com/users/vmalloc/following{/other_user}","gists_url":"https://api.github.com/users/vmalloc/gists{/gist_id}","starred_url":"https://api.github.com/users/vmalloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmalloc/subscriptions","organizations_url":"https://api.github.com/users/vmalloc/orgs","repos_url":"https://api.github.com/users/vmalloc/repos","events_url":"https://api.github.com/users/vmalloc/events{/privacy}","received_events_url":"https://api.github.com/users/vmalloc/received_events","type":"User","site_admin":false},"body":"I wasn't sure whether I should touch the contents of the existing proxy example, and also wasn't sure about the concept it was trying to convey. In any case here is \"fuller\" implementation of an HTTP proxy, which I think should make it to the examples...","created_at":"2018-11-01T14:51:13Z","updated_at":"2018-11-04T07:08:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e3e1857f1f70b314979e684b90214b97c5a83c3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/actix/examples/pulls/58/commits","review_comments_url":"https://api.github.com/repos/actix/examples/pulls/58/comments","review_comment_url":"https://api.github.com/repos/actix/examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/actix/examples/issues/58/comments","statuses_url":"https://api.github.com/repos/actix/examples/statuses/72cdc3698fc3082bbcdd58f07effcff2535106d1","head":{"label":"vmalloc:http-full-proxy","ref":"http-full-proxy","sha":"72cdc3698fc3082bbcdd58f07effcff2535106d1","user":{"login":"vmalloc","id":28710,"node_id":"MDQ6VXNlcjI4NzEw","avatar_url":"https://avatars2.githubusercontent.com/u/28710?v=4","gravatar_id":"","url":"https://api.github.com/users/vmalloc","html_url":"https://github.com/vmalloc","followers_url":"https://api.github.com/users/vmalloc/followers","following_url":"https://api.github.com/users/vmalloc/following{/other_user}","gists_url":"https://api.github.com/users/vmalloc/gists{/gist_id}","starred_url":"https://api.github.com/users/vmalloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmalloc/subscriptions","organizations_url":"https://api.github.com/users/vmalloc/orgs","repos_url":"https://api.github.com/users/vmalloc/repos","events_url":"https://api.github.com/users/vmalloc/events{/privacy}","received_events_url":"https://api.github.com/users/vmalloc/received_events","type":"User","site_admin":false},"repo":{"id":155730652,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU3MzA2NTI=","name":"examples","full_name":"vmalloc/examples","private":false,"owner":{"login":"vmalloc","id":28710,"node_id":"MDQ6VXNlcjI4NzEw","avatar_url":"https://avatars2.githubusercontent.com/u/28710?v=4","gravatar_id":"","url":"https://api.github.com/users/vmalloc","html_url":"https://github.com/vmalloc","followers_url":"https://api.github.com/users/vmalloc/followers","following_url":"https://api.github.com/users/vmalloc/following{/other_user}","gists_url":"https://api.github.com/users/vmalloc/gists{/gist_id}","starred_url":"https://api.github.com/users/vmalloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmalloc/subscriptions","organizations_url":"https://api.github.com/users/vmalloc/orgs","repos_url":"https://api.github.com/users/vmalloc/repos","events_url":"https://api.github.com/users/vmalloc/events{/privacy}","received_events_url":"https://api.github.com/users/vmalloc/received_events","type":"User","site_admin":false},"html_url":"https://github.com/vmalloc/examples","description":"Actix web examples","fork":true,"url":"https://api.github.com/repos/vmalloc/examples","forks_url":"https://api.github.com/repos/vmalloc/examples/forks","keys_url":"https://api.github.com/repos/vmalloc/examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmalloc/examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmalloc/examples/teams","hooks_url":"https://api.github.com/repos/vmalloc/examples/hooks","issue_events_url":"https://api.github.com/repos/vmalloc/examples/issues/events{/number}","events_url":"https://api.github.com/repos/vmalloc/examples/events","assignees_url":"https://api.github.com/repos/vmalloc/examples/assignees{/user}","branches_url":"https://api.github.com/repos/vmalloc/examples/branches{/branch}","tags_url":"https://api.github.com/repos/vmalloc/examples/tags","blobs_url":"https://api.github.com/repos/vmalloc/examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmalloc/examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmalloc/examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmalloc/examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmalloc/examples/statuses/{sha}","languages_url":"https://api.github.com/repos/vmalloc/examples/languages","stargazers_url":"https://api.github.com/repos/vmalloc/examples/stargazers","contributors_url":"https://api.github.com/repos/vmalloc/examples/contributors","subscribers_url":"https://api.github.com/repos/vmalloc/examples/subscribers","subscription_url":"https://api.github.com/repos/vmalloc/examples/subscription","commits_url":"https://api.github.com/repos/vmalloc/examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmalloc/examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmalloc/examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmalloc/examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmalloc/examples/contents/{+path}","compare_url":"https://api.github.com/repos/vmalloc/examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmalloc/examples/merges","archive_url":"https://api.github.com/repos/vmalloc/examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmalloc/examples/downloads","issues_url":"https://api.github.com/repos/vmalloc/examples/issues{/number}","pulls_url":"https://api.github.com/repos/vmalloc/examples/pulls{/number}","milestones_url":"https://api.github.com/repos/vmalloc/examples/milestones{/number}","notifications_url":"https://api.github.com/repos/vmalloc/examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmalloc/examples/labels{/name}","releases_url":"https://api.github.com/repos/vmalloc/examples/releases{/id}","deployments_url":"https://api.github.com/repos/vmalloc/examples/deployments","created_at":"2018-11-01T14:49:50Z","updated_at":"2018-11-01T14:49:53Z","pushed_at":"2018-11-01T20:30:12Z","git_url":"git://github.com/vmalloc/examples.git","ssh_url":"git@github.com:vmalloc/examples.git","clone_url":"https://github.com/vmalloc/examples.git","svn_url":"https://github.com/vmalloc/examples","homepage":"","size":761,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"actix:master","ref":"master","sha":"61a4b3b23b9ac64ad4ec18c848a605937bccff7c","user":{"login":"actix","id":32776943,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNzc2OTQz","avatar_url":"https://avatars3.githubusercontent.com/u/32776943?v=4","gravatar_id":"","url":"https://api.github.com/users/actix","html_url":"https://github.com/actix","followers_url":"https://api.github.com/users/actix/followers","following_url":"https://api.github.com/users/actix/following{/other_user}","gists_url":"https://api.github.com/users/actix/gists{/gist_id}","starred_url":"https://api.github.com/users/actix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actix/subscriptions","organizations_url":"https://api.github.com/users/actix/orgs","repos_url":"https://api.github.com/users/actix/repos","events_url":"https://api.github.com/users/actix/events{/privacy}","received_events_url":"https://api.github.com/users/actix/received_events","type":"Organization","site_admin":false},"repo":{"id":129324660,"node_id":"MDEwOlJlcG9zaXRvcnkxMjkzMjQ2NjA=","name":"examples","full_name":"actix/examples","private":false,"owner":{"login":"actix","id":32776943,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyNzc2OTQz","avatar_url":"https://avatars3.githubusercontent.com/u/32776943?v=4","gravatar_id":"","url":"https://api.github.com/users/actix","html_url":"https://github.com/actix","followers_url":"https://api.github.com/users/actix/followers","following_url":"https://api.github.com/users/actix/following{/other_user}","gists_url":"https://api.github.com/users/actix/gists{/gist_id}","starred_url":"https://api.github.com/users/actix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actix/subscriptions","organizations_url":"https://api.github.com/users/actix/orgs","repos_url":"https://api.github.com/users/actix/repos","events_url":"https://api.github.com/users/actix/events{/privacy}","received_events_url":"https://api.github.com/users/actix/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/actix/examples","description":"Actix web examples","fork":false,"url":"https://api.github.com/repos/actix/examples","forks_url":"https://api.github.com/repos/actix/examples/forks","keys_url":"https://api.github.com/repos/actix/examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actix/examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actix/examples/teams","hooks_url":"https://api.github.com/repos/actix/examples/hooks","issue_events_url":"https://api.github.com/repos/actix/examples/issues/events{/number}","events_url":"https://api.github.com/repos/actix/examples/events","assignees_url":"https://api.github.com/repos/actix/examples/assignees{/user}","branches_url":"https://api.github.com/repos/actix/examples/branches{/branch}","tags_url":"https://api.github.com/repos/actix/examples/tags","blobs_url":"https://api.github.com/repos/actix/examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actix/examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actix/examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/actix/examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actix/examples/statuses/{sha}","languages_url":"https://api.github.com/repos/actix/examples/languages","stargazers_url":"https://api.github.com/repos/actix/examples/stargazers","contributors_url":"https://api.github.com/repos/actix/examples/contributors","subscribers_url":"https://api.github.com/repos/actix/examples/subscribers","subscription_url":"https://api.github.com/repos/actix/examples/subscription","commits_url":"https://api.github.com/repos/actix/examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/actix/examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/actix/examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/actix/examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/actix/examples/contents/{+path}","compare_url":"https://api.github.com/repos/actix/examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actix/examples/merges","archive_url":"https://api.github.com/repos/actix/examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actix/examples/downloads","issues_url":"https://api.github.com/repos/actix/examples/issues{/number}","pulls_url":"https://api.github.com/repos/actix/examples/pulls{/number}","milestones_url":"https://api.github.com/repos/actix/examples/milestones{/number}","notifications_url":"https://api.github.com/repos/actix/examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actix/examples/labels{/name}","releases_url":"https://api.github.com/repos/actix/examples/releases{/id}","deployments_url":"https://api.github.com/repos/actix/examples/deployments","created_at":"2018-04-13T00:07:42Z","updated_at":"2018-11-01T07:03:15Z","pushed_at":"2018-11-01T20:30:13Z","git_url":"git://github.com/actix/examples.git","ssh_url":"git@github.com:actix/examples.git","clone_url":"https://github.com/actix/examples.git","svn_url":"https://github.com/actix/examples","homepage":"","size":759,"stargazers_count":189,"watchers_count":189,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":49,"open_issues":5,"watchers":189,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/actix/examples/pulls/58"},"html":{"href":"https://github.com/actix/examples/pull/58"},"issue":{"href":"https://api.github.com/repos/actix/examples/issues/58"},"comments":{"href":"https://api.github.com/repos/actix/examples/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/actix/examples/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/actix/examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/actix/examples/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/actix/examples/statuses/72cdc3698fc3082bbcdd58f07effcff2535106d1"}},"author_association":"NONE"}}
{"actor":{"display_login":"vmalloc"}}