{"action":"created","comment":{"url":"https://api.github.com/repos/reverbrain/swarm/pulls/comments/36478552","id":36478552,"diff_hunk":"@@ -83,6 +86,77 @@ struct timespec gettime_now() {\n \n } // unnamed namespace\n \n+\n+namespace {\n+\n+template <typename OutputIterator>\n+struct headers_grammar\n+\t: boost::spirit::karma::grammar<OutputIterator, std::vector<ioremap::swarm::headers_entry>()>\n+{\n+\ttypedef std::vector<ioremap::swarm::headers_entry> headers_type;\n+\ttypedef headers_type::value_type header_type;\n+\ttypedef header_type::first_type header_key_type;\n+\ttypedef header_type::second_type header_value_type;\n+\n+\theaders_grammar()\n+\t\t: headers_grammar::base_type(headers)\n+\t{\n+\t\t// Mapping of escaped characters\n+\t\tescaped_char.add\n+\t\t\t('\\a', \"\\\\a\")\n+\t\t\t('\\b', \"\\\\b\")\n+\t\t\t('\\f', \"\\\\f\")\n+\t\t\t('\\n', \"\\\\n\")\n+\t\t\t('\\r', \"\\\\r\")\n+\t\t\t('\\t', \"\\\\t\")\n+\t\t\t('\\v', \"\\\\v\")\n+\t\t\t('\\\\', \"\\\\\\\\\")\n+\t\t\t('\\'', \"\\\\\\'\")\n+\t\t\t('\"', \"\\\\\\\"\")\n+\t\t\t;\n+\n+\t\t// Header value is sequence of:\n+\t\t// - either escaped character\n+\t\t// - or printable character\n+\t\t// - or hexadecimal representation of the corresponding character\n+\t\theader_value = *(escaped_char | boost::spirit::karma::print | \"\\\\x\" << boost::spirit::karma::hex);\n+\n+\t\t// Header key is just sequence of characters with no escaping\n+\t\theader_key = boost::spirit::karma::string;\n+\n+\t\t// Header is header key and value separated with ': ' and enclosed in double quotes\n+\t\theader = '\"' << header_key << \": \" << header_value << '\"';\n+\n+\t\t// Headers is (optionally empty) list of headers separated with ', ' and enclosed in {}\n+\t\theaders = '{' << -(header << *(\", \" << header)) << '}';\n+\t}\n+\n+\tboost::spirit::karma::symbols<char, const char*> escaped_char;\n+\n+\tboost::spirit::karma::rule<OutputIterator, header_value_type()> header_value;\n+\tboost::spirit::karma::rule<OutputIterator, header_key_type()> header_key;\n+\n+\tboost::spirit::karma::rule<OutputIterator, header_type()> header;\n+\n+\tboost::spirit::karma::rule<OutputIterator, headers_type()> headers;\n+};\n+\n+std::string headers_to_string(const ioremap::swarm::http_headers& headers) {\n+\ttypedef std::back_insert_iterator<std::string> sink_type;\n+\n+\tstatic headers_grammar<sink_type> generator;","path":"thevoid/connection.cpp","position":72,"original_position":72,"commit_id":"d280f41f8ce6bbc051324e10016fe5f8f1d2475f","original_commit_id":"d280f41f8ce6bbc051324e10016fe5f8f1d2475f","user":{"login":"bioothod","id":1847575,"avatar_url":"https://avatars.githubusercontent.com/u/1847575?v=3","gravatar_id":"","url":"https://api.github.com/users/bioothod","html_url":"https://github.com/bioothod","followers_url":"https://api.github.com/users/bioothod/followers","following_url":"https://api.github.com/users/bioothod/following{/other_user}","gists_url":"https://api.github.com/users/bioothod/gists{/gist_id}","starred_url":"https://api.github.com/users/bioothod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bioothod/subscriptions","organizations_url":"https://api.github.com/users/bioothod/orgs","repos_url":"https://api.github.com/users/bioothod/repos","events_url":"https://api.github.com/users/bioothod/events{/privacy}","received_events_url":"https://api.github.com/users/bioothod/received_events","type":"User","site_admin":false},"body":"Why do you think it is safe to use the same generator from multiple threads?","created_at":"2015-08-06T23:34:40Z","updated_at":"2015-08-06T23:34:40Z","html_url":"https://github.com/reverbrain/swarm/pull/59#discussion_r36478552","pull_request_url":"https://api.github.com/repos/reverbrain/swarm/pulls/59","_links":{"self":{"href":"https://api.github.com/repos/reverbrain/swarm/pulls/comments/36478552"},"html":{"href":"https://github.com/reverbrain/swarm/pull/59#discussion_r36478552"},"pull_request":{"href":"https://api.github.com/repos/reverbrain/swarm/pulls/59"}}},"pull_request":{"url":"https://api.github.com/repos/reverbrain/swarm/pulls/59","id":41768696,"html_url":"https://github.com/reverbrain/swarm/pull/59","diff_url":"https://github.com/reverbrain/swarm/pull/59.diff","patch_url":"https://github.com/reverbrain/swarm/pull/59.patch","issue_url":"https://api.github.com/repos/reverbrain/swarm/issues/59","number":59,"state":"open","locked":false,"title":"Rework request's logs","user":{"login":"shindo","id":863752,"avatar_url":"https://avatars.githubusercontent.com/u/863752?v=3","gravatar_id":"","url":"https://api.github.com/users/shindo","html_url":"https://github.com/shindo","followers_url":"https://api.github.com/users/shindo/followers","following_url":"https://api.github.com/users/shindo/following{/other_user}","gists_url":"https://api.github.com/users/shindo/gists{/gist_id}","starred_url":"https://api.github.com/users/shindo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shindo/subscriptions","organizations_url":"https://api.github.com/users/shindo/orgs","repos_url":"https://api.github.com/users/shindo/repos","events_url":"https://api.github.com/users/shindo/events{/privacy}","received_events_url":"https://api.github.com/users/shindo/received_events","type":"User","site_admin":false},"body":"Adds log line with received new request's information, that includes:\r\n- HTTP method\r\n- URL\r\n- local and remote endpoints\r\n- headers in form of {\"Header1: Value1\", \"Header2: Value2\", ...}, values are escaped\r\n\r\nThe log line is printed on INFO log level.","created_at":"2015-08-06T09:36:18Z","updated_at":"2015-08-06T23:34:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"349bda92e2cd9368443486c06097b7967cbe5da9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reverbrain/swarm/pulls/59/commits","review_comments_url":"https://api.github.com/repos/reverbrain/swarm/pulls/59/comments","review_comment_url":"https://api.github.com/repos/reverbrain/swarm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reverbrain/swarm/issues/59/comments","statuses_url":"https://api.github.com/repos/reverbrain/swarm/statuses/d280f41f8ce6bbc051324e10016fe5f8f1d2475f","head":{"label":"shindo:pull-request-log","ref":"pull-request-log","sha":"d280f41f8ce6bbc051324e10016fe5f8f1d2475f","user":{"login":"shindo","id":863752,"avatar_url":"https://avatars.githubusercontent.com/u/863752?v=3","gravatar_id":"","url":"https://api.github.com/users/shindo","html_url":"https://github.com/shindo","followers_url":"https://api.github.com/users/shindo/followers","following_url":"https://api.github.com/users/shindo/following{/other_user}","gists_url":"https://api.github.com/users/shindo/gists{/gist_id}","starred_url":"https://api.github.com/users/shindo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shindo/subscriptions","organizations_url":"https://api.github.com/users/shindo/orgs","repos_url":"https://api.github.com/users/shindo/repos","events_url":"https://api.github.com/users/shindo/events{/privacy}","received_events_url":"https://api.github.com/users/shindo/received_events","type":"User","site_admin":false},"repo":{"id":23220802,"name":"swarm","full_name":"shindo/swarm","owner":{"login":"shindo","id":863752,"avatar_url":"https://avatars.githubusercontent.com/u/863752?v=3","gravatar_id":"","url":"https://api.github.com/users/shindo","html_url":"https://github.com/shindo","followers_url":"https://api.github.com/users/shindo/followers","following_url":"https://api.github.com/users/shindo/following{/other_user}","gists_url":"https://api.github.com/users/shindo/gists{/gist_id}","starred_url":"https://api.github.com/users/shindo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shindo/subscriptions","organizations_url":"https://api.github.com/users/shindo/orgs","repos_url":"https://api.github.com/users/shindo/repos","events_url":"https://api.github.com/users/shindo/events{/privacy}","received_events_url":"https://api.github.com/users/shindo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shindo/swarm","description":"Swarm is aiming at your web","fork":true,"url":"https://api.github.com/repos/shindo/swarm","forks_url":"https://api.github.com/repos/shindo/swarm/forks","keys_url":"https://api.github.com/repos/shindo/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shindo/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shindo/swarm/teams","hooks_url":"https://api.github.com/repos/shindo/swarm/hooks","issue_events_url":"https://api.github.com/repos/shindo/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/shindo/swarm/events","assignees_url":"https://api.github.com/repos/shindo/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/shindo/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/shindo/swarm/tags","blobs_url":"https://api.github.com/repos/shindo/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shindo/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shindo/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/shindo/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shindo/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/shindo/swarm/languages","stargazers_url":"https://api.github.com/repos/shindo/swarm/stargazers","contributors_url":"https://api.github.com/repos/shindo/swarm/contributors","subscribers_url":"https://api.github.com/repos/shindo/swarm/subscribers","subscription_url":"https://api.github.com/repos/shindo/swarm/subscription","commits_url":"https://api.github.com/repos/shindo/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/shindo/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/shindo/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/shindo/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/shindo/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/shindo/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shindo/swarm/merges","archive_url":"https://api.github.com/repos/shindo/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shindo/swarm/downloads","issues_url":"https://api.github.com/repos/shindo/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/shindo/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/shindo/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/shindo/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shindo/swarm/labels{/name}","releases_url":"https://api.github.com/repos/shindo/swarm/releases{/id}","created_at":"2014-08-22T09:52:08Z","updated_at":"2015-04-08T17:01:14Z","pushed_at":"2015-08-06T16:54:04Z","git_url":"git://github.com/shindo/swarm.git","ssh_url":"git@github.com:shindo/swarm.git","clone_url":"https://github.com/shindo/swarm.git","svn_url":"https://github.com/shindo/swarm","homepage":null,"size":2255,"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":"reverbrain:master","ref":"master","sha":"1f3ae00f0d83221e4d8fbe8c5786827a2f69288c","user":{"login":"reverbrain","id":1616511,"avatar_url":"https://avatars.githubusercontent.com/u/1616511?v=3","gravatar_id":"","url":"https://api.github.com/users/reverbrain","html_url":"https://github.com/reverbrain","followers_url":"https://api.github.com/users/reverbrain/followers","following_url":"https://api.github.com/users/reverbrain/following{/other_user}","gists_url":"https://api.github.com/users/reverbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/reverbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reverbrain/subscriptions","organizations_url":"https://api.github.com/users/reverbrain/orgs","repos_url":"https://api.github.com/users/reverbrain/repos","events_url":"https://api.github.com/users/reverbrain/events{/privacy}","received_events_url":"https://api.github.com/users/reverbrain/received_events","type":"Organization","site_admin":false},"repo":{"id":8936566,"name":"swarm","full_name":"reverbrain/swarm","owner":{"login":"reverbrain","id":1616511,"avatar_url":"https://avatars.githubusercontent.com/u/1616511?v=3","gravatar_id":"","url":"https://api.github.com/users/reverbrain","html_url":"https://github.com/reverbrain","followers_url":"https://api.github.com/users/reverbrain/followers","following_url":"https://api.github.com/users/reverbrain/following{/other_user}","gists_url":"https://api.github.com/users/reverbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/reverbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reverbrain/subscriptions","organizations_url":"https://api.github.com/users/reverbrain/orgs","repos_url":"https://api.github.com/users/reverbrain/repos","events_url":"https://api.github.com/users/reverbrain/events{/privacy}","received_events_url":"https://api.github.com/users/reverbrain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reverbrain/swarm","description":"Swarm is aiming at your web","fork":false,"url":"https://api.github.com/repos/reverbrain/swarm","forks_url":"https://api.github.com/repos/reverbrain/swarm/forks","keys_url":"https://api.github.com/repos/reverbrain/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reverbrain/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reverbrain/swarm/teams","hooks_url":"https://api.github.com/repos/reverbrain/swarm/hooks","issue_events_url":"https://api.github.com/repos/reverbrain/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/reverbrain/swarm/events","assignees_url":"https://api.github.com/repos/reverbrain/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/reverbrain/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/reverbrain/swarm/tags","blobs_url":"https://api.github.com/repos/reverbrain/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reverbrain/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reverbrain/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/reverbrain/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reverbrain/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/reverbrain/swarm/languages","stargazers_url":"https://api.github.com/repos/reverbrain/swarm/stargazers","contributors_url":"https://api.github.com/repos/reverbrain/swarm/contributors","subscribers_url":"https://api.github.com/repos/reverbrain/swarm/subscribers","subscription_url":"https://api.github.com/repos/reverbrain/swarm/subscription","commits_url":"https://api.github.com/repos/reverbrain/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/reverbrain/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/reverbrain/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/reverbrain/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/reverbrain/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/reverbrain/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reverbrain/swarm/merges","archive_url":"https://api.github.com/repos/reverbrain/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reverbrain/swarm/downloads","issues_url":"https://api.github.com/repos/reverbrain/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/reverbrain/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/reverbrain/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/reverbrain/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reverbrain/swarm/labels{/name}","releases_url":"https://api.github.com/repos/reverbrain/swarm/releases{/id}","created_at":"2013-03-21T19:13:26Z","updated_at":"2015-08-05T15:36:42Z","pushed_at":"2015-08-06T16:54:04Z","git_url":"git://github.com/reverbrain/swarm.git","ssh_url":"git@github.com:reverbrain/swarm.git","clone_url":"https://github.com/reverbrain/swarm.git","svn_url":"https://github.com/reverbrain/swarm","homepage":null,"size":2636,"stargazers_count":18,"watchers_count":18,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":9,"forks":14,"open_issues":9,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reverbrain/swarm/pulls/59"},"html":{"href":"https://github.com/reverbrain/swarm/pull/59"},"issue":{"href":"https://api.github.com/repos/reverbrain/swarm/issues/59"},"comments":{"href":"https://api.github.com/repos/reverbrain/swarm/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/reverbrain/swarm/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/reverbrain/swarm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reverbrain/swarm/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/reverbrain/swarm/statuses/d280f41f8ce6bbc051324e10016fe5f8f1d2475f"}}}}