Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: ServeFile possible bug in list directory #9745
I don't know if this is a bug, or designed to be like this.
I implemented a http server using official http package.
I served a static directory using
The problem is that the relative path is wrong when the url does not ends with slash(/).
For example, in
So that if you click b, it will point to "localhost:8080/b", not "localhost:8080/a/b"
But if I get
I checked the code, and it's caused by http://golang.org/src/net/http/fs.go dirList func, line 86.
I just wonder, is it designed to be so or a bug? Does a 302 redirection to
If you look at the source, comparing ServeFile with FileServer, you
I think it's because ServeFile is a lower-level routine and if you want
Also, the docs says that ServeFile serves the content of the file or