Skip to content

urlapi: copy whole path segments in dedotdotify() - #23628

Closed
cmeister2 wants to merge 1 commit into
masterfrom
cm2/urlapi
Closed

cmeister2 wants to merge 1 commit into
masterfrom
cm2/urlapi

Conversation

@cmeister2

Copy link
Copy Markdown
Contributor

Instead of appending the path to the output buffer one byte at a time, copy everything up to the next slash in one go. Dot-segment handling only triggers at a slash so the result is identical, with far fewer dynbuf appends.

@github-actions github-actions Bot added the URL label Oct 27, 2026
Instead of appending the path to the output buffer one byte at a time,
copy everything up to the next slash in one go. Dot-segment handling
only triggers at a slash so the result is identical, with far fewer
dynbuf appends.

Closes #23628
@bagder
bagder requested a balanced review from Copilot October 27, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The bounded segment copies preserve normalization behavior, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Optimizes URL path normalization in dedotdotify() by copying whole path segments instead of appending one byte at a time.

Changes:

  • Uses a bounded memchr() scan to locate the next slash.
  • Appends each segment in one operation while preserving existing dot-segment handling.
File Description
lib/​urlapi.c Replaces byte-by-byte path copying with segment-sized appends.

Review effort: Balanced

@bagder bagder closed this in 939de90 Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants