You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/04/24 18:21:22 UTC
[GitHub] [trafficserver] SolidWallOfCode commented on a diff in pull request #8804: Add support for request body transaction data sink
SolidWallOfCode commented on code in PR #8804:
URL: https://github.com/apache/trafficserver/pull/8804#discussion_r857161970
##########
example/plugins/c-api/txn_data_sink/txn_data_sink.cc:
##########
@@ -117,43 +117,122 @@ client_reader(TSCont contp, TSEvent event, void *edata)
return 0;
}
+/** The handler for transaction data sink for response bodies. */
int
-enable_agent_check(TSHttpTxn txnp)
+response_body_reader(TSCont contp, TSEvent event, void *edata)
{
- TSMBuffer req_buf;
- TSMLoc req_loc;
- int zret = 0;
+ SinkData *data = static_cast<SinkData *>(TSContDataGet(contp));
+
+ // If we got closed, we're done.
+ if (TSVConnClosedGet(contp)) {
+ delete data;
+ TSContDestroy(contp);
+ return 0;
+ }
+
+ TSVIO input_vio = TSVConnWriteVIOGet(contp);
+ if (data == nullptr) {
+ data = new SinkData;
+ TSContDataSet(contp, data);
+ }
+ return body_reader_helper(event, input_vio, data->response_body_bytes);
+}
+
+/** The handler for transaction data sink for request bodies. */
+int
+request_body_reader(TSCont contp, TSEvent event, void *edata)
Review Comment:
This is identical to the previous function except for the member in `data`. I'm not sure if that should be parameterized out or whether having the functions separate makes it a better example.
--
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org