{"action":"created","comment":{"url":"https://api.github.com/repos/apache/trafficserver/pulls/comments/69356811","id":69356811,"diff_hunk":"@@ -0,0 +1,248 @@\n+/**\n+  Licensed to the Apache Software Foundation (ASF) under one\n+  or more contributor license agreements.  See the NOTICE file\n+  distributed with this work for additional information\n+  regarding copyright ownership.  The ASF licenses this file\n+  to you under the Apache License, Version 2.0 (the\n+  \"License\"); you may not use this file except in compliance\n+  with the License.  You may obtain a copy of the License at\n+\n+      http://www.apache.org/licenses/LICENSE-2.0\n+\n+  Unless required by applicable law or agreed to in writing, software\n+  distributed under the License is distributed on an \"AS IS\" BASIS,\n+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+  See the License for the specific language governing permissions and\n+  limitations under the License.\n+ */\n+\n+#include <iostream>\n+#include <vector>\n+#include <zlib.h>\n+#include <atscppapi/GlobalPlugin.h>\n+#include <atscppapi/TransformationPlugin.h>\n+#include <atscppapi/PluginInit.h>\n+#include <atscppapi/Logger.h>\n+#include <brotli/enc/encode.h>\n+\n+using namespace atscppapi;\n+using namespace std;\n+\n+#define TAG \"brotli_transformation\"\n+\n+namespace\n+{\n+const int WINDOW_BITS             = 31; // Always use 31 for gzip.\n+unsigned int INFLATE_SCALE_FACTOR = 6;\n+unsigned int BROTLI_QUALITY       = 9;\n+}\n+\n+class GzipInflateTransformationState : noncopyable\n+{\n+public:\n+  z_stream z_stream_;\n+  bool z_stream_initialized_;\n+  int64_t bytes_produced_;\n+  TransformationPlugin::Type transformation_type_;\n+\n+  GzipInflateTransformationState(TransformationPlugin::Type type)\n+    : z_stream_initialized_(false), bytes_produced_(0), transformation_type_(type)\n+  {\n+    memset(&z_stream_, 0, sizeof(z_stream_));\n+\n+    int err = inflateInit2(&z_stream_, WINDOW_BITS);\n+    if (Z_OK != err) {\n+      TS_ERROR(TAG, \"inflateInit2 failed with error code '%d'.\", err);\n+    } else {\n+      z_stream_initialized_ = true;\n+    }\n+  };\n+\n+  ~GzipInflateTransformationState()\n+  {\n+    if (z_stream_initialized_) {\n+      int err = inflateEnd(&z_stream_);\n+      if (Z_OK != err && Z_STREAM_END != err) {\n+        TS_ERROR(TAG, \"Unable to inflateEnd(), returned error code '%d'\", err);\n+      }\n+    }\n+  };\n+};\n+\n+class BrotliVecOut : public brotli::BrotliOut","path":"plugins/experimental/brotli_transform/brotli_transform.cc","position":72,"original_position":72,"commit_id":"a4a141c2afe37cb079f8efe7e78c4f1a36b4ba5d","original_commit_id":"a4a141c2afe37cb079f8efe7e78c4f1a36b4ba5d","user":{"login":"caricaturecm","id":6038157,"avatar_url":"https://avatars.githubusercontent.com/u/6038157?v=3","gravatar_id":"","url":"https://api.github.com/users/caricaturecm","html_url":"https://github.com/caricaturecm","followers_url":"https://api.github.com/users/caricaturecm/followers","following_url":"https://api.github.com/users/caricaturecm/following{/other_user}","gists_url":"https://api.github.com/users/caricaturecm/gists{/gist_id}","starred_url":"https://api.github.com/users/caricaturecm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caricaturecm/subscriptions","organizations_url":"https://api.github.com/users/caricaturecm/orgs","repos_url":"https://api.github.com/users/caricaturecm/repos","events_url":"https://api.github.com/users/caricaturecm/events{/privacy}","received_events_url":"https://api.github.com/users/caricaturecm/received_events","type":"User","site_admin":false},"body":"@bgaff Hi Brain, I think I can not use the Transform.produce() directly. Because the function produce()  in the base class TransformationPlugin is protected.","created_at":"2016-07-01T21:17:13Z","updated_at":"2016-07-01T21:17:13Z","html_url":"https://github.com/apache/trafficserver/pull/776#discussion_r69356811","pull_request_url":"https://api.github.com/repos/apache/trafficserver/pulls/776","_links":{"self":{"href":"https://api.github.com/repos/apache/trafficserver/pulls/comments/69356811"},"html":{"href":"https://github.com/apache/trafficserver/pull/776#discussion_r69356811"},"pull_request":{"href":"https://api.github.com/repos/apache/trafficserver/pulls/776"}}},"pull_request":{"url":"https://api.github.com/repos/apache/trafficserver/pulls/776","id":75891195,"html_url":"https://github.com/apache/trafficserver/pull/776","diff_url":"https://github.com/apache/trafficserver/pull/776.diff","patch_url":"https://github.com/apache/trafficserver/pull/776.patch","issue_url":"https://api.github.com/repos/apache/trafficserver/issues/776","number":776,"state":"open","locked":false,"title":"TS-4553: Brotli plugin","user":{"login":"caricaturecm","id":6038157,"avatar_url":"https://avatars.githubusercontent.com/u/6038157?v=3","gravatar_id":"","url":"https://api.github.com/users/caricaturecm","html_url":"https://github.com/caricaturecm","followers_url":"https://api.github.com/users/caricaturecm/followers","following_url":"https://api.github.com/users/caricaturecm/following{/other_user}","gists_url":"https://api.github.com/users/caricaturecm/gists{/gist_id}","starred_url":"https://api.github.com/users/caricaturecm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caricaturecm/subscriptions","organizations_url":"https://api.github.com/users/caricaturecm/orgs","repos_url":"https://api.github.com/users/caricaturecm/repos","events_url":"https://api.github.com/users/caricaturecm/events{/privacy}","received_events_url":"https://api.github.com/users/caricaturecm/received_events","type":"User","site_admin":false},"body":"@bgaff can you please take a look? thanks.","created_at":"2016-06-30T21:08:58Z","updated_at":"2016-07-01T21:17:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a722317f814ed1110ac99bf63c75103cac3683f8","assignee":{"login":"bgaff","id":947865,"avatar_url":"https://avatars.githubusercontent.com/u/947865?v=3","gravatar_id":"","url":"https://api.github.com/users/bgaff","html_url":"https://github.com/bgaff","followers_url":"https://api.github.com/users/bgaff/followers","following_url":"https://api.github.com/users/bgaff/following{/other_user}","gists_url":"https://api.github.com/users/bgaff/gists{/gist_id}","starred_url":"https://api.github.com/users/bgaff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgaff/subscriptions","organizations_url":"https://api.github.com/users/bgaff/orgs","repos_url":"https://api.github.com/users/bgaff/repos","events_url":"https://api.github.com/users/bgaff/events{/privacy}","received_events_url":"https://api.github.com/users/bgaff/received_events","type":"User","site_admin":false},"assignees":[{"login":"bgaff","id":947865,"avatar_url":"https://avatars.githubusercontent.com/u/947865?v=3","gravatar_id":"","url":"https://api.github.com/users/bgaff","html_url":"https://github.com/bgaff","followers_url":"https://api.github.com/users/bgaff/followers","following_url":"https://api.github.com/users/bgaff/following{/other_user}","gists_url":"https://api.github.com/users/bgaff/gists{/gist_id}","starred_url":"https://api.github.com/users/bgaff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgaff/subscriptions","organizations_url":"https://api.github.com/users/bgaff/orgs","repos_url":"https://api.github.com/users/bgaff/repos","events_url":"https://api.github.com/users/bgaff/events{/privacy}","received_events_url":"https://api.github.com/users/bgaff/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/apache/trafficserver/milestones/1","html_url":"https://github.com/apache/trafficserver/milestones/7.0.0","labels_url":"https://api.github.com/repos/apache/trafficserver/milestones/1/labels","id":1751566,"number":1,"title":"7.0.0","description":"","creator":{"login":"zwoop","id":202131,"avatar_url":"https://avatars.githubusercontent.com/u/202131?v=3","gravatar_id":"","url":"https://api.github.com/users/zwoop","html_url":"https://github.com/zwoop","followers_url":"https://api.github.com/users/zwoop/followers","following_url":"https://api.github.com/users/zwoop/following{/other_user}","gists_url":"https://api.github.com/users/zwoop/gists{/gist_id}","starred_url":"https://api.github.com/users/zwoop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zwoop/subscriptions","organizations_url":"https://api.github.com/users/zwoop/orgs","repos_url":"https://api.github.com/users/zwoop/repos","events_url":"https://api.github.com/users/zwoop/events{/privacy}","received_events_url":"https://api.github.com/users/zwoop/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":94,"state":"open","created_at":"2016-05-06T14:28:01Z","updated_at":"2016-07-01T20:01:54Z","due_on":"2016-10-15T06:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/apache/trafficserver/pulls/776/commits","review_comments_url":"https://api.github.com/repos/apache/trafficserver/pulls/776/comments","review_comment_url":"https://api.github.com/repos/apache/trafficserver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/trafficserver/issues/776/comments","statuses_url":"https://api.github.com/repos/apache/trafficserver/statuses/a4a141c2afe37cb079f8efe7e78c4f1a36b4ba5d","head":{"label":"caricaturecm:brotli","ref":"brotli","sha":"a4a141c2afe37cb079f8efe7e78c4f1a36b4ba5d","user":{"login":"caricaturecm","id":6038157,"avatar_url":"https://avatars.githubusercontent.com/u/6038157?v=3","gravatar_id":"","url":"https://api.github.com/users/caricaturecm","html_url":"https://github.com/caricaturecm","followers_url":"https://api.github.com/users/caricaturecm/followers","following_url":"https://api.github.com/users/caricaturecm/following{/other_user}","gists_url":"https://api.github.com/users/caricaturecm/gists{/gist_id}","starred_url":"https://api.github.com/users/caricaturecm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caricaturecm/subscriptions","organizations_url":"https://api.github.com/users/caricaturecm/orgs","repos_url":"https://api.github.com/users/caricaturecm/repos","events_url":"https://api.github.com/users/caricaturecm/events{/privacy}","received_events_url":"https://api.github.com/users/caricaturecm/received_events","type":"User","site_admin":false},"repo":{"id":62199909,"name":"trafficserver","full_name":"caricaturecm/trafficserver","owner":{"login":"caricaturecm","id":6038157,"avatar_url":"https://avatars.githubusercontent.com/u/6038157?v=3","gravatar_id":"","url":"https://api.github.com/users/caricaturecm","html_url":"https://github.com/caricaturecm","followers_url":"https://api.github.com/users/caricaturecm/followers","following_url":"https://api.github.com/users/caricaturecm/following{/other_user}","gists_url":"https://api.github.com/users/caricaturecm/gists{/gist_id}","starred_url":"https://api.github.com/users/caricaturecm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caricaturecm/subscriptions","organizations_url":"https://api.github.com/users/caricaturecm/orgs","repos_url":"https://api.github.com/users/caricaturecm/repos","events_url":"https://api.github.com/users/caricaturecm/events{/privacy}","received_events_url":"https://api.github.com/users/caricaturecm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/caricaturecm/trafficserver","description":"Mirror of Apache Traffic Server","fork":true,"url":"https://api.github.com/repos/caricaturecm/trafficserver","forks_url":"https://api.github.com/repos/caricaturecm/trafficserver/forks","keys_url":"https://api.github.com/repos/caricaturecm/trafficserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caricaturecm/trafficserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caricaturecm/trafficserver/teams","hooks_url":"https://api.github.com/repos/caricaturecm/trafficserver/hooks","issue_events_url":"https://api.github.com/repos/caricaturecm/trafficserver/issues/events{/number}","events_url":"https://api.github.com/repos/caricaturecm/trafficserver/events","assignees_url":"https://api.github.com/repos/caricaturecm/trafficserver/assignees{/user}","branches_url":"https://api.github.com/repos/caricaturecm/trafficserver/branches{/branch}","tags_url":"https://api.github.com/repos/caricaturecm/trafficserver/tags","blobs_url":"https://api.github.com/repos/caricaturecm/trafficserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caricaturecm/trafficserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caricaturecm/trafficserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/caricaturecm/trafficserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caricaturecm/trafficserver/statuses/{sha}","languages_url":"https://api.github.com/repos/caricaturecm/trafficserver/languages","stargazers_url":"https://api.github.com/repos/caricaturecm/trafficserver/stargazers","contributors_url":"https://api.github.com/repos/caricaturecm/trafficserver/contributors","subscribers_url":"https://api.github.com/repos/caricaturecm/trafficserver/subscribers","subscription_url":"https://api.github.com/repos/caricaturecm/trafficserver/subscription","commits_url":"https://api.github.com/repos/caricaturecm/trafficserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/caricaturecm/trafficserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/caricaturecm/trafficserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/caricaturecm/trafficserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/caricaturecm/trafficserver/contents/{+path}","compare_url":"https://api.github.com/repos/caricaturecm/trafficserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caricaturecm/trafficserver/merges","archive_url":"https://api.github.com/repos/caricaturecm/trafficserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caricaturecm/trafficserver/downloads","issues_url":"https://api.github.com/repos/caricaturecm/trafficserver/issues{/number}","pulls_url":"https://api.github.com/repos/caricaturecm/trafficserver/pulls{/number}","milestones_url":"https://api.github.com/repos/caricaturecm/trafficserver/milestones{/number}","notifications_url":"https://api.github.com/repos/caricaturecm/trafficserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caricaturecm/trafficserver/labels{/name}","releases_url":"https://api.github.com/repos/caricaturecm/trafficserver/releases{/id}","deployments_url":"https://api.github.com/repos/caricaturecm/trafficserver/deployments","created_at":"2016-06-29T06:04:36Z","updated_at":"2016-06-29T06:04:44Z","pushed_at":"2016-06-30T21:04:37Z","git_url":"git://github.com/caricaturecm/trafficserver.git","ssh_url":"git@github.com:caricaturecm/trafficserver.git","clone_url":"https://github.com/caricaturecm/trafficserver.git","svn_url":"https://github.com/caricaturecm/trafficserver","homepage":null,"size":58610,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"apache:master","ref":"master","sha":"e707c3ec02d71ae079db9282c825d0449f62a88c","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":356066,"name":"trafficserver","full_name":"apache/trafficserver","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/trafficserver","description":"Mirror of Apache Traffic Server","fork":false,"url":"https://api.github.com/repos/apache/trafficserver","forks_url":"https://api.github.com/repos/apache/trafficserver/forks","keys_url":"https://api.github.com/repos/apache/trafficserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/trafficserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/trafficserver/teams","hooks_url":"https://api.github.com/repos/apache/trafficserver/hooks","issue_events_url":"https://api.github.com/repos/apache/trafficserver/issues/events{/number}","events_url":"https://api.github.com/repos/apache/trafficserver/events","assignees_url":"https://api.github.com/repos/apache/trafficserver/assignees{/user}","branches_url":"https://api.github.com/repos/apache/trafficserver/branches{/branch}","tags_url":"https://api.github.com/repos/apache/trafficserver/tags","blobs_url":"https://api.github.com/repos/apache/trafficserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/trafficserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/trafficserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/trafficserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/trafficserver/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/trafficserver/languages","stargazers_url":"https://api.github.com/repos/apache/trafficserver/stargazers","contributors_url":"https://api.github.com/repos/apache/trafficserver/contributors","subscribers_url":"https://api.github.com/repos/apache/trafficserver/subscribers","subscription_url":"https://api.github.com/repos/apache/trafficserver/subscription","commits_url":"https://api.github.com/repos/apache/trafficserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/trafficserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/trafficserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/trafficserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/trafficserver/contents/{+path}","compare_url":"https://api.github.com/repos/apache/trafficserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/trafficserver/merges","archive_url":"https://api.github.com/repos/apache/trafficserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/trafficserver/downloads","issues_url":"https://api.github.com/repos/apache/trafficserver/issues{/number}","pulls_url":"https://api.github.com/repos/apache/trafficserver/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/trafficserver/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/trafficserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/trafficserver/labels{/name}","releases_url":"https://api.github.com/repos/apache/trafficserver/releases{/id}","deployments_url":"https://api.github.com/repos/apache/trafficserver/deployments","created_at":"2009-10-31T08:00:10Z","updated_at":"2016-07-01T20:09:06Z","pushed_at":"2016-07-01T21:04:49Z","git_url":"git://github.com/apache/trafficserver.git","ssh_url":"git@github.com:apache/trafficserver.git","clone_url":"https://github.com/apache/trafficserver.git","svn_url":"https://github.com/apache/trafficserver","homepage":null,"size":68262,"stargazers_count":429,"watchers_count":429,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":350,"mirror_url":null,"open_issues_count":38,"forks":350,"open_issues":38,"watchers":429,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/trafficserver/pulls/776"},"html":{"href":"https://github.com/apache/trafficserver/pull/776"},"issue":{"href":"https://api.github.com/repos/apache/trafficserver/issues/776"},"comments":{"href":"https://api.github.com/repos/apache/trafficserver/issues/776/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/trafficserver/pulls/776/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/trafficserver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/trafficserver/pulls/776/commits"},"statuses":{"href":"https://api.github.com/repos/apache/trafficserver/statuses/a4a141c2afe37cb079f8efe7e78c4f1a36b4ba5d"}}}}
{"actor":{"display_login":"caricaturecm"}}