ywkaras commented on a change in pull request #7931:
URL: https://github.com/apache/trafficserver/pull/7931#discussion_r669129269
##########
File path: plugins/xdebug/xdebug.cc
##########
@@ -376,6 +377,34 @@ InjectRemapHeader(TSHttpTxn txn, TSMBuffer buffer, TSMLoc
hdr)
}
}
+static void
+InjectEffectiveURLHeader(TSHttpTxn txn, TSMBuffer buffer, TSMLoc hdr)
+{
+ TSMLoc dst = TS_NULL_MLOC;
+
+ struct {
+ char *ptr;
+ int len;
+ } strval = {nullptr, 0};
+
+ TSDebug("xdebug", "attempting to inject X-Effective-URL header");
+
+ strval.ptr = TSHttpTxnEffectiveUrlStringGet(txn, &strval.len);
+
+ if (strval.ptr != nullptr && strval.len > 0) {
+ dst = FindOrMakeHdrField(buffer, hdr, "X-Effective-URL",
lengthof("X-Effective-URL"));
+ if (dst != TS_NULL_MLOC) {
+ TSReleaseAssert(TSMimeHdrFieldValueStringInsert(buffer, hdr, dst, -1 /*
idx */, strval.ptr, strval.len) == TS_SUCCESS);
+ }
+ }
+
+ if (dst != TS_NULL_MLOC) {
+ TSHandleMLocRelease(buffer, hdr, dst);
Review comment:
You could move this between lines 397 and 398, and eliminate this if
statement. Once you did that, you could declare dst on line 395 and delete
line 303.
--
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]