Closed
Description
http.FileServer doesn't work with files in /proc on Linux. It gets the directories right, but files cannot be downloaded. They are returned with Content-Length: 0 instead.
I would prefer to get the content of the files.
package main
import "net/http"
import "log"
func main() {
http.Handle("/", http.FileServer(http.Dir("/proc")))
log.Fatal(http.ListenAndServe(":8080", nil))
}
Using go version go1.4.2
$ curl -v http://localhost:8080/diskstats
* Hostname was NOT found in DNS cache
* Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> GET /diskstats HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:8080
> Accept: */*
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
< Last-Modified: Tue, 05 May 2015 13:57:42 GMT
< Date: Tue, 05 May 2015 13:57:42 GMT
<