Page 1 of 1

curl gives me all the data, Rev only the last part. Why?

Posted: Wed Jul 28, 2010 5:17 pm
by dablock
Using Rev Studio 4.0.0 to send a POST to our CalDav calendaring server. When I use curl I get the expected results. But when I use Rev I only get the last part of the data.

Here's an example. I want to see if Martin, Jenny, & Jim are busy. So I query our server with curl & get this correct reply:
<?xml version="1.0" encoding="UTF-8"?><C:schedule-response xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:"><C:response><C:recipient><D:href>mailto:martin@our-company.com</D:href></C:recipient><C:request-status>2.0;Success</C:request-status><C:calendar-data>BEGIN:VCALENDAR
PRODID:-//Kerio Technologies//Kerio Connect//EN
METHOD:PUBLISH
VERSION:2.0
X-VERSION-KMS:6.2.0
BEGIN:VFREEBUSY
DTSTAMP:20100728T154528Z
ORGANIZER:mailto:joe@our-company.com
DTSTART:20100727T070000Z
DTEND:20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T130000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T130000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T140000Z/20100727T150000Z
FREEBUSY;FBTYPE=BUSY:20100727T140000Z/20100727T150000Z
ATTENDEE;PARTSTAT=ACCEPTED;CN=martin@our-company.com;CUTYPE=INDIVIDUAL:mailto:martin@our-company.com
END:VFREEBUSY
END:VCALENDAR
</C:calendar-data></C:response><C:response><C:recipient><D:href>mailto:jenny@our-company.com</D:href></C:recipient><C:request-status>2.0;Success</C:request-status><C:calendar-data>BEGIN:VCALENDAR
PRODID:-//Kerio Technologies//Kerio Connect//EN
METHOD:PUBLISH
VERSION:2.0
X-VERSION-KMS:6.2.0
BEGIN:VFREEBUSY
DTSTAMP:20100728T154528Z
ORGANIZER:mailto:joe@our-company.com
DTSTART:20100727T070000Z
DTEND:20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T130000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T140000Z/20100727T150000Z
ATTENDEE;PARTSTAT=ACCEPTED;CN=jenny@our-company.com;CUTYPE=INDIVIDUAL:mailto:jenny@our-company.com
END:VFREEBUSY
END:VCALENDAR
</C:calendar-data></C:response><C:response><C:recipient><D:href>mailto:jim@our-company.com</D:href></C:recipient><C:request-status>2.0;Success</C:request-status><C:calendar-data>BEGIN:VCALENDAR
PRODID:-//Kerio Technologies//Kerio Connect//EN
METHOD:PUBLISH
VERSION:2.0
X-VERSION-KMS:6.2.0
BEGIN:VFREEBUSY
DTSTAMP:20100728T154528Z
ORGANIZER:mailto:joe@our-company.com
DTSTART:20100727T070000Z
DTEND:20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T130000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T150000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T150000Z/20100727T160000Z
ATTENDEE;PARTSTAT=ACCEPTED;CN=jim@our-company.com;CUTYPE=INDIVIDUAL:mailto:jim@our-company.com
END:VFREEBUSY
END:VCALENDAR
</C:calendar-data></C:response></C:schedule-response>
So I do the same thing with Rev but only get the last person, Jim:
<?xml version="1.0" encoding="UTF-8"?><C:schedule-response xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:"><C:response><C:recipient><D:href>mailto:jim@our-company.com</D:href></C:recipient><C:request-status>2.0;Success</C:request-status><C:calendar-data>BEGIN:VCALENDAR
PRODID:-//Kerio Technologies//Kerio Connect//EN
METHOD:PUBLISH
VERSION:2.0
X-VERSION-KMS:6.2.0
BEGIN:VFREEBUSY
DTSTAMP:20100728T160158Z
ORGANIZER:mailto:ed@our-company.com
DTSTART:20100727T070000Z
DTEND:20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T130000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T150000Z/20100727T160000Z
FREEBUSY;FBTYPE=BUSY:20100727T150000Z/20100727T160000Z
ATTENDEE;PARTSTAT=ACCEPTED;CN=jim@our-company.com;CUTYPE=INDIVIDUAL:mailto:jim@our-company.com
END:VFREEBUSY
END:VCALENDAR
</C:calendar-data></C:response></C:schedule-response>
The code is pretty simple.

Code: Select all

on mouseUp
   set the httpHeaders to "User-Agent: DAVKit/3.0.6 (661);" & return & "Recipient: mailto:martin@our-company.com" & return & "Recipient: mailto:jenny@our-company.com" & return & "Recipient: mailto:jim@our-company.com" & return & "Content-Type: text/calendar" & return &  "Originator: mailto:ed@our-company.com" 
   put "http://mail.our-company.com/calendars/" into tUrl
   put "BEGIN:VCALENDAR" & return & "PRODID:-//Apple Inc.//iCal 3.0//EN" & return & "CALSCALE:GREGORIAN" & return & "VERSION:2.0" & return & "METHOD:REQUEST" & return & "BEGIN:VFREEBUSY" & return & "DTSTART:20100727T070000Z" & return & "DTEND:20100727T160000Z" & return & "END:VFREEBUSY" & return & "END:VCALENDAR" into tData
   post tData to tUrl
   put it into fld 1
   set the httpHeaders to empty
end mouseUp
A tcpdump shows the response from the CalDAV server is continuous, so I'm confused why Rev is only giving me the last part of the request. It's almost like some Rev XML library is grabbing the data & putting it into an array or something. Anyone have any clue what's going on here?

As always, TIA!!!

Re: curl gives me all the data, Rev only the last part. Why?

Posted: Wed Jul 28, 2010 9:00 pm
by dablock
OK, this appears to be a problem with the headers. tcpdump shows me that only the last "Recipient" header is being sent. Instead of sending multiple "Recipient" headers (which is what I want), I guess Rev is overwriting the Recipient header each time & ultimately sending only the last one. For example, I want:
Recipient: mailto:martin@our-company.com
Recipient: mailto:jenny@our-company.com
Recipient: mailto:jim@our-company.com
but instead I'm only getting:
Recipient: mailto:jim@our-company.com
Can I send multiple same-named headers, or am I misdiagnosing the problem?

TIA!!!

Re: curl gives me all the data, Rev only the last part. Why?

Posted: Wed Jul 28, 2010 9:10 pm
by dablock
Being the http header genius that I obviously am not, I can simply combine each value into one header like:

Code: Select all

on mouseUp
   set the httpHeaders to "User-Agent: DAVKit/3.0.6 (661);" & return & "Recipient: mailto:jim@our-company.com mailto:jenny@our-company.com mailto:martin@our-company.com"  & return & "Content-Type: text/calendar" & return &  "Originator: mailto:ed@our-company.com" 
   put "http://mail.our-company.com/calendars/" into tUrl
   put "BEGIN:VCALENDAR" & return & "PRODID:-//Apple Inc.//iCal 3.0//EN" & return & "CALSCALE:GREGORIAN" & return & "VERSION:2.0" & return & "METHOD:REQUEST" & return & "BEGIN:VFREEBUSY" & return & "DTSTART:20100727T070000Z" & return & "DTEND:20100727T160000Z" & return & "END:VFREEBUSY" & return & "END:VCALENDAR" into tData
   post tData to tUrl
   put it into fld 1
   set the httpHeaders to empty
end mouseUp
D'oh!

Re: curl gives me all the data, Rev only the last part. Why?

Posted: Thu Jul 29, 2010 6:18 am
by Curry
Good work.

Re: curl gives me all the data, Rev only the last part. Why?

Posted: Thu Jul 29, 2010 3:43 pm
by FourthWorld
Yes indeed: excellent diagnostics, and a very interesting use of post. I hadn't considered iCal integration before, but now you've inspired me to explore it. I wonder what could be done with Thunderbird's new Lightning calendar add-on. Hmm.....fun opportunities to ponder....

Re: curl gives me all the data, Rev only the last part. Why?

Posted: Fri Jul 30, 2010 2:13 pm
by dablock
Wow, I sometimes forget how great & friendly the Rev community is. In most other forums I would see posts about what an idiot I am, but not here. The Rev community is a huge asset.

And Richard, based on the terrific apps you've built, I'm eagerly awaiting to see what you come up with.

Thanks, all.