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

carddav: PROPPATCH support for address books #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bitfehler
Copy link
Collaborator

The groundwork for address objects is also there, but it's not fully implemented.

I'll be honest: none of the usual suspects (DavX5, TB/CardBook, Evolution) actually use this, but that just makes me mad. They all rename address books client side only (or not at all). However, since PROPPATCH is a standard WebDAV operation, I successfully renamed my address books on the server using cadaver. I still think this is worth implementing, because if any sane client ever comes along, they might really want to use this.

Regarding the support for address objects, it might be worth taking a closer look at the worthwhileness before going through with it. I suspect that again no major client actually uses it, and for address objects it's also slightly less useful (because e.g. the "displayname" property is likely not used, because a contact is displayed by its name, etc.).

@emersion
Copy link
Owner

emersion commented Feb 9, 2024

Does it help clients to advertise PROPPATCH here?

func (b *backend) Options(r *http.Request) (caps []string, allow []string, err error) {

@bitfehler
Copy link
Collaborator Author

Does it help clients to advertise PROPPATCH here?

Good call, but no. I tried, and it doesn't change anything. For DavX5, there isn't even an option to change it, which seems to be a known issue, and e.g. CardBook never does an OPTIONS request anyways. Evolution does do one, but still doesn't bother ¯\_(ツ)_/¯

carddav/server.go Outdated Show resolved Hide resolved
Comment on lines 652 to 660
for _, prop := range update.Remove {
emptyVal := internal.NewRawXMLElement(prop.Prop.XMLName, nil, nil)
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil {
return nil, err
for _, raw := range prop.Prop.Raw {
rxn, ok := raw.XMLName()
if !ok {
return nil, fmt.Errorf("failed to parse properties")
}
emptyVal := internal.NewRawXMLElement(rxn, nil, nil)
if err := resp.EncodeProp(http.StatusMethodNotAllowed, emptyVal); err != nil {
return nil, err
}
}
}
for _, prop := range update.Set {
emptyVal := internal.NewRawXMLElement(prop.Prop.XMLName, nil, nil)
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil {
return nil, err
for _, raw := range prop.Prop.Raw {
rxn, ok := raw.XMLName()
if !ok {
return nil, fmt.Errorf("failed to parse properties")
}
emptyVal := internal.NewRawXMLElement(rxn, nil, nil)
if err := resp.EncodeProp(http.StatusMethodNotAllowed, emptyVal); err != nil {
return nil, err
}
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

Do we have to write out a multi-status here? Can't we just reply with a toplevel HTTP status instead? Something like internal.HTTPErrorf?

}
default:
emptyVal := internal.NewRawXMLElement(rxn, nil, nil)
if err := resp.EncodeProp(http.StatusNotImplemented, emptyVal); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

Would a 404 be more appropriate for the properties we don't know about?

@emersion
Copy link
Owner

Good call, but no. I tried, and it doesn't change anything.

OK, too bad.

Can we still advertise PROPPATCH for address books?

@bitfehler
Copy link
Collaborator Author

Changed the interface so that the backend can implement UpdateAddressbook atomically, also simplified some things a bit.

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.

2 participants