sabredav server returns response 400 on request REPORT

219 views
Skip to first unread message

Milos Nikolic

unread,
Nov 17, 2014, 5:08:09 AM11/17/14
to sabredav...@googlegroups.com
Hi chaps/esses .. :)

I've integrated sabredav into my application, and browser module is working just fine. i can authenticate, list, get, download ics files using my custom backends.
now, when I try to add a caldav account in thunderbird, it sais that caldav is not currently available. After looking the wireshark   dump log, I noticed that my caldav server is returning '400 Bad request' with the message 'Empty XML document sent'.
here is the req/res:

 
curl --request REPORT --user user:pass --data "<?xml version="1.0" encoding="UTF-8"?> <C:calendar-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <D:prop> <D:getetag/> <C:calendar-data/> </D:prop> <D:href> /caldav/calendars/104/mis.ics/117-42095.ics </D:href> <D:href> /caldav/calendars/104/mis.ics/117-42068.ics </D:href> <D:href> /caldav/calendars/104/mis.ics/117-42049.ics </D:href> <D:href> /caldav/calendars/104/mis.ics/117-42048.ics </D:href> <D:href> /caldav/calendars/104/mis.ics/117-41998.ics </D:href> </C:calendar-multiget>" http://server/caldav/calendars/104/mis.ics
 
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:sabredav-version>2.0.5</s:sabredav-version>
  <s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
  <s:message>Empty XML document sent</s:message>
</d:error>


 

btw, ics files are returning 200 response and are properly formatted.
thunderbird is first sending propfind request, and get response 207 with this xml:

    <?xml
          version="1.0"
          encoding="utf-8"
          ?>
      <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/">
          <d:response>
              <d:href>
                  /caldav/calendars/104/mis.ics/                                                                                                                                                                                           
                  </d:href>
              <d:propstat>
                  <d:prop>
                      <d:resourcetype>
                          <d:collection/>
                          <cal:calendar/>
                          </d:resourcetype>
                      </d:prop>
                  <d:status>
                      HTTP/1.1 200 OK
                      </d:status>
                  </d:propstat>
            </d:response>                                                                                                                                                                                                                
          <d:response>                                                                                                                                                                                                                     
              <d:href>                                                                                                                                                                                                                     
                  /caldav/calendars/104/mis.ics/117-41998.ics                                                                                                                                                                              
                  </d:href>                                                                                                                                                                                                                
              <d:propstat>                                                                                                                                                                                                                 
                  <d:prop>                                                                                                                                                                                                                 
                      <d:resourcetype/>                                                                                                                                                                                                    
                      <d:getetag>                                                                                                                                                                                                          
                          "f2b8b550d5c37f951879ec6735ebc52b"                                                                                                                                                                               
                          </d:getetag>                                                                                                                                                                                                     
                      <d:getcontenttype>                                                                                                                                                                                                   
                          text/calendar; charset=utf-8; component=vevent                                                                                                                                                                   
                          </d:getcontenttype>                                                                                                                                                                                              
                      </d:prop>                                                                                                                                                                                                            
                  <d:status>                                                                                                                                                                                                               
                      HTTP/1.1 200 OK                                                                                                                                                                                                      
                      </d:status>                                                                                                                                                                                                          
                  </d:propstat>                                                                                                                                                                                                            
              </d:response>                                                                                                                                                                                                                
          <d:response>                                                                                                                                                                                                                     
              <d:href>                                                                                                                                                                                                                     
                  /caldav/calendars/104/mis.ics/117-42048.ics                                                                                                                                                                              
                  </d:href>                                                                                                                                                                                                                
              <d:propstat>                                                                                                                                                                                                                 
                  <d:prop>                                                                                                                                                                                                                 
                      <d:resourcetype/>                                                                                                                                                                                                    
                      <d:getetag>                                                                                                                                                                                                          
                          "858aa993e9f0e809476a8a4b3f886c71"                                                                                                                                                                               
                          </d:getetag>                                                                                                                                                                                                     
                      <d:getcontenttype>                                                                                                                                                                                                   
                          text/calendar; charset=utf-8; component=vevent                                                                                                                                                                   
                          </d:getcontenttype>                                                                                                                                                                                              
                      </d:prop>                                                                                                                                                                                                            
                  <d:status>                                                                                                                                                                                                               
                      HTTP/1.1 200 OK                                                                                                                                                                                                      
                      </d:status>                                                                                                                                                                                                          
                  </d:propstat>                                                                                                                                                                                                            
              </d:response>                                                                                                                                                                                                                
          <d:response>                                                                                                                                                                                                                     
              <d:href>                                                                                                                                                                                                                     
                  /caldav/calendars/104/mis.ics/117-42049.ics                                                                                                                                                                              
                  </d:href>                                                                                                                                                                                                                
              <d:propstat>
                  <d:prop>
                      <d:resourcetype/>                                                                                                                                                                                                    
                      <d:getetag>                                                                                                                                                                                                          
                          "04dccb84c1ea9de69f4e52672550a86d"                                                                                                                                                                               
                          </d:getetag>                                                                                                                                                                                                     
                      <d:getcontenttype>                                                                                                                                                                                                   
                          text/calendar; charset=utf-8; component=vevent                                                                                                                                                                   
                          </d:getcontenttype>
                    </d:prop>
                  <d:status>
                      HTTP/1.1 200 OK                                                                                                                                                                                                      
                      </d:status>
                  </d:propstat>
              </d:response>
          <d:response>
              <d:href>
                  /caldav/calendars/104/mis.ics/117-42068.ics                                                                                                                                                                              
                  </d:href>
              <d:propstat>
                  <d:prop>
                      <d:resourcetype/>                                                                                                                                                                                                    
                      <d:getetag>                                                                                                                                                                                                          
                          "e42860d08d8d757503a4a459875fc8ab"                                                                                                                                                                               
                          </d:getetag>                                                                                                                                                                                                     
                      <d:getcontenttype>
                          text/calendar; charset=utf-8; component=vevent
                          </d:getcontenttype>
                      </d:prop>                                                                                                                                                                                                            
                  <d:status>                                                                                                                                                                                                               
                      HTTP/1.1 200 OK                                                                                                                                                                                                      
                      </d:status>                                                                                                                                                                                                          
                  </d:propstat>                                                                                                                                                                                                            
              </d:response>                                                                                                                                                                                                                
          <d:response>                                                                                                                                                                                                                     
              <d:href>                                                                                                                                                                                                                     
                  /caldav/calendars/104/mis.ics/117-42095.ics                                                                                                                                                                              
                  </d:href>                                                                                                                                                                                                                
              <d:propstat>                                                                                                                                                                                                                 
                  <d:prop>                                                                                                                                                                                                                 
                      <d:resourcetype/>
                      <d:getetag>
                          "bc0761a4864b537ccbafb087a320612e"                                                                                                                                                                               
                          </d:getetag>
                      <d:getcontenttype>                                                                                                                                                                                                   
                          text/calendar; charset=utf-8; component=vevent                                                                                                                                                                   
                          </d:getcontenttype>                                                                                                                                                                                              
                      </d:prop>
                  <d:status>
                      HTTP/1.1 200 OK
                      </d:status>
                  </d:propstat>
              </d:response>
          </d:multistatus>


Does anyone have any idea what method I missed to implement? Any hint or help because i'm little bit lost in finding out what seems to be the problem here?

Evert Pot

unread,
Nov 17, 2014, 5:45:31 PM11/17/14
to sabredav...@googlegroups.com
Hi Milos,




On Monday, November 17, 2014 5:08:09 AM UTC-5, Milos Nikolic wrote:
Hi chaps/esses .. :)

I've integrated sabredav into my application, and browser module is working just fine. i can authenticate, list, get, download ics files using my custom backends.
now, when I try to add a caldav account in thunderbird, it sais that caldav is not currently available. After looking the wireshark   dump log, I noticed that my caldav server is returning '400 Bad request' with the message 'Empty XML document sent'.
here is the req/res:

The most logical reason for this to happen, is if you read the contents of 'php://input', before sabredav has a chance to.
Because this is a stream, we can generally only read this once. If you read the request body, from sabredav's perspective it will seem as if it received an empty request body.

So are you doing something with the request body? Or are you integrating sabredav with some kind of framework that might do that?

Evert

Miloš Nikolić

unread,
Nov 18, 2014, 4:33:49 AM11/18/14
to sabredav...@googlegroups.com
hi evert,

10x a lot. you were right. i'm using Zend I was logging the $server->httpRequest just before $server-exec(). When I commented out that debug log, I got the request body in sabre's backend.
It didn't really cross my mind that zend's log could be the cause.

10x again
Best

--
You received this message because you are subscribed to a topic in the Google Groups "SabreDAV Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sabredav-discuss/oGmVpf02ZqI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sabredav-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sabredav-discuss/c4345d50-3828-4e35-9002-07aba20933f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miloš Nikolić

unread,
Nov 18, 2014, 9:42:55 AM11/18/14
to sabredav...@googlegroups.com
hi evert .. I'm almost there .. now Calendar mac application is giving me trouble
I have successfully imported calendar events in thunderbird. My custom backend is working and formatting response for thunderbird just fine.
But, when I try to import the same events in iCal calendar application in mac os 10.9.5, I get the error that "No calendar home was specified for the account .."
I've read troubleshooting page http://sabre.io/dav/clients/ical/ and I think I got the steps right. 
I enabled the calendar log in console.app in mac and this is the output. And also there is a wireshark dump in attachment for better understanding of what is going on.

11/18/14 3:10:32.629 PM CalendarAgent[307]: [com.apple.calendar.store.log.caldav.queue] [CalDAVAccountRefreshQueueableOperation :: calendar home path is empty, not refreshing calendars]
11/18/14 3:10:32.631 PM CalendarAgent[307]: [com.apple.calendar.store.log.caldav.queue] [Got error on refresh, but not rectifying principal because it was manually configured: Error Domain=CalCalDAVErrorDomain Code=5 "The operation couldn’t be completed. (CalCalDAVErrorDomain error 5.)"]
11/18/14 3:10:32.633 PM CalendarAgent[307]: [com.apple.calendar.store.log.caldav.queue] [Account refresh failed with error: Error Domain=CalCalDAVErrorDomain Code=5 "The operation couldn’t be completed. (CalCalDAVErrorDomain error 5.)" UserInfo=0x7fb07d889630 {AccountName=test@http://test.local/caldav/calendars/104/daily/, CalDAVErrFromRefresh=YES}]
 
It would be great If you have any idea or hint where could be the problem.

Thanks in advance,
Best

calendar.txt

Evert Pot

unread,
Nov 18, 2014, 11:32:24 AM11/18/14
to sabredav...@googlegroups.com


On Tuesday, November 18, 2014 9:42:55 AM UTC-5, Milos Nikolic wrote:
hi evert .. I'm almost there .. now Calendar mac application is giving me trouble
I have successfully imported calendar events in thunderbird. My custom backend is working and formatting response for thunderbird just fine.
But, when I try to import the same events in iCal calendar application in mac os 10.9.5, I get the error that "No calendar home was specified for the account .."
I've read troubleshooting page http://sabre.io/dav/clients/ical/ and I think I got the steps right. 
I enabled the calendar log in console.app in mac and this is the output. And also there is a wireshark dump in attachment for better understanding of what is going on.

I think you're using the wrong url to initialize the account.

iCal needs the principal url, not a calendar url.

Evert

Miloš Nikolić

unread,
Nov 18, 2014, 3:29:34 PM11/18/14
to sabredav...@googlegroups.com
Hi Evert,

Now, i'm embarrassed for posting that question :\
You're right. I switched url from calendar to principals and it works.

Thanks again,
Best

--
You received this message because you are subscribed to a topic in the Google Groups "SabreDAV Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sabredav-discuss/oGmVpf02ZqI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sabredav-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages