bneradt commented on code in PR #10191:
URL: https://github.com/apache/trafficserver/pull/10191#discussion_r1313229895


##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// The primary include file, this has to always be included
+#include <cripts/Preamble.hpp>
+
+#include <cripts/Bundles/Common.hpp>
+
+// Globals for this Cript
+static Matcher::Range::IP CRIPT_ALLOW({"192.168.201.0/24", "10.0.0.0/8"});
+
+// This is called only when the plugin is initialized
+do_init()
+{
+  TSDebug("Cript", "Hello, example1 plugin is being initialized");
+}
+
+do_create_instance()
+{
+  instance.metrics[0] = Metrics::Sum::create("cript.example1.c0");
+  instance.metrics[1] = Metrics::Sum::create("cript.example1.c1");
+  instance.metrics[2] = Metrics::Sum::create("cript.example1.c2");
+  instance.metrics[3] = Metrics::Sum::create("cript.example1.c3");
+  instance.metrics[4] = Metrics::Sum::create("cript.example1.c4");
+  instance.metrics[5] = Metrics::Sum::create("cript.example1.c5");
+  instance.metrics[6] = Metrics::Sum::create("cript.example1.c6");
+  instance.metrics[7] = Metrics::Sum::create("cript.example1.c7");
+  instance.metrics[8] = Metrics::Sum::create("cript.example1.c8"); // This one 
should resize() the storage
+
+  Bundle::Common::activate().dscp(10).cache_control("max-age=259200");

Review Comment:
   This line could use a comment. I assume this is a chain of function calls 
configuring various aspects of the connection/transaction.
   
   Is the dscp here referring to IP QoS classification?



##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// The primary include file, this has to always be included
+#include <cripts/Preamble.hpp>
+
+#include <cripts/Bundles/Common.hpp>
+
+// Globals for this Cript
+static Matcher::Range::IP CRIPT_ALLOW({"192.168.201.0/24", "10.0.0.0/8"});
+
+// This is called only when the plugin is initialized
+do_init()
+{
+  TSDebug("Cript", "Hello, example1 plugin is being initialized");
+}
+
+do_create_instance()
+{
+  instance.metrics[0] = Metrics::Sum::create("cript.example1.c0");
+  instance.metrics[1] = Metrics::Sum::create("cript.example1.c1");
+  instance.metrics[2] = Metrics::Sum::create("cript.example1.c2");
+  instance.metrics[3] = Metrics::Sum::create("cript.example1.c3");
+  instance.metrics[4] = Metrics::Sum::create("cript.example1.c4");
+  instance.metrics[5] = Metrics::Sum::create("cript.example1.c5");
+  instance.metrics[6] = Metrics::Sum::create("cript.example1.c6");
+  instance.metrics[7] = Metrics::Sum::create("cript.example1.c7");
+  instance.metrics[8] = Metrics::Sum::create("cript.example1.c8"); // This one 
should resize() the storage
+
+  Bundle::Common::activate().dscp(10).cache_control("max-age=259200");
+}
+
+do_txn_close()
+{
+  borrow conn = Client::Connection::get();
+
+  conn.pacing = Cript::Pacing::Off;
+  CDebug("Cool, TXN close also works");
+}
+
+do_send_request()
+{
+  borrow req = Server::Request::get();
+
+  req["X-Leif"] = "Meh";
+}
+
+do_read_response()
+{
+  borrow resp = Server::Response::get();
+
+  resp["X-DBJ"] = "Vrooom!";
+}
+
+do_send_response()
+{
+  borrow resp = Client::Response::get();
+  borrow conn = Client::Connection::get();
+  string msg  = "Eliminate TSCPP";
+
+  resp["Server"]         = "";        // Deletes the Server header
+  resp["X-AMC"]          = msg;       // New header
+  resp["Cache-Control"]  = "Private"; // Deletes old CC values, and sets a new 
one
+  resp["X-UUID"]         = UUID::Unique::get();
+  resp["X-tcpinfo"]      = conn.tcpinfo.log();
+  resp["X-Cache-Status"] = resp.cache;
+  resp["X-Integer"]      = 666;
+  resp["X-Data"]         = AsString(txn_data[2]);
+
+  resp["X-ASN"]         = conn.geo.ASN();
+  resp["X-ASN-Name"]    = conn.geo.ASNName();
+  resp["X-Country"]     = conn.geo.Country();
+  resp["X-ISO-Country"] = conn.geo.CountryCode();
+
+  // Setup some connection parameters
+  conn.congestion = "bbr";
+  conn.dscp       = 8;
+  conn.pacing     = 100000;
+
+  // Some file operations (note that the paths aren't required here, can just 
be strings, but it's a good practice)
+  static const File::Path p1("/tmp/foo");
+  static const File::Path p2("/tmp/secret.txt");
+
+  if (File::Status(p1).type() == File::Type::regular) {
+    resp["X-Foo-Exists"] = "yes";
+  } else {
+    resp["X-Foo-Exists"] = "no";
+  }
+
+  string secret = File::Line::Reader(p2);
+  CDebug("Read secret = {}", secret);
+
+  if (resp.status == 200) {
+    resp.status = 222;
+  }
+
+  borrow url2 = Cache::URL::get();
+
+  CDebug("Cache URL: {}", url2.url());
+  CDebug("Cache Host: {}", url2.host);
+  CDebug("Txn count: {}", conn.count());
+}
+
+do_remap()
+{
+  auto now    = Time::Local::now();
+  borrow req  = Client::Request::get();
+  borrow conn = Client::Connection::get();
+  auto ip     = conn.ip();
+
+  if (CRIPT_ALLOW.contains(ip)) {
+    CDebug("Client IP allowed: {}", ip.string(24, 64));
+  }
+
+  CDebug("Epoch time is {} (or via .epoch(), {}", now, now.epoch());
+  CDebug("Year is {}", now.year());
+  CDebug("Month is {}", now.month());
+  CDebug("Day is {}", now.day());
+  CDebug("Hour is {}", now.hour());
+  CDebug("Day number is {}", now.yearday());
+
+  CDebug("from_url = {}", instance.from_url.c_str());
+  CDebug("to_url = {}", instance.to_url.c_str());
+
+  // Turn off the cache for testing
+  // proxy.config.http.cache.http.set(1);
+  // control.cache.nostore.set(true);
+
+  CDebug("Int config cache.http = {}", proxy.config.http.cache.http.get());
+  CDebug("Float config cache.heuristic_lm_factor = {}", 
proxy.config.http.cache.heuristic_lm_factor.get());
+  CDebug("X-Miles = {}", req["X-Miles"]);
+  CDebug("random(1000) = {}", Cript::random(1000));
+
+  borrow url    = Pristine::URL::get();
+  auto old_port = url.port;
+
+  CDebug("Method is {}", req.method);
+  CDebug("Scheme is {}", url.scheme);
+  CDebug("Host is {}", url.host);
+  CDebug("Port is {}", url.port);
+  CDebug("Path is {}", url.path);
+  CDebug("Path[1] is {}", url.path[1]);
+  CDebug("Query is {}", url.query);
+
+  if (url.query["foo"] > 100) {
+    CDebug("Query[foo] is > 100");
+  }
+
+  if (url.path == "some/url" || url.path[0] == "other") {
+    CDebug("The path comparison triggered");
+  }
+
+  url.host = "foobar.com";
+  url.port = "81";
+  url.port = old_port;
+
+  // TXN data slots
+  txn_data[0] = true;
+  txn_data[1] = 17;
+  txn_data[2] = "DBJ";
+
+  // Regular expressions
+  static Matcher::PCRE pcre("^/([^/]+)/(.*)$");
+
+  auto res = pcre.match("/foo/bench/bar"); // Can also call contains(), same 
thing
+
+  if (res) {
+    CDebug("Ovector count is {}", res.count());
+    CDebug("First capture is {}", res[1]);
+    CDebug("Second capture is {}", res[2]);
+  } else {
+    CDebug("Regular expression did not match, that is not expected!");
+  }
+
+  // ATS versions
+  CDebug("ATS version = {}", version);
+  CDebug("ATS Major Version = {}", version.major);
+
+  // Some Crypto::Base64 tests
+  static auto base64_test = 
"VGltZSB3aWxsIG5vdCBzbG93IGRvd24gd2hlbiBzb21ldGhpbmcgdW5wbGVhc2FudCBsaWVzIGFoZWFkLg==";
+  auto hp                 = Crypto::Base64::decode(base64_test);
+  auto hp2                = Crypto::Base64::encode(hp);
+
+  CDebug("HP quote: {}", hp);
+  if (base64_test != hp2) {
+    CDebug("Base64 failed: {}", hp2);
+  } else {
+    CDebug("Base64 encode reproduced the decoded HP string");
+  }
+
+  // Some Crypto::Escape (URL escaping) tests
+  static auto escape_test = "Hello_World_!@%23$%25%5E&*()_%2B%3C%3E?%2C.%2F";
+  auto uri                = Crypto::Escape::decode(escape_test);
+  auto uri2               = Crypto::Escape::encode(uri);
+
+  CDebug("Unescaped URI: {}", uri);
+  if (escape_test != uri2) {
+    CDebug("URL Escape failed: {}", uri2);
+  } else {
+    CDebug("Url Escape encode reproduced the decoded HP string");
+  }
+
+  // Testing Crypto SHA and encryption
+  auto hex = format("{}", Crypto::SHA256::encode("Hello World"));
+
+  CDebug("SHA256 = {}", hex);
+
+  // Testing iterators
+  for (auto hdr : req) {
+    CDebug("Header: {} = {}", hdr, req[hdr]);
+    if (hdr.starts_with("AWS-")) {
+      req[hdr].clear();
+    }
+  }
+
+  // Testing some simple metrics
+  static auto m1 = Metrics::Sum("cript.example1`.m1");
+  static auto m2 = Metrics::Counter("cript.example1`.m2");
+
+  m1.increment(100);
+  m2.increment();
+
+  instance.metrics[0]->increment();
+  instance.metrics[8]->increment();
+}
+
+#include <cripts/Epilogue.hpp>

Review Comment:
   Is this needed at the end of every cripts script? If so, let's add a comment 
here saying as such similar to the comment you have for for the Preamble.h 
include.



##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// The primary include file, this has to always be included
+#include <cripts/Preamble.hpp>
+
+#include <cripts/Bundles/Common.hpp>
+
+// Globals for this Cript
+static Matcher::Range::IP CRIPT_ALLOW({"192.168.201.0/24", "10.0.0.0/8"});
+
+// This is called only when the plugin is initialized
+do_init()
+{
+  TSDebug("Cript", "Hello, example1 plugin is being initialized");
+}
+
+do_create_instance()
+{
+  instance.metrics[0] = Metrics::Sum::create("cript.example1.c0");

Review Comment:
   Am I understanding correctly that every Cript plugin gets its own `instance` 
for free? That's kind of cool. That should make txn/session/whatever plugin 
handling safer.
   
   How does a Cript plugin store its arbitrary data in instance?



##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// The primary include file, this has to always be included
+#include <cripts/Preamble.hpp>
+
+#include <cripts/Bundles/Common.hpp>
+
+// Globals for this Cript
+static Matcher::Range::IP CRIPT_ALLOW({"192.168.201.0/24", "10.0.0.0/8"});
+
+// This is called only when the plugin is initialized
+do_init()
+{
+  TSDebug("Cript", "Hello, example1 plugin is being initialized");
+}
+
+do_create_instance()
+{
+  instance.metrics[0] = Metrics::Sum::create("cript.example1.c0");
+  instance.metrics[1] = Metrics::Sum::create("cript.example1.c1");
+  instance.metrics[2] = Metrics::Sum::create("cript.example1.c2");
+  instance.metrics[3] = Metrics::Sum::create("cript.example1.c3");
+  instance.metrics[4] = Metrics::Sum::create("cript.example1.c4");
+  instance.metrics[5] = Metrics::Sum::create("cript.example1.c5");
+  instance.metrics[6] = Metrics::Sum::create("cript.example1.c6");
+  instance.metrics[7] = Metrics::Sum::create("cript.example1.c7");
+  instance.metrics[8] = Metrics::Sum::create("cript.example1.c8"); // This one 
should resize() the storage
+
+  Bundle::Common::activate().dscp(10).cache_control("max-age=259200");
+}
+
+do_txn_close()
+{
+  borrow conn = Client::Connection::get();
+
+  conn.pacing = Cript::Pacing::Off;
+  CDebug("Cool, TXN close also works");
+}
+
+do_send_request()
+{
+  borrow req = Server::Request::get();
+
+  req["X-Leif"] = "Meh";
+}
+
+do_read_response()
+{
+  borrow resp = Server::Response::get();
+
+  resp["X-DBJ"] = "Vrooom!";
+}
+
+do_send_response()
+{
+  borrow resp = Client::Response::get();
+  borrow conn = Client::Connection::get();
+  string msg  = "Eliminate TSCPP";
+
+  resp["Server"]         = "";        // Deletes the Server header
+  resp["X-AMC"]          = msg;       // New header
+  resp["Cache-Control"]  = "Private"; // Deletes old CC values, and sets a new 
one
+  resp["X-UUID"]         = UUID::Unique::get();
+  resp["X-tcpinfo"]      = conn.tcpinfo.log();
+  resp["X-Cache-Status"] = resp.cache;
+  resp["X-Integer"]      = 666;
+  resp["X-Data"]         = AsString(txn_data[2]);
+
+  resp["X-ASN"]         = conn.geo.ASN();
+  resp["X-ASN-Name"]    = conn.geo.ASNName();
+  resp["X-Country"]     = conn.geo.Country();
+  resp["X-ISO-Country"] = conn.geo.CountryCode();
+
+  // Setup some connection parameters
+  conn.congestion = "bbr";
+  conn.dscp       = 8;
+  conn.pacing     = 100000;
+
+  // Some file operations (note that the paths aren't required here, can just 
be strings, but it's a good practice)
+  static const File::Path p1("/tmp/foo");
+  static const File::Path p2("/tmp/secret.txt");
+
+  if (File::Status(p1).type() == File::Type::regular) {
+    resp["X-Foo-Exists"] = "yes";
+  } else {
+    resp["X-Foo-Exists"] = "no";
+  }
+
+  string secret = File::Line::Reader(p2);
+  CDebug("Read secret = {}", secret);
+
+  if (resp.status == 200) {
+    resp.status = 222;
+  }
+
+  borrow url2 = Cache::URL::get();
+
+  CDebug("Cache URL: {}", url2.url());
+  CDebug("Cache Host: {}", url2.host);
+  CDebug("Txn count: {}", conn.count());
+}
+
+do_remap()
+{
+  auto now    = Time::Local::now();
+  borrow req  = Client::Request::get();
+  borrow conn = Client::Connection::get();
+  auto ip     = conn.ip();
+
+  if (CRIPT_ALLOW.contains(ip)) {
+    CDebug("Client IP allowed: {}", ip.string(24, 64));
+  }
+
+  CDebug("Epoch time is {} (or via .epoch(), {}", now, now.epoch());
+  CDebug("Year is {}", now.year());
+  CDebug("Month is {}", now.month());
+  CDebug("Day is {}", now.day());
+  CDebug("Hour is {}", now.hour());
+  CDebug("Day number is {}", now.yearday());
+
+  CDebug("from_url = {}", instance.from_url.c_str());
+  CDebug("to_url = {}", instance.to_url.c_str());
+
+  // Turn off the cache for testing
+  // proxy.config.http.cache.http.set(1);
+  // control.cache.nostore.set(true);

Review Comment:
   Setting configuration like this looks pretty convenient. I assume we'll only 
expose configurable parameters for overridable configurations?



##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// The primary include file, this has to always be included
+#include <cripts/Preamble.hpp>
+
+#include <cripts/Bundles/Common.hpp>
+
+// Globals for this Cript
+static Matcher::Range::IP CRIPT_ALLOW({"192.168.201.0/24", "10.0.0.0/8"});
+
+// This is called only when the plugin is initialized
+do_init()
+{
+  TSDebug("Cript", "Hello, example1 plugin is being initialized");
+}
+
+do_create_instance()
+{
+  instance.metrics[0] = Metrics::Sum::create("cript.example1.c0");
+  instance.metrics[1] = Metrics::Sum::create("cript.example1.c1");
+  instance.metrics[2] = Metrics::Sum::create("cript.example1.c2");
+  instance.metrics[3] = Metrics::Sum::create("cript.example1.c3");
+  instance.metrics[4] = Metrics::Sum::create("cript.example1.c4");
+  instance.metrics[5] = Metrics::Sum::create("cript.example1.c5");
+  instance.metrics[6] = Metrics::Sum::create("cript.example1.c6");
+  instance.metrics[7] = Metrics::Sum::create("cript.example1.c7");
+  instance.metrics[8] = Metrics::Sum::create("cript.example1.c8"); // This one 
should resize() the storage
+
+  Bundle::Common::activate().dscp(10).cache_control("max-age=259200");
+}
+
+do_txn_close()
+{
+  borrow conn = Client::Connection::get();
+
+  conn.pacing = Cript::Pacing::Off;
+  CDebug("Cool, TXN close also works");
+}
+
+do_send_request()
+{
+  borrow req = Server::Request::get();
+
+  req["X-Leif"] = "Meh";
+}
+
+do_read_response()
+{
+  borrow resp = Server::Response::get();
+
+  resp["X-DBJ"] = "Vrooom!";
+}
+
+do_send_response()
+{
+  borrow resp = Client::Response::get();
+  borrow conn = Client::Connection::get();
+  string msg  = "Eliminate TSCPP";
+
+  resp["Server"]         = "";        // Deletes the Server header

Review Comment:
   I don't think we can assume that an empty value implies field deletion. It's 
valid for an HTTP field to have an empty value. `Accept-Encoding`, for 
instance, can have an empty value and it has a particular meaning:
   
   https://www.rfc-editor.org/rfc/rfc2616#section-14.3
   
   > If the Accept-Encoding field-value is empty, then only the "identity" 
encoding is acceptable.
   
   I suspect we need to have a `.delete()` function or something like it.



##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+

Review Comment:
   * As I review this, this example1.cc is the most important file in this 
patch. And I suspect this will be the case for others using this too who will 
go to this and hopefully other example Cript files. You have some great 
comments here, but **let's multiply them by 10.** At the start here, lets 
include an introductory comment explaining some of the philosophies of Cripts 
(I think you can copy and paste your description from this PR), and an 
explanation of what this example Cripts script does. I just skimmed through the 
script and it's not obvious to me yet what this does. Maybe it doesn't do 
anything specific other than highlight some features, which is fine for one 
example file.
   * A question on terminology: are we calling these files "cripts", "scripts", 
"plugins", or something else? Maybe a "cript plugin"?
   * Do you plan to add to the `docs/` for Cripts in a separate PR?



##########
example/cripts/example1.cc:
##########
@@ -0,0 +1,242 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+// The primary include file, this has to always be included
+#include <cripts/Preamble.hpp>
+
+#include <cripts/Bundles/Common.hpp>
+
+// Globals for this Cript
+static Matcher::Range::IP CRIPT_ALLOW({"192.168.201.0/24", "10.0.0.0/8"});
+
+// This is called only when the plugin is initialized
+do_init()
+{
+  TSDebug("Cript", "Hello, example1 plugin is being initialized");
+}
+
+do_create_instance()
+{
+  instance.metrics[0] = Metrics::Sum::create("cript.example1.c0");
+  instance.metrics[1] = Metrics::Sum::create("cript.example1.c1");
+  instance.metrics[2] = Metrics::Sum::create("cript.example1.c2");
+  instance.metrics[3] = Metrics::Sum::create("cript.example1.c3");
+  instance.metrics[4] = Metrics::Sum::create("cript.example1.c4");
+  instance.metrics[5] = Metrics::Sum::create("cript.example1.c5");
+  instance.metrics[6] = Metrics::Sum::create("cript.example1.c6");
+  instance.metrics[7] = Metrics::Sum::create("cript.example1.c7");
+  instance.metrics[8] = Metrics::Sum::create("cript.example1.c8"); // This one 
should resize() the storage
+
+  Bundle::Common::activate().dscp(10).cache_control("max-age=259200");
+}
+
+do_txn_close()
+{
+  borrow conn = Client::Connection::get();
+
+  conn.pacing = Cript::Pacing::Off;
+  CDebug("Cool, TXN close also works");
+}
+
+do_send_request()
+{
+  borrow req = Server::Request::get();
+
+  req["X-Leif"] = "Meh";
+}
+
+do_read_response()
+{
+  borrow resp = Server::Response::get();
+
+  resp["X-DBJ"] = "Vrooom!";
+}
+
+do_send_response()
+{
+  borrow resp = Client::Response::get();
+  borrow conn = Client::Connection::get();
+  string msg  = "Eliminate TSCPP";
+
+  resp["Server"]         = "";        // Deletes the Server header
+  resp["X-AMC"]          = msg;       // New header
+  resp["Cache-Control"]  = "Private"; // Deletes old CC values, and sets a new 
one
+  resp["X-UUID"]         = UUID::Unique::get();
+  resp["X-tcpinfo"]      = conn.tcpinfo.log();
+  resp["X-Cache-Status"] = resp.cache;
+  resp["X-Integer"]      = 666;
+  resp["X-Data"]         = AsString(txn_data[2]);
+
+  resp["X-ASN"]         = conn.geo.ASN();
+  resp["X-ASN-Name"]    = conn.geo.ASNName();
+  resp["X-Country"]     = conn.geo.Country();
+  resp["X-ISO-Country"] = conn.geo.CountryCode();
+
+  // Setup some connection parameters
+  conn.congestion = "bbr";
+  conn.dscp       = 8;
+  conn.pacing     = 100000;
+
+  // Some file operations (note that the paths aren't required here, can just 
be strings, but it's a good practice)

Review Comment:
   I assume then that `p3("bar");` would refer to a file named `bar` in the pwd 
of the traffic server process?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to