{"action":"created","comment":{"url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/comments/88816731","pull_request_review_id":9377824,"id":88816731,"diff_hunk":"@@ -34,6 +34,42 @@ struct WIN32_EXPORT HTTPSocket : private uS::Socket {\n     static void onEnd(uS::Socket s);\n };\n \n+struct HTTPParser {\n+    char* headerBegin;","path":"src/HTTPSocket.h","position":5,"original_position":5,"commit_id":"e899dee1da414aa7d6d6fffe58a9a37c7ab63d2c","original_commit_id":"e899dee1da414aa7d6d6fffe58a9a37c7ab63d2c","user":{"login":"alexhultman","id":3397140,"avatar_url":"https://avatars.githubusercontent.com/u/3397140?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhultman","html_url":"https://github.com/alexhultman","followers_url":"https://api.github.com/users/alexhultman/followers","following_url":"https://api.github.com/users/alexhultman/following{/other_user}","gists_url":"https://api.github.com/users/alexhultman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhultman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhultman/subscriptions","organizations_url":"https://api.github.com/users/alexhultman/orgs","repos_url":"https://api.github.com/users/alexhultman/repos","events_url":"https://api.github.com/users/alexhultman/events{/privacy}","received_events_url":"https://api.github.com/users/alexhultman/received_events","type":"User","site_admin":false},"body":"Lol these are to the left","created_at":"2016-11-21T00:25:18Z","updated_at":"2016-11-21T00:25:18Z","html_url":"https://github.com/uWebSockets/uWebSockets/pull/336#discussion_r88816731","pull_request_url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336","_links":{"self":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/comments/88816731"},"html":{"href":"https://github.com/uWebSockets/uWebSockets/pull/336#discussion_r88816731"},"pull_request":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336"}}},"pull_request":{"url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336","id":94523108,"html_url":"https://github.com/uWebSockets/uWebSockets/pull/336","diff_url":"https://github.com/uWebSockets/uWebSockets/pull/336.diff","patch_url":"https://github.com/uWebSockets/uWebSockets/pull/336.patch","issue_url":"https://api.github.com/repos/uWebSockets/uWebSockets/issues/336","number":336,"state":"open","locked":false,"title":"allow access to httpheaders on connection handler","user":{"login":"lucasterra","id":441058,"avatar_url":"https://avatars.githubusercontent.com/u/441058?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasterra","html_url":"https://github.com/lucasterra","followers_url":"https://api.github.com/users/lucasterra/followers","following_url":"https://api.github.com/users/lucasterra/following{/other_user}","gists_url":"https://api.github.com/users/lucasterra/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasterra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasterra/subscriptions","organizations_url":"https://api.github.com/users/lucasterra/orgs","repos_url":"https://api.github.com/users/lucasterra/repos","events_url":"https://api.github.com/users/lucasterra/events{/privacy}","received_events_url":"https://api.github.com/users/lucasterra/received_events","type":"User","site_admin":false},"body":"This exposes the HTTPParser to onConnection's upgradeinfo. I have also implemented a simpler way to parse the headers, through `uWS::UpgradeInfo::getRequestHeaders()`, which returns a `std::map<std::string, std::string>`. There's a small overhead of copying/allocating the strings and the map, but people can still use the HTTPParser if zero-copy parsing is required.\r\n\r\n**Example:**\r\n```cpp\r\nint main()\r\n{\r\n    uWS::Hub h;\r\n\r\n    h.onConnection([](uWS::WebSocket<uWS::SERVER> ws, uWS::UpgradeInfo ui) {\r\n        // headers\r\n        const std::map<std::string, std::string>& headers = ui.getRequestHeaders();\r\n        for (auto i = headers.begin(); i != headers.end(); i++) {\r\n            // i->first: header key; i->second: header value\r\n            std::cout << i->first << \": \" << i->second << std::endl;\r\n        }\r\n    });\r\n\r\n    h.onMessage([](uWS::WebSocket<uWS::SERVER> ws, char *message, size_t length, uWS::OpCode opCode) {\r\n        ws.send(message, length, opCode);\r\n    });\r\n\r\n    h.listen(3000);\r\n    h.run();\r\n}\r\n```","created_at":"2016-11-20T16:19:37Z","updated_at":"2016-11-21T00:25:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"460536a58fb25d22b7838348c7dddbab0dd91ec7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336/commits","review_comments_url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336/comments","review_comment_url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uWebSockets/uWebSockets/issues/336/comments","statuses_url":"https://api.github.com/repos/uWebSockets/uWebSockets/statuses/e899dee1da414aa7d6d6fffe58a9a37c7ab63d2c","head":{"label":"lucasterra:feature-httpheaders-onconnection","ref":"feature-httpheaders-onconnection","sha":"e899dee1da414aa7d6d6fffe58a9a37c7ab63d2c","user":{"login":"lucasterra","id":441058,"avatar_url":"https://avatars.githubusercontent.com/u/441058?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasterra","html_url":"https://github.com/lucasterra","followers_url":"https://api.github.com/users/lucasterra/followers","following_url":"https://api.github.com/users/lucasterra/following{/other_user}","gists_url":"https://api.github.com/users/lucasterra/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasterra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasterra/subscriptions","organizations_url":"https://api.github.com/users/lucasterra/orgs","repos_url":"https://api.github.com/users/lucasterra/repos","events_url":"https://api.github.com/users/lucasterra/events{/privacy}","received_events_url":"https://api.github.com/users/lucasterra/received_events","type":"User","site_admin":false},"repo":{"id":74238542,"name":"uWebSockets","full_name":"lucasterra/uWebSockets","owner":{"login":"lucasterra","id":441058,"avatar_url":"https://avatars.githubusercontent.com/u/441058?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasterra","html_url":"https://github.com/lucasterra","followers_url":"https://api.github.com/users/lucasterra/followers","following_url":"https://api.github.com/users/lucasterra/following{/other_user}","gists_url":"https://api.github.com/users/lucasterra/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasterra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasterra/subscriptions","organizations_url":"https://api.github.com/users/lucasterra/orgs","repos_url":"https://api.github.com/users/lucasterra/repos","events_url":"https://api.github.com/users/lucasterra/events{/privacy}","received_events_url":"https://api.github.com/users/lucasterra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lucasterra/uWebSockets","description":"Highly scalable WebSocket server & client library","fork":true,"url":"https://api.github.com/repos/lucasterra/uWebSockets","forks_url":"https://api.github.com/repos/lucasterra/uWebSockets/forks","keys_url":"https://api.github.com/repos/lucasterra/uWebSockets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lucasterra/uWebSockets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lucasterra/uWebSockets/teams","hooks_url":"https://api.github.com/repos/lucasterra/uWebSockets/hooks","issue_events_url":"https://api.github.com/repos/lucasterra/uWebSockets/issues/events{/number}","events_url":"https://api.github.com/repos/lucasterra/uWebSockets/events","assignees_url":"https://api.github.com/repos/lucasterra/uWebSockets/assignees{/user}","branches_url":"https://api.github.com/repos/lucasterra/uWebSockets/branches{/branch}","tags_url":"https://api.github.com/repos/lucasterra/uWebSockets/tags","blobs_url":"https://api.github.com/repos/lucasterra/uWebSockets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lucasterra/uWebSockets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lucasterra/uWebSockets/git/refs{/sha}","trees_url":"https://api.github.com/repos/lucasterra/uWebSockets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lucasterra/uWebSockets/statuses/{sha}","languages_url":"https://api.github.com/repos/lucasterra/uWebSockets/languages","stargazers_url":"https://api.github.com/repos/lucasterra/uWebSockets/stargazers","contributors_url":"https://api.github.com/repos/lucasterra/uWebSockets/contributors","subscribers_url":"https://api.github.com/repos/lucasterra/uWebSockets/subscribers","subscription_url":"https://api.github.com/repos/lucasterra/uWebSockets/subscription","commits_url":"https://api.github.com/repos/lucasterra/uWebSockets/commits{/sha}","git_commits_url":"https://api.github.com/repos/lucasterra/uWebSockets/git/commits{/sha}","comments_url":"https://api.github.com/repos/lucasterra/uWebSockets/comments{/number}","issue_comment_url":"https://api.github.com/repos/lucasterra/uWebSockets/issues/comments{/number}","contents_url":"https://api.github.com/repos/lucasterra/uWebSockets/contents/{+path}","compare_url":"https://api.github.com/repos/lucasterra/uWebSockets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lucasterra/uWebSockets/merges","archive_url":"https://api.github.com/repos/lucasterra/uWebSockets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lucasterra/uWebSockets/downloads","issues_url":"https://api.github.com/repos/lucasterra/uWebSockets/issues{/number}","pulls_url":"https://api.github.com/repos/lucasterra/uWebSockets/pulls{/number}","milestones_url":"https://api.github.com/repos/lucasterra/uWebSockets/milestones{/number}","notifications_url":"https://api.github.com/repos/lucasterra/uWebSockets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lucasterra/uWebSockets/labels{/name}","releases_url":"https://api.github.com/repos/lucasterra/uWebSockets/releases{/id}","deployments_url":"https://api.github.com/repos/lucasterra/uWebSockets/deployments","created_at":"2016-11-19T22:11:02Z","updated_at":"2016-11-19T22:11:03Z","pushed_at":"2016-11-21T00:12:57Z","git_url":"git://github.com/lucasterra/uWebSockets.git","ssh_url":"git@github.com:lucasterra/uWebSockets.git","clone_url":"https://github.com/lucasterra/uWebSockets.git","svn_url":"https://github.com/lucasterra/uWebSockets","homepage":"","size":878,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"uWebSockets:master","ref":"master","sha":"6bf5d3f3c7813af724a9c109b3c4ea35063d63d3","user":{"login":"uWebSockets","id":20158830,"avatar_url":"https://avatars.githubusercontent.com/u/20158830?v=3","gravatar_id":"","url":"https://api.github.com/users/uWebSockets","html_url":"https://github.com/uWebSockets","followers_url":"https://api.github.com/users/uWebSockets/followers","following_url":"https://api.github.com/users/uWebSockets/following{/other_user}","gists_url":"https://api.github.com/users/uWebSockets/gists{/gist_id}","starred_url":"https://api.github.com/users/uWebSockets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uWebSockets/subscriptions","organizations_url":"https://api.github.com/users/uWebSockets/orgs","repos_url":"https://api.github.com/users/uWebSockets/repos","events_url":"https://api.github.com/users/uWebSockets/events{/privacy}","received_events_url":"https://api.github.com/users/uWebSockets/received_events","type":"Organization","site_admin":false},"repo":{"id":54360307,"name":"uWebSockets","full_name":"uWebSockets/uWebSockets","owner":{"login":"uWebSockets","id":20158830,"avatar_url":"https://avatars.githubusercontent.com/u/20158830?v=3","gravatar_id":"","url":"https://api.github.com/users/uWebSockets","html_url":"https://github.com/uWebSockets","followers_url":"https://api.github.com/users/uWebSockets/followers","following_url":"https://api.github.com/users/uWebSockets/following{/other_user}","gists_url":"https://api.github.com/users/uWebSockets/gists{/gist_id}","starred_url":"https://api.github.com/users/uWebSockets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uWebSockets/subscriptions","organizations_url":"https://api.github.com/users/uWebSockets/orgs","repos_url":"https://api.github.com/users/uWebSockets/repos","events_url":"https://api.github.com/users/uWebSockets/events{/privacy}","received_events_url":"https://api.github.com/users/uWebSockets/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uWebSockets/uWebSockets","description":"Highly scalable WebSocket server & client library","fork":false,"url":"https://api.github.com/repos/uWebSockets/uWebSockets","forks_url":"https://api.github.com/repos/uWebSockets/uWebSockets/forks","keys_url":"https://api.github.com/repos/uWebSockets/uWebSockets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uWebSockets/uWebSockets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uWebSockets/uWebSockets/teams","hooks_url":"https://api.github.com/repos/uWebSockets/uWebSockets/hooks","issue_events_url":"https://api.github.com/repos/uWebSockets/uWebSockets/issues/events{/number}","events_url":"https://api.github.com/repos/uWebSockets/uWebSockets/events","assignees_url":"https://api.github.com/repos/uWebSockets/uWebSockets/assignees{/user}","branches_url":"https://api.github.com/repos/uWebSockets/uWebSockets/branches{/branch}","tags_url":"https://api.github.com/repos/uWebSockets/uWebSockets/tags","blobs_url":"https://api.github.com/repos/uWebSockets/uWebSockets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uWebSockets/uWebSockets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uWebSockets/uWebSockets/git/refs{/sha}","trees_url":"https://api.github.com/repos/uWebSockets/uWebSockets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uWebSockets/uWebSockets/statuses/{sha}","languages_url":"https://api.github.com/repos/uWebSockets/uWebSockets/languages","stargazers_url":"https://api.github.com/repos/uWebSockets/uWebSockets/stargazers","contributors_url":"https://api.github.com/repos/uWebSockets/uWebSockets/contributors","subscribers_url":"https://api.github.com/repos/uWebSockets/uWebSockets/subscribers","subscription_url":"https://api.github.com/repos/uWebSockets/uWebSockets/subscription","commits_url":"https://api.github.com/repos/uWebSockets/uWebSockets/commits{/sha}","git_commits_url":"https://api.github.com/repos/uWebSockets/uWebSockets/git/commits{/sha}","comments_url":"https://api.github.com/repos/uWebSockets/uWebSockets/comments{/number}","issue_comment_url":"https://api.github.com/repos/uWebSockets/uWebSockets/issues/comments{/number}","contents_url":"https://api.github.com/repos/uWebSockets/uWebSockets/contents/{+path}","compare_url":"https://api.github.com/repos/uWebSockets/uWebSockets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uWebSockets/uWebSockets/merges","archive_url":"https://api.github.com/repos/uWebSockets/uWebSockets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uWebSockets/uWebSockets/downloads","issues_url":"https://api.github.com/repos/uWebSockets/uWebSockets/issues{/number}","pulls_url":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls{/number}","milestones_url":"https://api.github.com/repos/uWebSockets/uWebSockets/milestones{/number}","notifications_url":"https://api.github.com/repos/uWebSockets/uWebSockets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uWebSockets/uWebSockets/labels{/name}","releases_url":"https://api.github.com/repos/uWebSockets/uWebSockets/releases{/id}","deployments_url":"https://api.github.com/repos/uWebSockets/uWebSockets/deployments","created_at":"2016-03-21T04:39:40Z","updated_at":"2016-11-20T21:38:11Z","pushed_at":"2016-11-21T00:12:58Z","git_url":"git://github.com/uWebSockets/uWebSockets.git","ssh_url":"git@github.com:uWebSockets/uWebSockets.git","clone_url":"https://github.com/uWebSockets/uWebSockets.git","svn_url":"https://github.com/uWebSockets/uWebSockets","homepage":"","size":1346,"stargazers_count":4152,"watchers_count":4152,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":192,"mirror_url":null,"open_issues_count":25,"forks":192,"open_issues":25,"watchers":4152,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336"},"html":{"href":"https://github.com/uWebSockets/uWebSockets/pull/336"},"issue":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/issues/336"},"comments":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/issues/336/comments"},"review_comments":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336/comments"},"review_comment":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/pulls/336/commits"},"statuses":{"href":"https://api.github.com/repos/uWebSockets/uWebSockets/statuses/e899dee1da414aa7d6d6fffe58a9a37c7ab63d2c"}}}}
{"actor":{"display_login":"alexhultman"}}