Github user jpeach commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/745#discussion_r68974323
--- Diff: plugins/experimental/xdebug/xdebug.cc ---
@@ -234,6 +237,20 @@ InjectMilestonesHeader(TSHttpTxn txn, TSMBuffer
buffer, TSMLoc hdr)
}
}
+static void
+InjectTxnUuidHeader(TSHttpTxn txn, TSMBuffer buffer, TSMLoc hdr)
+{
+ TSMLoc dst = FindOrMakeHdrField(buffer, hdr, "X-Transaction-Id",
lengthof("X-Transaction-Id"));
+
+ if (TS_NULL_MLOC != dst) {
+ char buf[TS_UUID_STRING_LEN + 22]; // Padded for int64_t (20) + 1
('-') + 1 ('\0')
+ TSUuid uuid = TSProcessUuidGet();
+ int len = snprintf(buf, sizeof(buf) - 1, "%s-%" PRIu64 "",
TSUuidStringGet(uuid), TSHttpTxnIdGet(txn));
+
+ TSReleaseAssert(TSMimeHdrFieldValueStringInsert(buffer, hdr, dst, 0 /*
idx */, buf, len) == TS_SUCCESS);
+ }
--- End diff --
Actually ``TSHandleMLocRelease`` accepts ``TS_NULL_MLOC`` as the last
argument, so all the places here can do away with the null check.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---