Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caldav: add support for getcontentlength property #83

Merged
merged 2 commits into from
May 24, 2022

Conversation

bitfehler
Copy link
Collaborator

Allow the backend to provide a value for the getcontentlength property
as described in RFC 2518 section 13.4.

The implementation treats is as optional, allthough it is a required
property per RFC. Most clients do perfectly fine without it, though.

Properly setting this in the backend makes the CalDAV collection
listable with clients that do require it, e.g. cadaver.

@emersion
Copy link
Owner

Can we also set the Content-Length header in HeadGet?

@bitfehler
Copy link
Collaborator Author

Hm, interesting. I didn't do that because in my tests it was always already there. But I just read the docs for ResponseWriter, and they say

Additionally, if the total size of all written data is under a few KB and there are no Flush calls, the Content-Length header is added automatically.

So I assume that is not to be relied upon and we should do it explicitly?

@emersion
Copy link
Owner

Hm, that's interesting indeed. Yeah, the body could contain a lot of data with embedded resources (contact pictures, etc), so it's better to set it manually if the backend supplies it.

@emersion emersion force-pushed the bitfehler/caldav-content-length branch from 5eedbfd to cd07ac5 Compare May 24, 2022 08:07
Allow the backend to provide a value for the `getcontentlength` property
as described in [RFC 2518 section 13.4][1].

The implementation treats is as optional, allthough it is a required
property per RFC. Most clients do perfectly fine without it, though.

Properly setting this in the backend makes the CalDAV collection
listable with clients that do require it, e.g. cadaver.

[1]: https://datatracker.ietf.org/doc/html/rfc2518#section-13.4
Now that the backend can supply this value, use it for explicitly
setting the header in GET/HEAD responses if available.
@emersion emersion force-pushed the bitfehler/caldav-content-length branch from cd07ac5 to e69ac47 Compare May 24, 2022 08:07
Copy link
Owner

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@emersion emersion merged commit 757a615 into emersion:master May 24, 2022
emersion added a commit that referenced this pull request May 24, 2022
@bitfehler bitfehler deleted the bitfehler/caldav-content-length branch May 24, 2022 08:37
emersion added a commit that referenced this pull request May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants