Closed Bug 311268 Opened 15 years ago Closed 14 years ago
DAV provider should improve URL handling
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b4) Gecko/20050908 Firefox/1.4 When adding a remote calendar, I specified: http://myhost/zidestore/dav/helge/Calendar/ as the Calendar collection URL. This results in CalDAV REPORT requests like this: ---snip--- REPORT /zidestore/dav/helge/Calendar// HTTP/1.1 ... ---snap--- notice the double-slash at the end. I would like to suggest to improve the URL processing methods. Reproducible: Always Steps to Reproduce: 1. bring up the "subscribe a remote calendar" panel 2. enter a collection URL with a trailing slash Actual Results: an HTTP request with two-slashes at the end of the URL REPORT /zidestore/dav/helge/Calendar// HTTP/1.1 Expected Results: an HTTP request with a single slash at the end of the URL REPORT /zidestore/dav/helge/Calendar/ HTTP/1.1 Don't know what the specification says about //, but avoiding such stuff is probably a good idea, especially to have normalized URLs on the client (eg for caches).
Checks for trailing slash at the end of caldav urls, prior to actually adding one.
Assignee: dmose → jminta
Status: UNCONFIRMED → ASSIGNED
Attachment #216944 - Flags: first-review?(dmose)
Comment on attachment 216944 [details] [diff] [review] check for trailing slash first This wants to use charAt, substring or substr instead of manually traversing the string.
Attachment #216944 - Flags: first-review?(dmose) → first-review-
Why do we want/need this? A double slash is valid in an url, afaik.
Even if/though double slashes are valid in a url, this patch does not preclude their use. It merely lets a user entering a URI for a caldav calendar collection (usually) not worry about whether or not she needs a trailing slash, by adding a trailing slash iff the URI doesn't have one. In the hypothetical edge case where the server wants a double slash after the host:port section of the URI, the user can still enter the URI with two trailing slashes.
Now using charAt(). This patch still allows double-slashes, if the user entered it, but will never create a double-slash on its own. That *seems* to be the right behavior here.
Comment on attachment 218417 [details] [diff] [review] check for trailing slash first v2 Sounds like reasonable behavior to me. r=dmose
Attachment #218417 - Flags: first-review?(dmose) → first-review+
Patch checked in.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.