x/net/webdav: WriteHeader
may be called twice when webdav processes methods such as PROPFIND
#66085
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.21.6 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I tried to modify http request method from
HEAD
toPROPFIND
so that I can mock thePROPFIND
request. As follows:I realize that it is not a right approach after testing.
But I got a confusing error message
http: superfluous response.WriteHeader call from github.com/hacdias/webdav/v4/lib.responseWriterNoBody.WriteHeader (webdav.go:222)
:And my webdav client received a
207
response:What did you see happen?
I got a confusing error message
http: superfluous response.WriteHeader call from github.com/hacdias/webdav/v4/lib.responseWriterNoBody.WriteHeader (webdav.go:222)
and207
response.I tried to debug the code, I found that I would get an
short write
error in thishandlePropfind
functionBut before triggering this error, the status code of
207
had already been written into the response header:So in the outermost function used to handle
PROPFIND
orPROPPATCH
methods, when astatus
witherr
was returned, theWriteHeader
was called again, resulting in the client receive a207
response and the server side get ansuperfluous response.WriteHeader call
error.What did you expect to see?
I have given up using
head
to simulatepropfind
, but I hope that when processing thePROPFIND
orPROPPATCH
methods, if the server side encounters an error, it can return500
instead of207
The text was updated successfully, but these errors were encountered: