Wondering about the easiest way of checking whether a file is located inside a directory. For a directory dir, something that matches dir/foo, dir/dir2/bar, ./dir/foo, but not dir/../baz
@vaporeon_ is there a reason you can’t just normalize the path furst to remove . and .. ?
@aescling Yeah, I could do that, and then check whether the path starts with dir. Was a little worried about performance, but if it's a normal path with no . or .. in it, it's just one read of the string. And if there are . or .., it's still not that much processing as to significantly affect server operation...
@aescling So there are no existing functions that can just tell me?
tangential
@vaporeon_ funnily, the HTTP standard says . and .. directories in the “resource” are invalid but i have seen clients just send such resources verbatim to the server
re: tangential
@vaporeon_ i don't remember how http servers responded in general, i just remember that i had to account fur the pawsibility when writing an http server myself
re: tangential
@aescling > clients send just such resources verbatim to the server
Did the server respond? Did it send the client the files it wanted despite the path containing such
.and..?