Skip to content

Commit 8fa2ced

Browse files
committed
docs(proxy): clarify encodePhantomLowerForPair fast-path scope
The previous comment implied the no-allocation fast path covered OAuth JWT phantoms and phantoms whose only escape is %3A. The %3A case still differs from %3a, so the fast path does NOT skip the allocation there. It only fires when every percent-escape uses 0-9 digits exclusively (e.g. %20%21%30). Aligned the comment with the actual behavior.
1 parent 47f16d3 commit 8fa2ced

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

internal/proxy/phantom_pairs.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ func phantomNeedsQueryEscape(phantom []byte) bool {
4040
// the precomputed phantom whose canonical form is %3A.
4141
//
4242
// A pre-scan returns nil before any allocation when no percent-escape
43-
// sequence contains an uppercase A-F hex digit. The "no allocation when
44-
// nothing to lower" path matters for OAuth JWT phantoms and any phantom
45-
// whose only escape is %3A (the encoded colon) — once we've already
46-
// stored the uppercase variant elsewhere on the pair, there is nothing
47-
// new to lower for those.
43+
// sequence contains an uppercase A-F hex digit. This fast path only
44+
// fires for phantoms whose escaped form happens to use 0-9 hex digits
45+
// exclusively. A phantom containing %3A (the encoded colon, which every
46+
// SLUICE_PHANTOM:<name> phantom has after url-encoding) still differs
47+
// between %3A and %3a, so the allocation still occurs in the common
48+
// case — the fast path is for shapes like %20%21%30 where every escape
49+
// is already lowercase-equivalent.
4850
func encodePhantomLowerForPair(encoded []byte) []byte {
4951
if len(encoded) == 0 {
5052
return nil

0 commit comments

Comments
 (0)