monkeyfdude / caldav4j

Automatically exported from code.google.com/p/caldav4j
0 stars 0 forks source link

Use a trailing '/' when referencing collection resources #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run CalDAVCalendarCollectionsTest against an Apple CalendarServer

What is the expected output? What do you see instead?

Expected: a succeeding test

Seen: calendar = calendarCollection.getCalendarForEventUID(httpClient,
ICS_GOOGLE_DAILY_NY_5PM_UID); throws an exception because it can't find the
resource.

CalendarServer logging: REPORT /calendars/users/raboof/caldav4j HTTP/1.1

This request, afaics, is requesting a list of children of the collection
that match certain criteria. CalendarServer, however, returns a HTTP 301
Moved Permanently to '/calendars/users/raboof/caldav4j/', adding a trailing
'/'.

The fact that caldav4j is not following the 301 is actually the desirable
behaviour: http://www.ietf.org/rfc/rfc2616.txt 10.3.2 (HTTP) says about
this: "If the 301 status code is received in response to a request other
than GET or HEAD, the user agent MUST NOT automatically redirect the
request unless it can be confirmed by the user, since this might change the
conditions under which the request was issued.".

caldav4j should have sent the request with a trailing '/' in the first
place, according to http://www.ietf.org/rfc/rfc2518.txt: "There is a
standing convention that when a collection is referred to by its name
without a trailing slash, the trailing slash is automatically appended. 
Due to this, a resource may accept a URI without a trailing "/" to point to
a collection. In this case it SHOULD return a content-location header in
the response pointing to the URI ending with the "/".  For example, if a
client invokes a method on http://foo.bar/blah (no trailing slash), the
resource http://foo.bar/blah/ (trailing slash) may respond as if the
operation were invoked on it, and should return a content-location header
with http://foo.bar/blah/ in it.  In general clients SHOULD use the "/"
form of collection names."

The fact that calendarserver doesn't follow this 'standing convention', and
caldav4j SHOULD use '/' anyway.

The calendarCollectionRoot property of CalDAVCalendarCollectionBase holds
the root without trailing '/', and in several places a '/' is append to it
when used. Either the other places not yet appending a '/' should be
reviewed, or calendarCollectionRoot should be documented to contain the
trailing '/' and any extra appended slashes should be removed.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by arnout.engelen on 26 Mar 2009 at 1:53

GoogleCodeExporter commented 9 years ago
Thx for your reference. As google calendar has some issues with double "//" in 
path,
there are methods to remove "//" and maybe some trailing "/" could be affected.

I'll check it!

Original comment by robipo...@gmail.com on 7 Apr 2009 at 6:12

GoogleCodeExporter commented 9 years ago
added trailing slash to collection in test case. pls check if it works for you

Original comment by robipo...@gmail.com on 15 May 2009 at 4:31