SolidWallOfCode commented on a change in pull request #8204:
URL: https://github.com/apache/trafficserver/pull/8204#discussion_r682881890
##########
File path: example/plugins/c-api/txn_data_sink/txn_data_sink.c
##########
@@ -39,12 +39,15 @@
#define PLUGIN_NAME "txn_data_sink"
#define PCP "[" PLUGIN_NAME "] "
+#define MAX_BODY_SIZE 10240
Review comment:
Avoid `#define` - use
```
static constexpr auto MAX_BODY_SIZE = 10240;
```
##########
File path: example/plugins/c-api/txn_data_sink/txn_data_sink.c
##########
@@ -86,20 +90,26 @@ client_reader(TSCont contp, TSEvent event, void *edata)
TSIOBufferReader reader = TSVIOReaderGet(input_vio);
int64_t n = TSIOBufferReaderAvail(reader);
if (n > 0) {
+ if (data->num_consumed_bytes + n > MAX_BODY_SIZE) {
+ TSError(PCP "Received a response body larger than %d bytes\n",
MAX_BODY_SIZE);
Review comment:
How many times can this error be generated? Should the `VIO` be closed
in this case?
--
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]