Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
.well-known uri support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrusdaboo committed Apr 9, 2010
1 parent e461870 commit 9581d3e
Show file tree
Hide file tree
Showing 5 changed files with 554 additions and 448 deletions.
19 changes: 19 additions & 0 deletions calendarserver/tap/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from twext.web2.http_headers import Headers
from twext.web2.dav import auth
from twext.web2.auth.basic import BasicCredentialFactory
from twext.web2.resource import RedirectResource
from twext.web2.static import File as FileResource
from twext.python.filepath import CachingFilePath as FilePath

Expand All @@ -45,6 +46,7 @@
from twistedcaldav.directory.wiki import WikiDirectoryService
from twistedcaldav.notify import installNotificationClient
from twistedcaldav.resource import CalDAVResource, AuthenticationWrapper
from twistedcaldav.simpleresource import SimpleResource
from twistedcaldav.static import CalendarHomeProvisioningFile
from twistedcaldav.static import IScheduleInboxFile
from twistedcaldav.static import TimezoneServiceFile
Expand Down Expand Up @@ -320,6 +322,23 @@ def getRootResource(config, resources=None):
root.putChild("principals", principalCollection)
root.putChild("calendars", calendarCollection)

# /.well-known
if config.EnableWellKnown:
log.info("Setting up .well-known collection resource")

wellKnownResource = SimpleResource(
principalCollections=(principalCollection,),
isdir=True,
defaultACL=SimpleResource.allReadACL
)
root.putChild(".well-known", wellKnownResource)
for enabled, wellknown_name in (
(config.EnableCalDAV, "caldav",),
(config.EnableCardDAV, "carddav"),
):
if enabled:
wellKnownResource.putChild(wellknown_name, RedirectResource(path="/"))

for name, info in config.Aliases.iteritems():
if os.path.sep in name or not info.get("path", None):
log.error("Invalid alias: %s" % (name,))
Expand Down
Loading

0 comments on commit 9581d3e

Please sign in to comment.