Thanks! I'm kind of watching golang/go#18974 and now golang/go#18984 to see what happens and when/if it gets fixed in the standard lib. If it does get fixed there, we could remove this hack later, which means we'd want to accompany it with a TODO of some sort.
Based on how those issues upstream went, it looks like we're stuck with doing this. Thanks for taking care of it!
Can we move this lower in the file to keep the serveFile and ServeHTTP methods close together?
Also a godoc on this would be useful.
Yeah, I'm actually going to revisit this and update the PR with the fix I'm using/submitting to golang. I'll add the TODO and comments as well -- hopefully sometime today.
add fix from golang/go
@mholt I think this is ready to be looked at again when you get a chance. The fix has now been merged into golang/go. I've used that implementation here, and added TODO comments to remove it when the fix is released.
Let me know if you want me to revise anything!
Thanks @mastercactapus - I see they merged a fix into Go. Am I correct in understanding that this patch is temporary, then, until they release a Go version that has your patch?
@mholt That is correct. I also tested without this patch against Go master to make sure it was resolved (and how I found an additional case). This is the same code that got merged into Go, adapted of course.
@mastercactapus Cool. When that patch is released, will you update Caddy so this patch won't be redundant? If so, I'll merge this.
@mholt definitely, I can own it.
Thank you for working on this!
@mastercactapus Mind if I invite you to be a collaborator? I can't remember if I've done this for you yet, but it doesn't look like I have. This way you could contribute in a branch instead of a fork, and help with reviewing pull requests and issues when you are able.
@mholt I don't mind, I'd be happy to