-
Notifications
You must be signed in to change notification settings - Fork 848
Adds new X-Effective-URL header to the xdebug plugin #7931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By adding "X-Effective-URL" to the request header "X-Debug", the header "X-Effective-URL" header will be inserted to the request headers with the effective URL value. Exposes the TSHttpTxnEffectiveUrlStringGet() result, which is the URL after the remap. Note: the inserted header is intentionally X-prefixed for consistency with the other headers inserted by the xdebug plugin.
Note that the response code is as such irrelevant in this test since what is being tested is the request header rewriting. Strangely, in local testing the
Contributor
|
I will review it |
Contributor
|
Do we want this in 9.2 or not until 10? |
Contributor
|
We can add this to 9.2.x. |
ywkaras
reviewed
Jul 13, 2021
plugins/xdebug/xdebug.cc
Outdated
| } | ||
|
|
||
| if (dst != TS_NULL_MLOC) { | ||
| TSHandleMLocRelease(buffer, hdr, dst); |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Contributor
Author
|
On 14. Jul 2021, at 0.40, Walt Karas ***@***.***> wrote:
@ywkaras commented on this pull request.
In plugins/xdebug/xdebug.cc <#7931 (comment)>:
> + 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);
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.
Tighter scope nice, so done in 60252d5
… —
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub <#7931 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AUNMHZ63AILPY54BHQIRUYTTXSXDNANCNFSM46MQSQMA>.
|
ywkaras
approved these changes
Jul 20, 2021
masaori335
pushed a commit
to masaori335/trafficserver
that referenced
this pull request
Sep 24, 2021
(backport of apache#7931) By adding "X-Effective-URL" to the request header "X-Debug", the header "X-Effective-URL" header will be inserted to the request headers with the effective URL value. Exposes the TSHttpTxnEffectiveUrlStringGet() result, which is the URL after the remap. Note: the inserted header is intentionally X-prefixed for consistency with the other headers inserted by the xdebug plugin.
jhiapple
added a commit
to jhiapple/trafficserver
that referenced
this pull request
Jun 22, 2023
URLs can have commas which makes the URLs fragile when multiple URLs are returned, and the values of multiple X-Effective-URL headers are merged. Follow-up on 170e12b (Adds new X-Effective-URL header to the xdebug plugin (apache#7931))
maskit
pushed a commit
that referenced
this pull request
Jul 17, 2023
#9899) * Add doublequotes around the URL of X-Effective-URL. URLs can have commas which makes the URLs fragile when multiple URLs are returned, and the values of multiple X-Effective-URL headers are merged. Follow-up on 170e12b (Adds new X-Effective-URL header to the xdebug plugin (#7931)) * Document the X-Effective-URL.
masaori335
pushed a commit
to masaori335/trafficserver
that referenced
this pull request
Sep 26, 2023
apache#9899) (apache#615) * Add doublequotes around the URL of X-Effective-URL. URLs can have commas which makes the URLs fragile when multiple URLs are returned, and the values of multiple X-Effective-URL headers are merged. Follow-up on 170e12b (Adds new X-Effective-URL header to the xdebug plugin (apache#7931)) * Document the X-Effective-URL. (cherry picked from commit 7016476) Co-authored-by: jhiapple <85640167+jhiapple@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By adding "X-Effective-URL" to the request header "X-Debug",
the header "X-Effective-URL" header will be inserted to the
request headers with the effective URL value.
Exposes the TSHttpTxnEffectiveUrlStringGet() result, which is
the URL after the remap.
Note: the inserted header is intentionally X-prefixed for consistency
with the other headers inserted by the xdebug plugin.