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 2021/07/13 21:40:02 UTC
[GitHub] [trafficserver] ywkaras commented on a change in pull request #7931: Adds new X-Effective-URL header to the xdebug plugin
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: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org