[CalendarServer-changes] [15152] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 24 18:56:49 PDT 2015


Revision: 15152
          http://trac.calendarserver.org//changeset/15152
Author:   cdaboo at apple.com
Date:     2015-09-24 18:56:49 -0700 (Thu, 24 Sep 2015)
Log Message:
-----------
Make sure that POST on a non-existent resource results in a 404 error.

Modified Paths:
--------------
    CalendarServer/trunk/requirements-dev.txt
    CalendarServer/trunk/twistedcaldav/method/post.py

Modified: CalendarServer/trunk/requirements-dev.txt
===================================================================
--- CalendarServer/trunk/requirements-dev.txt	2015-09-25 01:54:57 UTC (rev 15151)
+++ CalendarServer/trunk/requirements-dev.txt	2015-09-25 01:56:49 UTC (rev 15152)
@@ -8,4 +8,4 @@
 q
 tl.eggdeps
 --editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@14856#egg=CalDAVClientLibrary
---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@15138#egg=CalDAVTester
+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@15151#egg=CalDAVTester

Modified: CalendarServer/trunk/twistedcaldav/method/post.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/post.py	2015-09-25 01:54:57 UTC (rev 15151)
+++ CalendarServer/trunk/twistedcaldav/method/post.py	2015-09-25 01:56:49 UTC (rev 15152)
@@ -22,14 +22,24 @@
 __all__ = ["http_POST"]
 
 from txweb2 import responsecode
+from txweb2.http import HTTPError
 
+from twext.python.log import Logger
+
 from twisted.internet.defer import inlineCallbacks, returnValue
 
 from twistedcaldav.config import config
 
+log = Logger()
+
 @inlineCallbacks
 def http_POST(self, request):
 
+    # POST can only target an existing resource
+    if not self.exists():
+        log.error("Resource not found: %s" % (self,))
+        raise HTTPError(responsecode.NOT_FOUND)
+
     # POST can support many different APIs
 
     # First look at query params
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150924/60da881e/attachment.html>


More information about the calendarserver-changes mailing list