{"action":"created","comment":{"url":"https://api.github.com/repos/measurement-factory/squid/pulls/comments/244031560","pull_request_review_id":187917380,"id":244031560,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NDAzMTU2MA==","diff_hunk":"@@ -0,0 +1,109 @@\n+/*\n+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors\n+ *\n+ * Squid software is distributed under GPLv2+ license and includes\n+ * contributions from numerous individuals and organizations.\n+ * Please see the COPYING and CONTRIBUTORS files for details.\n+ */\n+\n+#ifndef SQUID_PROXYP_MESSAGE_H\n+#define SQUID_PROXYP_MESSAGE_H\n+\n+#include \"base/RefCount.h\"\n+#include \"ip/Address.h\"\n+#include \"proxyp/Protocol.h\"\n+#include \"sbuf/SBuf.h\"\n+\n+namespace ProxyProtocol {\n+\n+/// PROXY protocol v1 or v2 message\n+class Message: public RefCountable\n+{\n+public:\n+    typedef RefCount<Message> Pointer;\n+    typedef std::vector<Two::Tlv> Tlvs;\n+    typedef std::map<SBuf, Two::HeaderType> FieldMap;\n+\n+    Message(const char *ver, const uint8_t cmd = Two::cmdProxy);\n+\n+    /// HTTP header-like string representation of the message.\n+    /// The returned string has several mandatory lines for the protocol\n+    /// version, command addresses and ports:\n+    /// :version: version CRLF\n+    /// :command: command CRLF\n+    /// :src_addr: srcAddr CRLF\n+    /// :dst_addr: dstAddr CRLF\n+    /// :src_port: srcPort CRLF\n+    /// :dst_port: dstPort CRLF\n+    /// and may also contain several optional lines for each TLV:\n+    /// type: value CRLF\n+    SBuf getAll(const char sep) const;\n+\n+    /// \\returns a delimiter-separated list of values of TLVs of the given type\n+    SBuf getValues(const uint32_t headerType, const char delimiter = ',') const;\n+\n+    /// Searches for the first key-value pair occurrence within the\n+    /// value for the provided TLV type. Assumes that the TLV value\n+    /// is a list of delimiter-separated items and the items are","path":"src/proxyp/Message.h","position":47,"original_position":47,"commit_id":"0c9539603253e9aefa25273681be9e01383cd405","original_commit_id":"0c9539603253e9aefa25273681be9e01383cd405","user":{"login":"rousskov","id":1084944,"node_id":"MDQ6VXNlcjEwODQ5NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1084944?v=4","gravatar_id":"","url":"https://api.github.com/users/rousskov","html_url":"https://github.com/rousskov","followers_url":"https://api.github.com/users/rousskov/followers","following_url":"https://api.github.com/users/rousskov/following{/other_user}","gists_url":"https://api.github.com/users/rousskov/gists{/gist_id}","starred_url":"https://api.github.com/users/rousskov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rousskov/subscriptions","organizations_url":"https://api.github.com/users/rousskov/orgs","repos_url":"https://api.github.com/users/rousskov/repos","events_url":"https://api.github.com/users/rousskov/events{/privacy}","received_events_url":"https://api.github.com/users/rousskov/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n    /// is a delimiter-separated list.\r\n```\r\n\r\nAnd drop the rest of the sentence. This change also takes care of the wrong implication that all items have to be key=value pairs.","created_at":"2018-12-26T18:23:44Z","updated_at":"2018-12-26T18:41:40Z","html_url":"https://github.com/measurement-factory/squid/pull/13#discussion_r244031560","pull_request_url":"https://api.github.com/repos/measurement-factory/squid/pulls/13","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/measurement-factory/squid/pulls/comments/244031560"},"html":{"href":"https://github.com/measurement-factory/squid/pull/13#discussion_r244031560"},"pull_request":{"href":"https://api.github.com/repos/measurement-factory/squid/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/measurement-factory/squid/pulls/13","id":213383463,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzMzgzNDYz","html_url":"https://github.com/measurement-factory/squid/pull/13","diff_url":"https://github.com/measurement-factory/squid/pull/13.diff","patch_url":"https://github.com/measurement-factory/squid/pull/13.patch","issue_url":"https://api.github.com/repos/measurement-factory/squid/issues/13","number":13,"state":"open","locked":false,"title":"Parse and log PROXY v2 pp2_tlv headers","user":{"login":"eduard-bagdasaryan","id":13069213,"node_id":"MDQ6VXNlcjEzMDY5MjEz","avatar_url":"https://avatars3.githubusercontent.com/u/13069213?v=4","gravatar_id":"","url":"https://api.github.com/users/eduard-bagdasaryan","html_url":"https://github.com/eduard-bagdasaryan","followers_url":"https://api.github.com/users/eduard-bagdasaryan/followers","following_url":"https://api.github.com/users/eduard-bagdasaryan/following{/other_user}","gists_url":"https://api.github.com/users/eduard-bagdasaryan/gists{/gist_id}","starred_url":"https://api.github.com/users/eduard-bagdasaryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduard-bagdasaryan/subscriptions","organizations_url":"https://api.github.com/users/eduard-bagdasaryan/orgs","repos_url":"https://api.github.com/users/eduard-bagdasaryan/repos","events_url":"https://api.github.com/users/eduard-bagdasaryan/events{/privacy}","received_events_url":"https://api.github.com/users/eduard-bagdasaryan/received_events","type":"User","site_admin":false},"body":"Added a new  %proxy_protocol::>h logformat code for logging received TLV\r\nvalues and pass them to ICAP services and helpers.  For simplicity, this\r\nimplementation considers TLVs as text and reuses the existing routines\r\nand approaches used for logging HTTP header field values.  Each TLV is\r\nprocessed as HTTP header field, where TLV ID is the equivalent of the\r\nHTTP header field name.  Similarly, individual TLV values may be logged\r\nusing the same [:[separator]element] format (as for %http::>h).\r\nArbitrary binary TLV data logging support is a subject of future work.\r\nAlso it is possible now to log several important PROXY protocol block\r\nheaders by means of newly added pseudo headers such as :command,\r\n:version, :src_addr, :dst_addr, :src_port, :dst_port.\r\n\r\nAlso improved the existing PROXY v2 header parsing with BinaryTokenizer.\r\n\r\nAlso fixed several bugs in the old PROXY v1/v2 parsing code:\r\n\r\n* Buffer overrun in ConnStateData::parseProxy2p0(). The available\r\n  local SBuf could be less than sizeof(pax), resulting in copying\r\n  excessive bytes with SBuf::rawContent().\r\n\r\n* Incorrect processing of malformed v1 messages lacking CRLF in\r\n  ConnStateData::parseProxy1p0(), which waited for more data\r\n  even if the buffer size already exceeded the maximum v1 message\r\n  size.\r\n\r\n* Incorrect processing of partial-buffered v1 messages, when only\r\n  the initial (magic) part of the message has been received. The old\r\n  code resulted with an error instead of waiting for more data in this\r\n  case.\r\n\r\n* Incorrect v1 message framing for proto=UNKNOWN messages.\r\n  The code used only LF while the protocol requires CRLF for it.\r\n    \r\n* Do not use address information from v2 message if the message\r\n  proto is UNSPEC.\r\n\r\nAlso eliminated code duplication in HttpHeader::getByNameListMember()\r\nand HttpHeader::getListMember(), moving the common part into a\r\nseparate getListMember() method.\r\n\r\nAlso eliminated code duplication and probably fixed a bug\r\nwith applying client_netmask parameter in ConnStateData constructor.","created_at":"2018-09-05T18:14:37Z","updated_at":"2018-12-26T18:41:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"421f61f1a4be154b5d65212a2e6cbaea7d121bd9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/measurement-factory/squid/pulls/13/commits","review_comments_url":"https://api.github.com/repos/measurement-factory/squid/pulls/13/comments","review_comment_url":"https://api.github.com/repos/measurement-factory/squid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/measurement-factory/squid/issues/13/comments","statuses_url":"https://api.github.com/repos/measurement-factory/squid/statuses/0c9539603253e9aefa25273681be9e01383cd405","head":{"label":"measurement-factory:SQUID-394-logging-proxy-v2-tlv-headers","ref":"SQUID-394-logging-proxy-v2-tlv-headers","sha":"0c9539603253e9aefa25273681be9e01383cd405","user":{"login":"measurement-factory","id":5461029,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjEwMjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5461029?v=4","gravatar_id":"","url":"https://api.github.com/users/measurement-factory","html_url":"https://github.com/measurement-factory","followers_url":"https://api.github.com/users/measurement-factory/followers","following_url":"https://api.github.com/users/measurement-factory/following{/other_user}","gists_url":"https://api.github.com/users/measurement-factory/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-factory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-factory/subscriptions","organizations_url":"https://api.github.com/users/measurement-factory/orgs","repos_url":"https://api.github.com/users/measurement-factory/repos","events_url":"https://api.github.com/users/measurement-factory/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-factory/received_events","type":"Organization","site_admin":false},"repo":{"id":97358214,"node_id":"MDEwOlJlcG9zaXRvcnk5NzM1ODIxNA==","name":"squid","full_name":"measurement-factory/squid","private":false,"owner":{"login":"measurement-factory","id":5461029,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjEwMjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5461029?v=4","gravatar_id":"","url":"https://api.github.com/users/measurement-factory","html_url":"https://github.com/measurement-factory","followers_url":"https://api.github.com/users/measurement-factory/followers","following_url":"https://api.github.com/users/measurement-factory/following{/other_user}","gists_url":"https://api.github.com/users/measurement-factory/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-factory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-factory/subscriptions","organizations_url":"https://api.github.com/users/measurement-factory/orgs","repos_url":"https://api.github.com/users/measurement-factory/repos","events_url":"https://api.github.com/users/measurement-factory/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-factory/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/measurement-factory/squid","description":"Squid Web Proxy Cache","fork":true,"url":"https://api.github.com/repos/measurement-factory/squid","forks_url":"https://api.github.com/repos/measurement-factory/squid/forks","keys_url":"https://api.github.com/repos/measurement-factory/squid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/measurement-factory/squid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/measurement-factory/squid/teams","hooks_url":"https://api.github.com/repos/measurement-factory/squid/hooks","issue_events_url":"https://api.github.com/repos/measurement-factory/squid/issues/events{/number}","events_url":"https://api.github.com/repos/measurement-factory/squid/events","assignees_url":"https://api.github.com/repos/measurement-factory/squid/assignees{/user}","branches_url":"https://api.github.com/repos/measurement-factory/squid/branches{/branch}","tags_url":"https://api.github.com/repos/measurement-factory/squid/tags","blobs_url":"https://api.github.com/repos/measurement-factory/squid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/measurement-factory/squid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/measurement-factory/squid/git/refs{/sha}","trees_url":"https://api.github.com/repos/measurement-factory/squid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/measurement-factory/squid/statuses/{sha}","languages_url":"https://api.github.com/repos/measurement-factory/squid/languages","stargazers_url":"https://api.github.com/repos/measurement-factory/squid/stargazers","contributors_url":"https://api.github.com/repos/measurement-factory/squid/contributors","subscribers_url":"https://api.github.com/repos/measurement-factory/squid/subscribers","subscription_url":"https://api.github.com/repos/measurement-factory/squid/subscription","commits_url":"https://api.github.com/repos/measurement-factory/squid/commits{/sha}","git_commits_url":"https://api.github.com/repos/measurement-factory/squid/git/commits{/sha}","comments_url":"https://api.github.com/repos/measurement-factory/squid/comments{/number}","issue_comment_url":"https://api.github.com/repos/measurement-factory/squid/issues/comments{/number}","contents_url":"https://api.github.com/repos/measurement-factory/squid/contents/{+path}","compare_url":"https://api.github.com/repos/measurement-factory/squid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/measurement-factory/squid/merges","archive_url":"https://api.github.com/repos/measurement-factory/squid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/measurement-factory/squid/downloads","issues_url":"https://api.github.com/repos/measurement-factory/squid/issues{/number}","pulls_url":"https://api.github.com/repos/measurement-factory/squid/pulls{/number}","milestones_url":"https://api.github.com/repos/measurement-factory/squid/milestones{/number}","notifications_url":"https://api.github.com/repos/measurement-factory/squid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/measurement-factory/squid/labels{/name}","releases_url":"https://api.github.com/repos/measurement-factory/squid/releases{/id}","deployments_url":"https://api.github.com/repos/measurement-factory/squid/deployments","created_at":"2017-07-16T03:46:50Z","updated_at":"2018-12-18T18:00:09Z","pushed_at":"2018-12-26T11:36:33Z","git_url":"git://github.com/measurement-factory/squid.git","ssh_url":"git@github.com:measurement-factory/squid.git","clone_url":"https://github.com/measurement-factory/squid.git","svn_url":"https://github.com/measurement-factory/squid","homepage":"http://www.squid-cache.org/","size":172664,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"base":{"label":"measurement-factory:master","ref":"master","sha":"279e60ef962bd339920252f8084fbe88a0aa8a68","user":{"login":"measurement-factory","id":5461029,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjEwMjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5461029?v=4","gravatar_id":"","url":"https://api.github.com/users/measurement-factory","html_url":"https://github.com/measurement-factory","followers_url":"https://api.github.com/users/measurement-factory/followers","following_url":"https://api.github.com/users/measurement-factory/following{/other_user}","gists_url":"https://api.github.com/users/measurement-factory/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-factory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-factory/subscriptions","organizations_url":"https://api.github.com/users/measurement-factory/orgs","repos_url":"https://api.github.com/users/measurement-factory/repos","events_url":"https://api.github.com/users/measurement-factory/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-factory/received_events","type":"Organization","site_admin":false},"repo":{"id":97358214,"node_id":"MDEwOlJlcG9zaXRvcnk5NzM1ODIxNA==","name":"squid","full_name":"measurement-factory/squid","private":false,"owner":{"login":"measurement-factory","id":5461029,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjEwMjk=","avatar_url":"https://avatars1.githubusercontent.com/u/5461029?v=4","gravatar_id":"","url":"https://api.github.com/users/measurement-factory","html_url":"https://github.com/measurement-factory","followers_url":"https://api.github.com/users/measurement-factory/followers","following_url":"https://api.github.com/users/measurement-factory/following{/other_user}","gists_url":"https://api.github.com/users/measurement-factory/gists{/gist_id}","starred_url":"https://api.github.com/users/measurement-factory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/measurement-factory/subscriptions","organizations_url":"https://api.github.com/users/measurement-factory/orgs","repos_url":"https://api.github.com/users/measurement-factory/repos","events_url":"https://api.github.com/users/measurement-factory/events{/privacy}","received_events_url":"https://api.github.com/users/measurement-factory/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/measurement-factory/squid","description":"Squid Web Proxy Cache","fork":true,"url":"https://api.github.com/repos/measurement-factory/squid","forks_url":"https://api.github.com/repos/measurement-factory/squid/forks","keys_url":"https://api.github.com/repos/measurement-factory/squid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/measurement-factory/squid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/measurement-factory/squid/teams","hooks_url":"https://api.github.com/repos/measurement-factory/squid/hooks","issue_events_url":"https://api.github.com/repos/measurement-factory/squid/issues/events{/number}","events_url":"https://api.github.com/repos/measurement-factory/squid/events","assignees_url":"https://api.github.com/repos/measurement-factory/squid/assignees{/user}","branches_url":"https://api.github.com/repos/measurement-factory/squid/branches{/branch}","tags_url":"https://api.github.com/repos/measurement-factory/squid/tags","blobs_url":"https://api.github.com/repos/measurement-factory/squid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/measurement-factory/squid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/measurement-factory/squid/git/refs{/sha}","trees_url":"https://api.github.com/repos/measurement-factory/squid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/measurement-factory/squid/statuses/{sha}","languages_url":"https://api.github.com/repos/measurement-factory/squid/languages","stargazers_url":"https://api.github.com/repos/measurement-factory/squid/stargazers","contributors_url":"https://api.github.com/repos/measurement-factory/squid/contributors","subscribers_url":"https://api.github.com/repos/measurement-factory/squid/subscribers","subscription_url":"https://api.github.com/repos/measurement-factory/squid/subscription","commits_url":"https://api.github.com/repos/measurement-factory/squid/commits{/sha}","git_commits_url":"https://api.github.com/repos/measurement-factory/squid/git/commits{/sha}","comments_url":"https://api.github.com/repos/measurement-factory/squid/comments{/number}","issue_comment_url":"https://api.github.com/repos/measurement-factory/squid/issues/comments{/number}","contents_url":"https://api.github.com/repos/measurement-factory/squid/contents/{+path}","compare_url":"https://api.github.com/repos/measurement-factory/squid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/measurement-factory/squid/merges","archive_url":"https://api.github.com/repos/measurement-factory/squid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/measurement-factory/squid/downloads","issues_url":"https://api.github.com/repos/measurement-factory/squid/issues{/number}","pulls_url":"https://api.github.com/repos/measurement-factory/squid/pulls{/number}","milestones_url":"https://api.github.com/repos/measurement-factory/squid/milestones{/number}","notifications_url":"https://api.github.com/repos/measurement-factory/squid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/measurement-factory/squid/labels{/name}","releases_url":"https://api.github.com/repos/measurement-factory/squid/releases{/id}","deployments_url":"https://api.github.com/repos/measurement-factory/squid/deployments","created_at":"2017-07-16T03:46:50Z","updated_at":"2018-12-18T18:00:09Z","pushed_at":"2018-12-26T11:36:33Z","git_url":"git://github.com/measurement-factory/squid.git","ssh_url":"git@github.com:measurement-factory/squid.git","clone_url":"https://github.com/measurement-factory/squid.git","svn_url":"https://github.com/measurement-factory/squid","homepage":"http://www.squid-cache.org/","size":172664,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":14,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/measurement-factory/squid/pulls/13"},"html":{"href":"https://github.com/measurement-factory/squid/pull/13"},"issue":{"href":"https://api.github.com/repos/measurement-factory/squid/issues/13"},"comments":{"href":"https://api.github.com/repos/measurement-factory/squid/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/measurement-factory/squid/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/measurement-factory/squid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/measurement-factory/squid/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/measurement-factory/squid/statuses/0c9539603253e9aefa25273681be9e01383cd405"}},"author_association":"NONE"}}
{"actor":{"display_login":"rousskov"}}