WebDAV push doesn't handle 301/302, fails to push new events to Zimbra servers



  • DAVdroid fails to push new calendar events to Zimbra servers because it does not support a 302 or 301 redirect answer to a push request. The Android log shows the problem (anonymized):

    I/davdroid.SyncManager(11040): Fetching 0 new remote resource(s)
    I/davdroid.SyncManager(11040): Fetching 0 updated remote resource(s)
    I/davdroid.SyncManager(11040): Removing non-dirty resources that are not present remotely anymore
    D/davdroid.LocalCollection(11040): Committing 1 operations
    I/davdroid.SyncManager(11040): Sync complete, fetching new CTag
    D/davdroid.LocalCollection(11040): Committing 1 operations
    I/davdroid.SyncManager(11040): Remotely removing 0 deleted resource(s) (if not changed)
    I/davdroid.SyncManager(11040): Uploading 0 new resource(s) (if not existing)
    I/davdroid.SyncManager(11040): Uploading 1 modified resource(s) (if not changed)
    D/davdroid.WebDavResource(11040): Sending PUT request:
    D/davdroid.WebDavResource(11040): BEGIN:VCALENDAR
    D/davdroid.WebDavResource(11040): VERSION:2.0
    D/davdroid.WebDavResource(11040): PRODID:-//bitfire web engineering//DAVdroid 0.5.6-alpha//EN
    D/davdroid.WebDavResource(11040): BEGIN:VEVENT
    D/davdroid.WebDavResource(11040): DTSTAMP:20140118T141210Z
    D/davdroid.WebDavResource(11040): UID:20140118T125454Z-11040@1d3fefc92893b72c
    D/davdroid.WebDavResource(11040): DTSTART;TZID=Europe/Amsterdam:20140119T200000
    D/davdroid.WebDavResource(11040): DTEND;TZID=Europe/Amsterdam:20140119T230000
    D/davdroid.WebDavResource(11040): SUMMARY:NOT TELLING YOU
    D/davdroid.WebDavResource(11040): LOCATION:NOT TELLING YOU, EITHER
    D/davdroid.WebDavResource(11040): DESCRIPTION:THIS SHOULD STAY PRIVATE
    D/davdroid.WebDavResource(11040): STATUS:TENTATIVE
    D/davdroid.WebDavResource(11040): ORGANIZER:HIDDEN
    D/davdroid.WebDavResource(11040): LAST-MODIFIED:20140118T141210Z
    D/davdroid.WebDavResource(11040): BEGIN:VALARM
    D/davdroid.WebDavResource(11040): TRIGGER:-PT90M
    D/davdroid.WebDavResource(11040): ACTION:DISPLAY
    D/davdroid.WebDavResource(11040): DESCRIPTION:NOT TELLING YOU
    D/davdroid.WebDavResource(11040): END:VALARM
    D/davdroid.WebDavResource(11040): END:VEVENT
    D/davdroid.WebDavResource(11040): BEGIN:VTIMEZONE
    D/davdroid.WebDavResource(11040): TZID:Europe/Amsterdam
    D/davdroid.WebDavResource(11040): TZURL:http://tzurl.org/zoneinfo/Europe/Amsterdam
    D/davdroid.WebDavResource(11040): X-LIC-LOCATION:Europe/Amsterdam
    D/davdroid.WebDavResource(11040): BEGIN:DAYLIGHT
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0100
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0200
    D/davdroid.WebDavResource(11040): TZNAME:CEST
    D/davdroid.WebDavResource(11040): DTSTART:19810329T020000
    D/davdroid.WebDavResource(11040): RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
    D/davdroid.WebDavResource(11040): END:DAYLIGHT
    D/davdroid.WebDavResource(11040): BEGIN:STANDARD
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0200
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0100
    D/davdroid.WebDavResource(11040): TZNAME:CET
    D/davdroid.WebDavResource(11040): DTSTART:19961027T030000
    D/davdroid.WebDavResource(11040): RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
    D/davdroid.WebDavResource(11040): END:STANDARD
    D/davdroid.WebDavResource(11040): BEGIN:STANDARD
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+001932
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+001932
    D/davdroid.WebDavResource(11040): TZNAME:AMT
    D/davdroid.WebDavResource(11040): DTSTART:18350101T000000
    D/davdroid.WebDavResource(11040): RDATE:18350101T000000
    D/davdroid.WebDavResource(11040): END:STANDARD
    D/davdroid.WebDavResource(11040): BEGIN:DAYLIGHT
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+001932
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+011932
    D/davdroid.WebDavResource(11040): TZNAME:NST
    D/davdroid.WebDavResource(11040): DTSTART:19160430T234028
    D/davdroid.WebDavResource(11040): RDATE:19160430T234028
    D/davdroid.WebDavResource(11040): RDATE:19170416T014028
    D/davdroid.WebDavResource(11040): RDATE:19180401T014028
    D/davdroid.WebDavResource(11040): RDATE:19190407T014028
    D/davdroid.WebDavResource(11040): RDATE:19200405T014028
    D/davdroid.WebDavResource(11040): RDATE:19210404T014028
    D/davdroid.WebDavResource(11040): RDATE:19220326T014028
    D/davdroid.WebDavResource(11040): RDATE:19230601T014028
    D/davdroid.WebDavResource(11040): RDATE:19240330T014028
    D/davdroid.WebDavResource(11040): RDATE:19250605T014028
    D/davdroid.WebDavResource(11040): RDATE:19260515T014028
    D/davdroid.WebDavResource(11040): RDATE:19270515T014028
    D/davdroid.WebDavResource(11040): RDATE:19280515T014028
    D/davdroid.WebDavResource(11040): RDATE:19290515T014028
    D/davdroid.WebDavResource(11040): RDATE:19300515T014028
    D/davdroid.WebDavResource(11040): RDATE:19310515T014028
    D/davdroid.WebDavResource(11040): RDATE:19320522T014028
    D/davdroid.WebDavResource(11040): RDATE:19330515T014028
    D/davdroid.WebDavResource(11040): RDATE:19340515T014028
    D/davdroid.WebDavResource(11040): RDATE:19350515T014028
    D/davdroid.WebDavResource(11040): RDATE:19360515T014028
    D/davdroid.WebDavResource(11040): RDATE:19370522T014028
    D/davdroid.WebDavResource(11040): END:DAYLIGHT
    D/davdroid.WebDavResource(11040): BEGIN:STANDARD
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+011932
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+001932
    D/davdroid.WebDavResource(11040): TZNAME:AMT
    D/davdroid.WebDavResource(11040): DTSTART:19161001T004028
    D/davdroid.WebDavResource(11040): RDATE:19161001T004028
    D/davdroid.WebDavResource(11040): RDATE:19170917T034028
    D/davdroid.WebDavResource(11040): RDATE:19180930T034028
    D/davdroid.WebDavResource(11040): RDATE:19190929T034028
    D/davdroid.WebDavResource(11040): RDATE:19200927T034028
    D/davdroid.WebDavResource(11040): RDATE:19210926T034028
    D/davdroid.WebDavResource(11040): RDATE:19221008T034028
    D/davdroid.WebDavResource(11040): RDATE:19231007T034028
    D/davdroid.WebDavResource(11040): RDATE:19241005T034028
    D/davdroid.WebDavResource(11040): RDATE:19251004T034028
    D/davdroid.WebDavResource(11040): RDATE:19261003T034028
    D/davdroid.WebDavResource(11040): RDATE:19271002T034028
    D/davdroid.WebDavResource(11040): RDATE:19281007T034028
    D/davdroid.WebDavResource(11040): RDATE:19291006T034028
    D/davdroid.WebDavResource(11040): RDATE:19301005T034028
    D/davdroid.WebDavResource(11040): RDATE:19311004T034028
    D/davdroid.WebDavResource(11040): RDATE:19321002T034028
    D/davdroid.WebDavResource(11040): RDATE:19331008T034028
    D/davdroid.WebDavResource(11040): RDATE:19341007T034028
    D/davdroid.WebDavResource(11040): RDATE:19351006T034028
    D/davdroid.WebDavResource(11040): RDATE:19361004T034028
    D/davdroid.WebDavResource(11040): END:STANDARD
    D/davdroid.WebDavResource(11040): BEGIN:DAYLIGHT
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+011932
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0120
    D/davdroid.WebDavResource(11040): TZNAME:NEST
    D/davdroid.WebDavResource(11040): DTSTART:19370701T004028
    D/davdroid.WebDavResource(11040): RDATE:19370701T004028
    D/davdroid.WebDavResource(11040): END:DAYLIGHT
    D/davdroid.WebDavResource(11040): BEGIN:STANDARD
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0120
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0020
    D/davdroid.WebDavResource(11040): TZNAME:NET
    D/davdroid.WebDavResource(11040): DTSTART:19371003T034000
    D/davdroid.WebDavResource(11040): RDATE:19371003T034000
    D/davdroid.WebDavResource(11040): RDATE:19381002T034000
    D/davdroid.WebDavResource(11040): RDATE:19391008T034000
    D/davdroid.WebDavResource(11040): END:STANDARD
    D/davdroid.WebDavResource(11040): BEGIN:DAYLIGHT
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0020
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0120
    D/davdroid.WebDavResource(11040): TZNAME:NEST
    D/davdroid.WebDavResource(11040): DTSTART:19380515T014000
    D/davdroid.WebDavResource(11040): RDATE:19380515T014000
    D/davdroid.WebDavResource(11040): RDATE:19390515T014000
    D/davdroid.WebDavResource(11040): END:DAYLIGHT
    D/davdroid.WebDavResource(11040): BEGIN:DAYLIGHT
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0020
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0200
    D/davdroid.WebDavResource(11040): TZNAME:CEST
    D/davdroid.WebDavResource(11040): DTSTART:19400515T230000
    D/davdroid.WebDavResource(11040): RDATE:19400515T230000
    D/davdroid.WebDavResource(11040): END:DAYLIGHT
    D/davdroid.WebDavResource(11040): BEGIN:STANDARD
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0200
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0100
    D/davdroid.WebDavResource(11040): TZNAME:CET
    D/davdroid.WebDavResource(11040): DTSTART:19421102T030000
    D/davdroid.WebDavResource(11040): RDATE:19421102T030000
    D/davdroid.WebDavResource(11040): RDATE:19431004T030000
    D/davdroid.WebDavResource(11040): RDATE:19441002T030000
    D/davdroid.WebDavResource(11040): RDATE:19450916T030000
    D/davdroid.WebDavResource(11040): RDATE:19770925T030000
    D/davdroid.WebDavResource(11040): RDATE:19781001T030000
    D/davdroid.WebDavResource(11040): RDATE:19790930T030000
    D/davdroid.WebDavResource(11040): RDATE:19800928T030000
    D/davdroid.WebDavResource(11040): RDATE:19810927T030000
    D/davdroid.WebDavResource(11040): RDATE:19820926T030000
    D/davdroid.WebDavResource(11040): RDATE:19830925T030000
    D/davdroid.WebDavResource(11040): RDATE:19840930T030000
    D/davdroid.WebDavResource(11040): RDATE:19850929T030000
    D/davdroid.WebDavResource(11040): RDATE:19860928T030000
    D/davdroid.WebDavResource(11040): RDATE:19870927T030000
    D/davdroid.WebDavResource(11040): RDATE:19880925T030000
    D/davdroid.WebDavResource(11040): RDATE:19890924T030000
    D/davdroid.WebDavResource(11040): RDATE:19900930T030000
    D/davdroid.WebDavResource(11040): RDATE:19910929T030000
    D/davdroid.WebDavResource(11040): RDATE:19920927T030000
    D/davdroid.WebDavResource(11040): RDATE:19930926T030000
    D/davdroid.WebDavResource(11040): RDATE:19940925T030000
    D/davdroid.WebDavResource(11040): RDATE:19950924T030000
    D/davdroid.WebDavResource(11040): END:STANDARD
    D/davdroid.WebDavResource(11040): BEGIN:DAYLIGHT
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0100
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0200
    D/davdroid.WebDavResource(11040): TZNAME:CEST
    D/davdroid.WebDavResource(11040): DTSTART:19430329T030000
    D/davdroid.WebDavResource(11040): RDATE:19430329T030000
    D/davdroid.WebDavResource(11040): RDATE:19440403T030000
    D/davdroid.WebDavResource(11040): RDATE:19450402T030000
    D/davdroid.WebDavResource(11040): RDATE:19770403T020000
    D/davdroid.WebDavResource(11040): RDATE:19780402T020000
    D/davdroid.WebDavResource(11040): RDATE:19790401T020000
    D/davdroid.WebDavResource(11040): RDATE:19800406T020000
    D/davdroid.WebDavResource(11040): END:DAYLIGHT
    D/davdroid.WebDavResource(11040): BEGIN:STANDARD
    D/davdroid.WebDavResource(11040): TZOFFSETFROM:+0100
    D/davdroid.WebDavResource(11040): TZOFFSETTO:+0100
    D/davdroid.WebDavResource(11040): TZNAME:CET
    D/davdroid.WebDavResource(11040): DTSTART:19770101T000000
    D/davdroid.WebDavResource(11040): RDATE:19770101T000000
    D/davdroid.WebDavResource(11040): END:STANDARD
    D/davdroid.WebDavResource(11040): END:VTIMEZONE
    D/davdroid.WebDavResource(11040): END:VCALEN
    I/davdroid.SNISocketFactory(11040): No SNI support below Android 4.2!
    I/davdroid.SNISocketFactory(11040): Established TLSv1 connection with mx.clang.name using SSL_RSA_WITH_RC4_128_MD5
    D/davdroid.WebDavResource(11040): Received HTTP/1.1 302 Found
    E/davdroid.DavSyncAdapter(11040): HTTP error
    E/davdroid.DavSyncAdapter(11040): org.apache.http.HttpException: 302 Found
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.webdav.WebDavResource.checkResponse(WebDavResource.java:380)
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.webdav.WebDavResource.checkResponse(WebDavResource.java:360)
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.webdav.WebDavResource.put(WebDavResource.java:342)
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.resource.RemoteCollection.update(RemoteCollection.java:156)
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.syncadapter.SyncManager.pushDirty(SyncManager.java:155)
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.syncadapter.SyncManager.synchronize(SyncManager.java:48)
    E/davdroid.DavSyncAdapter(11040): 	at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:71)
    E/davdroid.DavSyncAdapter(11040): 	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)
    

    The server side (Zimbra 8.0.6) says:

    2014-01-18 15:12:29,824 INFO  [qtp514441508-10001:https://2001:4d88:1017:67a6:5054:ff:fe0f:b1ea:443/dav/cl%40clang.name/Anna/20140118T125454Z-11040_1d3fefc92893b72c.ics] [aname=cl@clang.name;ip=2a01:198:589:0:bdf4:684c:5d81:b8a0;ua=DAVdroid/0.5.6-alpha;] FileUploadServlet - saveUpload(): received Upload: { accountId=8f748f84-b611-47f1-a061-41e7658754bf, time=Sat Jan 18 15:12:29 CET 2014, size=4055, uploadId=113f8af4-6033-48eb-a727-5f9741544e65:de680930-1490-4288-8ba9-d3ed02fb49d7, name=null, path=null }
    2014-01-18 15:12:29,827 INFO  [qtp514441508-10001:https://2001:4d88:1017:67a6:5054:ff:fe0f:b1ea:443/dav/cl%40clang.name/Anna/20140118T125454Z-11040_1d3fefc92893b72c.ics] [aname=cl@clang.name;ip=2a01:198:589:0:bdf4:684c:5d81:b8a0;ua=DAVdroid/0.5.6-alpha;] dav - sending redirect
    2014-01-18 15:12:29,828 INFO  [qtp514441508-10001:https://2001:4d88:1017:67a6:5054:ff:fe0f:b1ea:443/dav/cl%40clang.name/Anna/20140118T125454Z-11040_1d3fefc92893b72c.ics] [aname=cl@clang.name;ip=2a01:198:589:0:bdf4:684c:5d81:b8a0;ua=DAVdroid/0.5.6-alpha;] dav - sending http error 302 because: wrong url - redirecting to:
    https://mx.clang.name/dav/cl@clang.name/Anna/20140118T125454Z-11040@1d3fefc92893b72c.ics
    

    You can see Zimbra's CalDAV server is redirecting the URL to the same with the inverse replacement of what you do client-side in https://github.com/rfc2822/davdroid/blob/master/src/at/bitfire/davdroid/resource/Event.java#L119. I am aware this might be Zimbra's fault and I've read https://bugzilla.zimbra.com/show_bug.cgi?id=84857. However, I think even if it might violate the relevant standards fixing this client-side would be way faster and easier than trying upstream…

    Of course the best solution to the problem would be to properly handle redirects in webdav.WebDavResource.checkResponse and modify the event's file name accordingly, but unless it causes known problems with other servers, just removing the string replacement in resource.Event.generateName would be enough; Apple Calendar stores the same event using the filename "271D332B-BB33-4B0A-8862-BAF3CD649F9D.ics". Also, while you're at it, shouldn't resource.Event.generateName check for uid == null and call generateUID to prevent possible crashes on misuse, just in case?

    I can provide an account on the Zimbra server, if needed.


  • developer

    DAVdroid handles HTTP redirects now, but I couldn't test it with redirected PUT requests. Can you please test it with the latest version?



  • I don't use DAVdroid anymore, so unfortunately I cannot test. I can provide you with an account on a Zimbra server to test, if that helps, though.


  • developer

    This would help too, yes :)



  • You've got mail :)


  • developer

    @neverpanic Thank you for the test account. I have confirmed that the 302 redirections by Zimbra are now handled and everything seems to work correctly.


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.