EXmlDocument: Save content with xml header
After the latest upgrade of Zimbra, Evolution doesn't sync calendars over caldav properly anymore.
Symptoms: on request REPORT /dav/USER/Calendar/ HTTP/2
Zimbra answers HTTP/2 400 Bad Request
Software: evolution-3.50.3 (fedora package evolution-3.50.3-1.fc39.x86_64) evolution-data-server-3.50.3 (fedora package evolution-data-server- 3.50.3-1.fc39.x86_64)
Reproduce via evolution
-
Stop any running evolution instance
-
To get caldav debug output from a shell, do
pkill -f evolution-calendar-factory; CALDAV_DEBUG=1 /usr/libexec/evolution-calendar-factory -w
-
start evolution
-
Add a caldav calendar source in evolution point it to https://ZIMBRASERVER/dav/USER/Calendar/ , mark "Use a secure connection" and "Server handles meeting invitations". If your URL contains a username with an '@' sign, replace it with '%40' (but not in the field "User" below)
-
Refresh the calendar
-
Read the debug output in the shell
Reproduce via curl
#!/bin/bash
server='zimbra.example.com'
calendar='username%40example.com/Calendar/'
user='username@example.com'
pass='TOP_SECRET'
content_type='application/xml; charset="utf-8"'
method='REPORT'
request='<calendar-query xmlns="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:"><D:prop><D:getetag/></D:prop><filter><comp-filter name="VCALENDAR"><comp-filter name="VEVENT"><time-range start="20240101T164103Z" end="20240311T164103Z"/></comp-filter></comp-filter></filter></calendar-query>'
curl -s -D - --http1.1 \
-u "$user:$pass" \
-X "$method" \
-H "Content-Type: $content_type" \
--data-binary "$request" \
"https://$server/dav/$calendar"
Add
<?xml version="1.0" encoding="utf-8" ?>
and the request goes through without problems.