HTTP status code 415 with Nextcloud
$ calcurse-caldav --init=two-way warning: Dry run; nothing is imported/exported. Add "DryRun = No" to the warning: [General] section in the configuration file to enable synchronization. Connecting to example.com... error: The server at example.com replied with HTTP status code 415 error: (Unsupported Media Type) while trying to access error: /nextcloud/remote.php/dav/.
calcurses 4.2.1-1.1
Hey! same here,
$ calcurse --version
calcurse 4.3.0 -- text-based organizer
Output trying to sync with calcurse-caldav:
/usr/bin/calcurse-caldav:501: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
config.readfp(open(configfn))
error: The server at nextcloud.grigri.cloud replied with HTTP status code 415
error: (Unsupported Media Type) while trying to access https://nextcloud.grigri.
error: cloud/remote.php/dav/calendars/pando/personal/5386c3129be076df2df49d94254
error: 4c71344ed46f9.ics.
Thanks in advance!
Did you try using a current development snapshot? Might be due to #94.
Same issue with the latest issue on github:
error: The server at example.com replied with HTTP status code 415 error: (Unsupported Media Type) while trying to access error: https://example.com/nextcloud/remote.php/dav/.
~/calcurse/contrib/caldav$ ../../src/calcurse --version calcurse 4.3.0-63-gea0a -- text-based organizer
Copyright (c) 2004-2017 calcurse Development Team. This is free software; see the source for copying conditions.
I realize "me too" is the LEAST helpful report ever, but... me too. calcurse --version calcurse 4.3.0-63-gea0a -- text-based organizer
Removing all local calcurse objects... error: The server at example.com replied with HTTP status code 415 error: (Unsupported Media Type) while trying to access error: https://example.com/remote.php/dav/.
Running the script in debug mode (command line option --debug) might yield some insights...
Sorry. Should have thought of that myself. I'm not well versed in such things, so this tells me nothing. Does it help you? Also, I think I removed my passphrase from this output, but PLEASE let me know if I missed it somewhere...
calcurse-caldav --init=keep-remote --debug /usr/bin/calcurse-caldav:564: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead. config.readfp(open(configfn)) warning: Dry run; nothing is imported/exported. Add "DryRun = No" to the warning: [General] section in the configuration file to enable synchronization. Running command: ['calcurse', '--version'] Connecting to example.com... Removing all local calcurse objects...
REPORT https://example.com/remote.php/dav/ Headers: {'Content-Type': 'application/xml; charset=utf-8', 'Depth': '1'}
< Status: 415 (Unsupported Media Type) < Headers: {'date': 'Sat, 15 Sep 2018 01:42:45 GMT', 'server': 'Apache', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'cache-control': 'no-store, no-cache, must-revalidate', 'pragma': 'no-cache', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'x-robots-tag': 'none', 'x-download-options': 'noopen', 'x-permitted-cross-domain-policies': 'none', 'content-security-policy': "default-src 'none';", 'set-cookie': 'oc_sessionPassphrase=****; path=/; secure; HttpOnly, __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax, __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocyxuokvmjte=3dngs5kl7lrr421371hnftqo80; path=/; secure; HttpOnly, cookie_test=test; expires=Sat, 15-Sep-2018 02:42:45 GMT; Max-Age=3600', 'strict-transport-security': 'max-age=15768000; includeSubDomains; preload', 'transfer-encoding': 'chunked', 'content-type': 'application/xml; charset=utf-8', 'status': '415'} < < <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> < <s:exception>Sabre\DAV\Exception\ReportNotSupported</s:exception> < <s:message/> < <d:supported-report/> < </d:error>
error: The server at example.com replied with HTTP status code 415 error: (Unsupported Media Type) while trying to access error: https://example.com/remote.php/dav/.
Looks like the same issue as #133 --- I have no idea why we get that ReportNotSupported exception, though...
So I hit this today and looking at #133 I tried /remote.php/dav/calendars/username with success but 0 imported/removed from the server. If I append the calendar name it works as expected but only the one calendar of course.
Maybe we need some way of polling the available calendars? Or at least setting them in ar array in the config.
A few versions later, I'm still experiencing exactly the same issues.
❯ calcurse --version
calcurse 4.7.1 -- text-based organizer
Copyright (c) 2004-2020 calcurse Development Team.
This is free software; see the source for copying conditions.
❯ calcurse-caldav --init=two-way --debug -v
Loading configuration from /home/amolith/.config/calcurse/caldav/config...
warning: Dry run; nothing is imported/exported. Add "DryRun = No" to the
warning: [General] section in the configuration file to enable synchronization.
Running command: ['calcurse', '--version']
Connecting to cloud.redacted.com...
> REPORT https://cloud.redacted.com/remote.php/dav/
> Headers: {'Content-Type': 'application/xml; charset=utf-8', 'Depth': '1'}
> <?xml version="1.0" encoding="utf-8" ?><C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"><D:prop><D:getetag /></D:prop><C:filter><C:comp-filter name="VCALENDAR" /></C:filter></C:calendar-query>
< Status: 415 (Unsupported Media Type)
< Headers: {'cache-control': 'no-store, no-cache, must-revalidate', 'content-security-policy': "default-src 'none';", 'content-type': 'application/xml; charset=utf-8', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'pragma': 'no-cache', 'referrer-policy': 'no-referrer', 'server': 'Caddy', 'set-cookie': 'oc_sessionPassphrase=REDACTED; path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax, __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocwlyfz4unn8=l6vqd4q35a8692b1sf4hb3ab79; path=/; secure; HttpOnly; SameSite=Lax', 'status': '415', 'x-content-type-options': 'nosniff', 'x-download-options': 'noopen', 'x-frame-options': 'SAMEORIGIN', 'x-permitted-cross-domain-policies': 'none', 'x-robots-tag': 'none', 'x-xss-protection': '1; mode=block', 'date': 'Thu, 07 Oct 2021 01:55:27 GMT', 'content-length': '215'}
< <?xml version="1.0" encoding="utf-8"?>
< <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
< <s:exception>Sabre\DAV\Exception\ReportNotSupported</s:exception>
< <s:message/>
< <d:supported-report/>
< </d:error>
error: The server at cloud.redacted.com replied with HTTP status code 415
error: (Unsupported Media Type) while trying to access
error: https://cloud.redacted.com/remote.php/dav/.
Appending /calendars/amolith to the path is successful but no events are actually imported.
❯ calcurse-caldav --init=two-way --debug -v
Loading configuration from /home/amolith/.config/calcurse/caldav/config...
warning: Dry run; nothing is imported/exported. Add "DryRun = No" to the
warning: [General] section in the configuration file to enable synchronization.
Running command: ['calcurse', '--version']
Connecting to cloud.redacted.com...
> REPORT https://cloud.redacted.com/remote.php/dav/calendars/amolith/
> Headers: {'Content-Type': 'application/xml; charset=utf-8', 'Depth': '1'}
> <?xml version="1.0" encoding="utf-8" ?><C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"><D:prop><D:getetag /></D:prop><C:filter><C:comp-filter name="VCALENDAR" /></C:filter></C:calendar-query>
< Status: 207 (Multi-Status)
< Headers: {'cache-control': 'no-store, no-cache, must-revalidate', 'content-security-policy': "default-src 'none';", 'content-type': 'application/xml; charset=utf-8', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'pragma': 'no-cache', 'referrer-policy': 'no-referrer', 'server': 'Caddy', 'set-cookie': 'oc_sessionPassphrase=REDACTED; path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax, __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocwlyfz4unn8=4gkib36vvue1if42ddoiv4m499; path=/; secure; HttpOnly; SameSite=Lax', 'status': '207', 'vary': 'Brief,Prefer', 'x-content-type-options': 'nosniff', 'x-download-options': 'noopen', 'x-frame-options': 'SAMEORIGIN', 'x-permitted-cross-domain-policies': 'none', 'x-robots-tag': 'none', 'x-xss-protection': '1; mode=block', 'date': 'Thu, 07 Oct 2021 01:57:42 GMT', 'content-length': '239'}
< <?xml version="1.0"?>
< <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"/>
Running command: ['calcurse', '-G', '--filter-type', 'cal,todo', '--format-apt=%(hash)\\n', '--format-recur-apt=%(hash)\\n', '--format-event=%(hash)\\n', '--format-recur-event=%(hash)\\n', '--format-todo=%(hash)\\n']
Saving synchronization database to /home/amolith/.local/share/calcurse/caldav/sync.db...
0 items imported, 0 items removed locally.
0 items exported, 0 items removed from the server.
Appending /personal (the name of one of my calendars), the entire path looks like /remote.php/dav/calendars/amolith/personal. This is fully successful and would have imported events if it wasn't a dry-run. I'm inclined to agree with @robjloranger and say that a "good enough for now" solution might be declaring an array of calendars to sync in the config.
If this was done with polling, it would probably either need to be interactive so users could select which they want to sync or an additional flag would need to be added that prints out a list of available calendars for specifying in the config. For now, though, I think just adding an array and looping through it as multiple sync targets would be enough.
I'll take a look at the code when I can, but I'm still very new to Python; even if I manage to figure it out, the resulting PR will likely be abysmal :sweat_smile: