http_server icon indicating copy to clipboard operation
http_server copied to clipboard

escape-root tests are broken

Open kevmoo opened this issue 8 years ago • 1 comments

https://github.com/dart-lang/http_server/blob/master/test/virtual_directory_test.dart

They munge URLs using the Uri class. It seems that creating http://localhost:8080/test/../.. normalizes to http://localhost:8080

kevmoo avatar Feb 02 '18 01:02 kevmoo

I think this means that we have behavior that can never be hit.

These pathSegements always come from a Uri, and from what I can tell a Uri will never allow .. in a path segment.

https://github.com/dart-lang/http_server/blob/20a993d1dab295535863f5087028a20e140ed2de/lib/src/virtual_directory.dart#L123

https://github.com/dart-lang/sdk/blob/1b959d6127b79865706a0ebab496e60ba3d3f0a0/sdk/lib/core/uri.dart#L2520-L2525

I'm not sure if it's worth trying to extract unreachable code here or not.

natebosch avatar Feb 05 '20 19:02 natebosch