emersion / go-webdav

A Go library for WebDAV, CalDAV and CardDAV
MIT License
314 stars 66 forks source link

Allow PROPFIND request with empty request body #122

Closed greensea closed 8 months ago

greensea commented 1 year ago

A request body is not mandatory in PROPFIND request according to https://www.rfc-editor.org/rfc/rfc4918#section-9.1 If the client does not send a request body, the request should be treated as an AllProp request.

emersion commented 1 year ago

The server is not guaranteed to return a ContentLength header field though. It would be better to check for the io.EOF error instead.

greensea commented 1 year ago

I am confused. The ContentLength is a request attribute, not a response header.

A client may send a request with an empty body, and the http.Request.ContentLength is 0. The patched code check this ContentLength property and make the request treated as an AllProp request.

emersion commented 1 year ago

Sorry, I got things mixed up: the client can omit the Content-Length header, but still provide a non-empty request body.

emersion commented 8 months ago

Superseded by b043bbd9657b