Remove /.well-known
I can't think of a sane use-case for this.
This commit is contained in:
		
							
								
								
									
										9
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								config
									
									
									
									
									
								
							@@ -70,15 +70,6 @@
 | 
				
			|||||||
#stock = utf-8
 | 
					#stock = utf-8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[well-known]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Path where /.well-known/caldav/ is redirected
 | 
					 | 
				
			||||||
#caldav = /
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Path where /.well-known/carddav/ is redirected
 | 
					 | 
				
			||||||
#carddav = /
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[auth]
 | 
					[auth]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Authentication method
 | 
					# Authentication method
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,8 +53,6 @@ VERSION = "2.0.0rc0"
 | 
				
			|||||||
# tries to access information they don't have rights to
 | 
					# tries to access information they don't have rights to
 | 
				
			||||||
NOT_ALLOWED = (client.FORBIDDEN, {}, None)
 | 
					NOT_ALLOWED = (client.FORBIDDEN, {}, None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WELL_KNOWN_RE = re.compile(r"/\.well-known/(carddav|caldav)/?$")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class HTTPServer(wsgiref.simple_server.WSGIServer):
 | 
					class HTTPServer(wsgiref.simple_server.WSGIServer):
 | 
				
			||||||
    """HTTP server."""
 | 
					    """HTTP server."""
 | 
				
			||||||
@@ -293,23 +291,9 @@ class Application:
 | 
				
			|||||||
            user = environ.get("REMOTE_USER")
 | 
					            user = environ.get("REMOTE_USER")
 | 
				
			||||||
            password = None
 | 
					            password = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        well_known = WELL_KNOWN_RE.match(path)
 | 
					        # If /.well-known is not available, clients query /
 | 
				
			||||||
        if well_known:
 | 
					        if path == "/.well-known" or path.startswith("/.well-known/"):
 | 
				
			||||||
            redirect = self.configuration.get(
 | 
					            return response(client.NOT_FOUND, {})
 | 
				
			||||||
                "well-known", well_known.group(1))
 | 
					 | 
				
			||||||
            try:
 | 
					 | 
				
			||||||
                redirect = redirect % ({"user": user} if user else {})
 | 
					 | 
				
			||||||
            except KeyError:
 | 
					 | 
				
			||||||
                status = client.UNAUTHORIZED
 | 
					 | 
				
			||||||
                realm = self.configuration.get("server", "realm")
 | 
					 | 
				
			||||||
                headers = {"WWW-Authenticate": "Basic realm=\"%s\"" % realm}
 | 
					 | 
				
			||||||
                self.logger.info(
 | 
					 | 
				
			||||||
                    "Refused /.well-known/ redirection to anonymous user")
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                status = client.SEE_OTHER
 | 
					 | 
				
			||||||
                self.logger.info("/.well-known/ redirection to: %s" % redirect)
 | 
					 | 
				
			||||||
                headers = {"Location": redirect}
 | 
					 | 
				
			||||||
            return response(status, headers)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        is_authenticated = self.is_authenticated(user, password)
 | 
					        is_authenticated = self.is_authenticated(user, password)
 | 
				
			||||||
        is_valid_user = is_authenticated or not user
 | 
					        is_valid_user = is_authenticated or not user
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,9 +44,6 @@ INITIAL_CONFIG = {
 | 
				
			|||||||
        "base_prefix": "/",
 | 
					        "base_prefix": "/",
 | 
				
			||||||
        "can_skip_base_prefix": "False",
 | 
					        "can_skip_base_prefix": "False",
 | 
				
			||||||
        "realm": "Radicale - Password Required"},
 | 
					        "realm": "Radicale - Password Required"},
 | 
				
			||||||
    "well-known": {
 | 
					 | 
				
			||||||
         "caldav": "/",
 | 
					 | 
				
			||||||
         "carddav": "/"},
 | 
					 | 
				
			||||||
    "encoding": {
 | 
					    "encoding": {
 | 
				
			||||||
        "request": "utf-8",
 | 
					        "request": "utf-8",
 | 
				
			||||||
        "stock": "utf-8"},
 | 
					        "stock": "utf-8"},
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user