go-webdav icon indicating copy to clipboard operation
go-webdav copied to clipboard

contacts.icloud.com uses multiple hosts

Open nic-gibson opened this issue 3 years ago • 2 comments
trafficstars

FindAddressBookHomeSet returns only the path of the URL returned from the PROPFIND request. However, iCloud returns a different host name as well as the path. This is then discarded. Trying to retrieve any address objects will then fail with an error as the wrong host is being queried.

Looking at other carddav servers this is not normal behaviour but there doesn't seem to be anything in RFC 6352 that disallows it.

nic-gibson avatar Mar 20 '22 21:03 nic-gibson

For example -

curl -s -X PROPFIND -u "[email protected]" -H "Depth: 0"  --data "<propfind xmlns='DAV:' xmlns:cd='urn:ietf:params:xml:ns:carddav'><prop><cd:addressbook-home-set/></prop></propfind>" https://contacts.icloud.com/1234567/principal

returns

<?xml version="1.0" encoding="UTF-8"?>
<multistatus xmlns="DAV:">
	<response>
		<href>/1234567/principal/</href>
		<propstat>
			<prop>
                <addressbook-home-set xmlns="urn:ietf:params:xml:ns:carddav">
                    <href xmlns="DAV:">https://p37-contacts.icloud.com:443/1234567/carddavhome/</href>
                </addressbook-home-set>
			</prop>
			<status>HTTP/1.1 200 OK</status>
		</propstat>
	</response>
</multistatus>

nic-gibson avatar Mar 20 '22 21:03 nic-gibson

Related: https://github.com/emersion/go-webdav/issues/24

emersion avatar Mar 22 '22 08:03 emersion