srvdir
srvdir copied to clipboard
HEAD request to any srvdir URL returns 405 method not allowed
wget --spider https://*******.srvdir.net 2>&1
HTTP request sent, awaiting response... 405 Method Not Allowed Remote file does not exist -- broken link!!!
Yeah, srvdir should definitely support the HEAD method, I'll change the title.
Is this http://golang.org/pkg/net/http/ what you were referring to?
Yes, that's what I'm referring to. I thought I fixed this at one point. Might be in a branch, I'll take a closer look.
Any updates? I came across the same error when running wget -m -c <URL>
No updates yet, but I'm hoping to get some time to devote to srvdir again soon
zenguy_pc asked about this on #go-nuts. So I took a quick look and it appears you need to add a case for HEAD here just a quick look but you need to add a case for head [here]((https://github.com/inconshreveable/srvdir/blob/2538286c228a9bcfacb59d7e31429cfcbbc18297/src/srvdir/client/fs.go#L523) as it is currently use the default case.
@inconshreveable @jadedgnome maybe you can fix this now it should only be a few lines. Let me know if you have any general go related questions.
@epelc Thanks for looking into this and sorry for the slow response! You're absolutely right, but I think it's a little more involved than that. In order to properly support the HEAD method, the code will have to do all of the logic to determine whether the file exists and then, if appropriate, set the same headers (like maybe content-length) to match as if it were going to serve the file. I think it shouldn't be too bad to refactor fileHandler.serveFile to do that.
Happy to take a pull request if you have the time for it.