Apache http client 4: do not copy all request headers on redirect#7483
Merged
Apache http client 4: do not copy all request headers on redirect#7483
Conversation
mcculls
reviewed
Aug 21, 2024
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 48 metrics, 15 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.055 s) : 0, 1055121
Total [baseline] (10.42 s) : 0, 10419610
Agent [candidate] (1.048 s) : 0, 1048271
Total [candidate] (10.365 s) : 0, 10364704
section appsec
Agent [baseline] (1.176 s) : 0, 1176105
Total [baseline] (10.513 s) : 0, 10512884
Agent [candidate] (1.176 s) : 0, 1175537
Total [candidate] (10.543 s) : 0, 10542618
section iast
Agent [baseline] (1.173 s) : 0, 1172662
Total [baseline] (10.827 s) : 0, 10826847
Agent [candidate] (1.181 s) : 0, 1181138
Total [candidate] (10.9 s) : 0, 10900048
section profiling
Agent [baseline] (1.246 s) : 0, 1245747
Total [baseline] (10.619 s) : 0, 10619088
Agent [candidate] (1.247 s) : 0, 1247308
Total [candidate] (10.575 s) : 0, 10575234
gantt
title petclinic - break down per module: candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (673.936 ms) : 0, 673936
BytebuddyAgent [candidate] (667.787 ms) : 0, 667787
GlobalTracer [baseline] (307.497 ms) : 0, 307497
GlobalTracer [candidate] (307.341 ms) : 0, 307341
AppSec [baseline] (51.872 ms) : 0, 51872
AppSec [candidate] (51.524 ms) : 0, 51524
Remote Config [baseline] (671.802 µs) : 0, 672
Remote Config [candidate] (660.59 µs) : 0, 661
Telemetry [baseline] (7.604 ms) : 0, 7604
Telemetry [candidate] (7.476 ms) : 0, 7476
section appsec
BytebuddyAgent [baseline] (682.375 ms) : 0, 682375
BytebuddyAgent [candidate] (681.634 ms) : 0, 681634
GlobalTracer [baseline] (302.512 ms) : 0, 302512
GlobalTracer [candidate] (301.227 ms) : 0, 301227
AppSec [baseline] (157.844 ms) : 0, 157844
AppSec [candidate] (157.777 ms) : 0, 157777
Remote Config [baseline] (614.303 µs) : 0, 614
Remote Config [candidate] (606.617 µs) : 0, 607
Telemetry [baseline] (8.772 ms) : 0, 8772
Telemetry [candidate] (9.283 ms) : 0, 9283
IAST [baseline] (20.935 ms) : 0, 20935
IAST [candidate] (22.901 ms) : 0, 22901
section iast
BytebuddyAgent [baseline] (778.256 ms) : 0, 778256
BytebuddyAgent [candidate] (783.756 ms) : 0, 783756
GlobalTracer [baseline] (296.345 ms) : 0, 296345
GlobalTracer [candidate] (298.909 ms) : 0, 298909
AppSec [baseline] (52.709 ms) : 0, 52709
AppSec [candidate] (52.042 ms) : 0, 52042
Remote Config [baseline] (576.192 µs) : 0, 576
Remote Config [candidate] (598.897 µs) : 0, 599
Telemetry [baseline] (8.784 ms) : 0, 8784
Telemetry [candidate] (11.116 ms) : 0, 11116
IAST [baseline] (22.53 ms) : 0, 22530
IAST [candidate] (21.101 ms) : 0, 21101
section profiling
BytebuddyAgent [baseline] (664.208 ms) : 0, 664208
BytebuddyAgent [candidate] (664.689 ms) : 0, 664689
GlobalTracer [baseline] (389.322 ms) : 0, 389322
GlobalTracer [candidate] (389.388 ms) : 0, 389388
AppSec [baseline] (52.428 ms) : 0, 52428
AppSec [candidate] (52.649 ms) : 0, 52649
Remote Config [baseline] (672.241 µs) : 0, 672
Remote Config [candidate] (687.518 µs) : 0, 688
Telemetry [baseline] (7.354 ms) : 0, 7354
Telemetry [candidate] (7.393 ms) : 0, 7393
ProfilingAgent [baseline] (94.601 ms) : 0, 94601
ProfilingAgent [candidate] (95.29 ms) : 0, 95290
Profiling [baseline] (94.626 ms) : 0, 94626
Profiling [candidate] (95.315 ms) : 0, 95315
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.05 s) : 0, 1050103
Total [baseline] (8.511 s) : 0, 8511198
Agent [candidate] (1.047 s) : 0, 1047126
Total [candidate] (8.503 s) : 0, 8503489
section iast
Agent [baseline] (1.182 s) : 0, 1181529
Total [baseline] (9.021 s) : 0, 9020590
Agent [candidate] (1.182 s) : 0, 1181963
Total [candidate] (8.995 s) : 0, 8995197
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.192 s) : 0, 1191641
Total [baseline] (9.009 s) : 0, 9009156
Agent [candidate] (1.171 s) : 0, 1170595
Total [candidate] (8.946 s) : 0, 8945794
section iast_TELEMETRY_OFF
Agent [baseline] (1.169 s) : 0, 1168637
Total [baseline] (8.964 s) : 0, 8963685
Agent [candidate] (1.184 s) : 0, 1183991
Total [candidate] (9.025 s) : 0, 9024925
gantt
title insecure-bank - break down per module: candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (669.966 ms) : 0, 669966
BytebuddyAgent [candidate] (667.818 ms) : 0, 667818
GlobalTracer [baseline] (306.427 ms) : 0, 306427
GlobalTracer [candidate] (306.367 ms) : 0, 306367
AppSec [baseline] (52.004 ms) : 0, 52004
AppSec [candidate] (51.329 ms) : 0, 51329
Remote Config [baseline] (668.423 µs) : 0, 668
Remote Config [candidate] (664.341 µs) : 0, 664
Telemetry [baseline] (7.582 ms) : 0, 7582
Telemetry [candidate] (7.502 ms) : 0, 7502
section iast
BytebuddyAgent [baseline] (785.031 ms) : 0, 785031
BytebuddyAgent [candidate] (783.493 ms) : 0, 783493
GlobalTracer [baseline] (298.55 ms) : 0, 298550
GlobalTracer [candidate] (300.148 ms) : 0, 300148
AppSec [baseline] (49.156 ms) : 0, 49156
AppSec [candidate] (52.083 ms) : 0, 52083
IAST [baseline] (26.743 ms) : 0, 26743
IAST [candidate] (22.557 ms) : 0, 22557
Remote Config [baseline] (577.496 µs) : 0, 577
Remote Config [candidate] (583.46 µs) : 0, 583
Telemetry [baseline] (7.9 ms) : 0, 7900
Telemetry [candidate] (9.519 ms) : 0, 9519
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (791.809 ms) : 0, 791809
BytebuddyAgent [candidate] (776.981 ms) : 0, 776981
GlobalTracer [baseline] (300.97 ms) : 0, 300970
GlobalTracer [candidate] (296.179 ms) : 0, 296179
AppSec [baseline] (51.818 ms) : 0, 51818
AppSec [candidate] (50.306 ms) : 0, 50306
IAST [baseline] (23.065 ms) : 0, 23065
IAST [candidate] (22.599 ms) : 0, 22599
Remote Config [baseline] (608.834 µs) : 0, 609
Remote Config [candidate] (587.27 µs) : 0, 587
Telemetry [baseline] (9.684 ms) : 0, 9684
Telemetry [candidate] (10.463 ms) : 0, 10463
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (776.072 ms) : 0, 776072
BytebuddyAgent [candidate] (787.113 ms) : 0, 787113
GlobalTracer [baseline] (296.681 ms) : 0, 296681
GlobalTracer [candidate] (300.259 ms) : 0, 300259
AppSec [baseline] (50.941 ms) : 0, 50941
AppSec [candidate] (50.828 ms) : 0, 50828
IAST [baseline] (23.828 ms) : 0, 23828
IAST [candidate] (24.277 ms) : 0, 24277
Remote Config [baseline] (579.272 µs) : 0, 579
Remote Config [candidate] (598.166 µs) : 0, 598
Telemetry [baseline] (7.053 ms) : 0, 7053
Telemetry [candidate] (7.275 ms) : 0, 7275
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 17 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section baseline
no_agent (369.685 µs) : 349, 390
. : milestone, 370,
iast (487.453 µs) : 464, 511
. : milestone, 487,
iast_FULL (558.985 µs) : 537, 581
. : milestone, 559,
iast_GLOBAL (509.04 µs) : 487, 532
. : milestone, 509,
iast_HARDCODED_SECRET_DISABLED (489.158 µs) : 467, 512
. : milestone, 489,
iast_INACTIVE (449.683 µs) : 429, 471
. : milestone, 450,
iast_TELEMETRY_OFF (481.078 µs) : 460, 503
. : milestone, 481,
tracing (447.751 µs) : 427, 468
. : milestone, 448,
section candidate
no_agent (374.155 µs) : 353, 395
. : milestone, 374,
iast (492.736 µs) : 470, 516
. : milestone, 493,
iast_FULL (555.907 µs) : 534, 578
. : milestone, 556,
iast_GLOBAL (518.983 µs) : 495, 543
. : milestone, 519,
iast_HARDCODED_SECRET_DISABLED (483.835 µs) : 462, 505
. : milestone, 484,
iast_INACTIVE (454.96 µs) : 434, 476
. : milestone, 455,
iast_TELEMETRY_OFF (477.913 µs) : 457, 499
. : milestone, 478,
tracing (448.884 µs) : 429, 469
. : milestone, 449,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section baseline
no_agent (1.349 ms) : 1329, 1369
. : milestone, 1349,
appsec (1.762 ms) : 1738, 1786
. : milestone, 1762,
appsec_no_iast (1.729 ms) : 1705, 1753
. : milestone, 1729,
iast (1.474 ms) : 1452, 1497
. : milestone, 1474,
profiling (1.524 ms) : 1498, 1550
. : milestone, 1524,
tracing (1.472 ms) : 1447, 1497
. : milestone, 1472,
section candidate
no_agent (1.349 ms) : 1330, 1368
. : milestone, 1349,
appsec (1.729 ms) : 1705, 1753
. : milestone, 1729,
appsec_no_iast (1.732 ms) : 1707, 1757
. : milestone, 1732,
iast (1.496 ms) : 1474, 1519
. : milestone, 1496,
profiling (1.507 ms) : 1481, 1532
. : milestone, 1507,
tracing (1.474 ms) : 1449, 1498
. : milestone, 1474,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section baseline
no_agent (1.456 ms) : 1445, 1467
. : milestone, 1456,
appsec (2.219 ms) : 2184, 2254
. : milestone, 2219,
iast (1.967 ms) : 1924, 2009
. : milestone, 1967,
iast_GLOBAL (2.02 ms) : 1976, 2063
. : milestone, 2020,
profiling (1.843 ms) : 1808, 1878
. : milestone, 1843,
tracing (1.835 ms) : 1802, 1868
. : milestone, 1835,
section candidate
no_agent (1.459 ms) : 1447, 1470
. : milestone, 1459,
appsec (2.228 ms) : 2193, 2264
. : milestone, 2228,
iast (1.972 ms) : 1930, 2015
. : milestone, 1972,
iast_GLOBAL (2.017 ms) : 1973, 2061
. : milestone, 2017,
profiling (1.863 ms) : 1829, 1897
. : milestone, 1863,
tracing (1.84 ms) : 1807, 1873
. : milestone, 1840,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.39.0-SNAPSHOT~d9adb08412, baseline=1.39.0-SNAPSHOT~77c6fbe6b9
dateFormat X
axisFormat %s
section baseline
no_agent (15.471 s) : 15471000, 15471000
. : milestone, 15471000,
appsec (15.01 s) : 15010000, 15010000
. : milestone, 15010000,
iast (18.843 s) : 18843000, 18843000
. : milestone, 18843000,
iast_GLOBAL (17.83 s) : 17830000, 17830000
. : milestone, 17830000,
profiling (15.817 s) : 15817000, 15817000
. : milestone, 15817000,
tracing (15.14 s) : 15140000, 15140000
. : milestone, 15140000,
section candidate
no_agent (15.378 s) : 15378000, 15378000
. : milestone, 15378000,
appsec (15.194 s) : 15194000, 15194000
. : milestone, 15194000,
iast (18.989 s) : 18989000, 18989000
. : milestone, 18989000,
iast_GLOBAL (17.802 s) : 17802000, 17802000
. : milestone, 17802000,
profiling (15.104 s) : 15104000, 15104000
. : milestone, 15104000,
tracing (14.964 s) : 14964000, 14964000
. : milestone, 14964000,
|
mcculls
reviewed
Aug 21, 2024
8598392 to
9549c58
Compare
9549c58 to
8e4c6dd
Compare
mcculls
reviewed
Aug 22, 2024
mcculls
reviewed
Aug 22, 2024
mcculls
reviewed
Aug 22, 2024
mcculls
reviewed
Aug 22, 2024
mcculls
reviewed
Aug 22, 2024
mcculls
reviewed
Aug 22, 2024
….java Co-authored-by: Stuart McCulloch <[email protected]>
mcculls
reviewed
Aug 22, 2024
mcculls
approved these changes
Aug 22, 2024
Contributor
mcculls
left a comment
There was a problem hiding this comment.
+1 just add a comment to KNOWN_PROPAGATION_HEADERS saying that all strings added here must be lowercase - thanks!
PerfectSlayer
approved these changes
Aug 22, 2024
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
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.
What Does This Do
This PR avoids copying the original request headers when a redirect happen. The issue here is that the original request may contain headers like
Host. In this case, if we copy it on the redirected one, apache http client will keep this one (which might be wrong).This PR takes the request instead from the context. That request is always a Wrapped request. Having access to the wrapped request we can get the original one that contains only the headers manually added (by the user and by us) but not added by the library itself (i.e. Host, Content-Type, ...)
I also added the tag
httpclient-redirectto that instrumentation in order to unplug easily in case of issuesMotivation
Additional Notes
Jira ticket: APMS-12746