Skip to content

[FIXED] Header search without alloc & bug fixes#7465

Merged
neilalexander merged 1 commit intomainfrom
maurice/hdr-fix
Oct 24, 2025
Merged

[FIXED] Header search without alloc & bug fixes#7465
neilalexander merged 1 commit intomainfrom
maurice/hdr-fix

Conversation

@MauriceVanVeen
Copy link
Copy Markdown
Member

  • Removes string allocations for key+":" in sliceHeader, removeHeaderIfPresent, and setHeader.
  • Fixes a bug in above methods when getting/removing/setting a header that has a common suffix. For example with headers containing first Previous-Nats-Msg-Id and then Nats-Msg-Id. A search/remove/set of Nats-Msg-Id would reference the Previous-Nats-Msg-Id key and value instead.
  • Fixes a bug in setHeader if the value would not be prefixed with a whitespace. Having a header of k:v and calling setHeader to update key k, it would add to the headers instead of update the existing key.

Signed-off-by: Maurice van Veen github@mauricevanveen.com

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner October 23, 2025 10:18
Copy link
Copy Markdown
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@neilalexander neilalexander merged commit 72503cb into main Oct 24, 2025
131 of 136 checks passed
@neilalexander neilalexander deleted the maurice/hdr-fix branch October 24, 2025 09:56
neilalexander added a commit that referenced this pull request Oct 28, 2025
Includes the following:

- #7380
- #7384
- #7385
- #7388
- #7395
- #7400
- #7399
- #7401
- #7402
- #7423
- #7424
- #7411
- #7428
- #7429
- #7431
- #7435
- #7433
- #7443
- #7455
- #7465
- #7466
- #7460
- #7484
- #7479

Signed-off-by: Neil Twigg <neil@nats.io>
neilalexander added a commit that referenced this pull request Oct 30, 2025
Includes the following:

- #7435
- #7433
- #7436
- #7443
- #7440
- #7444
- #7452
- #7455
- #7458
- #7465
- #7466
- #7474
- #7469
- #7460
- #7449
- #7484
- #7479
- #7486
- #7495
- #7482
- #7496

Signed-off-by: Neil Twigg <neil@nats.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants