Repository navigation
Keep request paths with dots inside segments on the fast path when extracting the path prefix - #927
Conversation
arturobernalg
left a comment
There was a problem hiding this comment.
The optimization looks good, but it changes the path prefix for rootless paths containing dots.
For foo.bar/baz, master returns /foo.bar/, while this change returns foo.bar/.
Although this is not a valid HTTP/1.1 origin-form, it changes the authentication cache behavior. I think we should preserve the existing behavior here.
|
@arturobernalg The culprit are my previous changes that have already been merged in, not this change-set Presently the behavior of the method is inconsistent and the first assert fails with the current master. I am going to fix it. This change-set can be merged as is, in my opinion. |
|
@arturobernalg Fixed with e040ff3 @parker89 Please rebase your change and will merge it. |
…tracting the path prefix
d8bd9a7 to
2f70bc6
Compare
|
Rebased. Should be mergeable now. |
|
cherry-picked to |
Follow-up to #915.
RequestSupport#extractPathPrefixcurrently treats any.in the path as needing normalization, so paths with dotted segments or file extensions (/packages/com.example.service/versions/1.2.3,/files/report.csv) still go through segment decoding, dot segment removal and re-encoding.A
.can only begin a dot segment if it is the first character of a segment, so this only flags a.that follows a/or starts the path. Dots anywhere else can't change the result.The output is unchanged. The existing tests pass, and I added tests for dots inside segments as well as for dot segments that still have to be normalized (
/./, a trailing.,%2E%2Eand a leading../). I also compared it with the current implementation on 200k generated paths starting with/and got identical results.JMH, JDK 21, average time and
gc.alloc.rate.norm:/api/v1/packages/com.example.service/versions/1.2.3?...(3 params)/api/v2/datasets/<uuid>/files/report.csv?...(3 params)