Commit Graph

1429 Commits

Author SHA1 Message Date
Unrud
a9b89be5c7 Read content after access checks
Unauthorized users can't fill up RAM with crap anymore.
2016-08-08 07:00:24 +02:00
Unrud
f294b1cf17 Add access check to PROPFIND 2016-08-08 06:59:15 +02:00
Unrud
eb15de0c5b Test PUT with whole collection 2016-08-08 06:09:24 +02:00
Unrud
68286faa63 Atomic replacement of whole collection by PUT 2016-08-08 06:08:52 +02:00
Unrud
0675328a02 Replace collection in Collection.create_collection 2016-08-08 06:08:01 +02:00
Unrud
6d85a731e5 Disable syncing to disk for tests
This reduces test time by almost 70%.
2016-08-08 05:30:16 +02:00
Unrud
f5f52582a1 Add option to disable syncing to disk
Disabling syncing increases the risk of data loss when the system crashes or power fails. On the positive it can increase the performance to a great extent.
2016-08-08 05:20:25 +02:00
Unrud
c336e0581e Remove atomicwrites
Unfortunately the library doesn't support disabling of disk syncing, fortunately we only need a small subset of it's functionality which is easy to implement.
2016-08-08 05:02:36 +02:00
Unrud
3c736cade8 Refactor: Move sync_directory into Collection class
This is not used anywhere else.
2016-08-08 04:07:01 +02:00
Guillaume Ayoub
9f2cbb81a3 Merge pull request #466 from Unrud/fixpath
Set correct path for child collections
2016-08-07 18:43:41 +02:00
Guillaume Ayoub
8f05bea8ea Merge pull request #465 from Unrud/patch-29
Always use wrapper to lock collection
2016-08-07 18:42:27 +02:00
Unrud
ce0a2fd01d Test PROPFIND
Regression test for cfa8c7d8b4
2016-08-07 18:08:10 +02:00
Unrud
cfa8c7d8b4 Set correct path for child collections 2016-08-07 17:50:31 +02:00
Unrud
4f37e90e20 Some clients expect collections to end with /
Compatibility with InfCloud/CalDavZAP/CardDavMATE
2016-08-07 17:50:04 +02:00
Unrud
ee5b8facda Always use wrapper to lock collection
Also run the hook after creation of the principal collection.
2016-08-07 17:14:47 +02:00
Guillaume Ayoub
4236077b04 Document _makedirs_synced and remove exist_ok 2016-08-06 14:08:21 +02:00
Guillaume Ayoub
4549d1b2db Merge pull request #462 from Unrud/durabledirs
Durable creation of directories and make sure that the root colleciton exists.
2016-08-06 14:02:41 +02:00
Guillaume Ayoub
a7923008ce Remove unused import 2016-08-06 13:29:07 +02:00
Guillaume Ayoub
0cda9f611d Merge pull request #463 from Unrud/atomicmove
Atomic MOVE
2016-08-06 13:27:38 +02:00
Guillaume Ayoub
071a829af8 Merge pull request #453 from Unrud/delete
Delete atomic and durable
2016-08-06 12:52:38 +02:00
Unrud
5f66d009d6 Atomic MOVE in multifilesystem 2016-08-06 05:09:06 +02:00
Unrud
23582c8208 Expose low level MOVE operation in storage.BaseCollection 2016-08-06 05:09:00 +02:00
Unrud
17ff22cae4 Support replacing in MOVE method 2016-08-06 04:45:44 +02:00
Unrud
89ac2fb397 Remove faulty check
This should have been (to_path.strip("/")+"/").startswith(path.strip("/")+"/").
But it's not required as we don't support moving collections.
2016-08-06 04:44:18 +02:00
Unrud
07dc71fd73 Update comment 2016-08-06 04:07:55 +02:00
Unrud
6c3e59fd11 Make sure that the root collection exists.
Since the collections are not directly in **filesystem_path** anymore,
the folder is not created by ``Collection.acquire_lock``.
2016-08-06 04:07:55 +02:00
Unrud
05a4285f54 Durable creation of intermediate directories 2016-08-06 04:07:50 +02:00
Guillaume Ayoub
9aefc500ec Merge pull request #461 from Unrud/patch-27
Remove old code
2016-08-05 17:48:03 +02:00
Guillaume Ayoub
7703008d8f Merge pull request #460 from Unrud/patch-25
Run hook while storage is still locked
2016-08-05 17:47:38 +02:00
Unrud
bfb7aec7be Test deletion of root collection 2016-08-05 17:40:47 +02:00
Unrud
f4eb143ba8 use tempfile to delete collection 2016-08-05 17:40:47 +02:00
Unrud
5a9d956b49 delete atomic and durable
See #440
2016-08-05 17:40:47 +02:00
Unrud
9dd241a54b Add test for deletion of collection 2016-08-05 17:40:47 +02:00
Unrud
6d77e24028 Remove old code
This was missed while merging #457 and #459.
2016-08-05 17:05:32 +02:00
Unrud
65af0592d3 Run hook while storage is still locked 2016-08-05 16:58:03 +02:00
Guillaume Ayoub
0f6e98a512 Fix setup.py 2016-08-05 16:27:55 +02:00
Guillaume Ayoub
294eb5aa15 Don't install pytest-runner when not needed 2016-08-05 16:22:55 +02:00
Guillaume Ayoub
50438bc2c0 Remove fixed TODOs 2016-08-05 02:57:17 +02:00
Guillaume Ayoub
8682504c6e Strip empty lines from content 2016-08-05 02:25:15 +02:00
Guillaume Ayoub
26e1c9ba89 Fix collection creation with PUT request 2016-08-05 02:24:52 +02:00
Guillaume Ayoub
8ac3ce1a89 Clean many, many things 2016-08-05 02:14:49 +02:00
Guillaume Ayoub
263f31c84b Merge branch 'Unrud-rights' 2016-08-04 23:35:08 +02:00
Guillaume Ayoub
92a0027ae1 Merge branch 'rights' of https://github.com/Unrud/Radicale into Unrud-rights 2016-08-04 23:35:01 +02:00
Guillaume Ayoub
2eaedf448f Merge pull request #457 from Unrud/atomiccreate
Atomic creation of collections and atomic PROPPATCH
2016-08-04 22:55:15 +02:00
Guillaume Ayoub
9ba4a47897 Merge pull request #458 from Unrud/flock
Use flock locks for storage locking
2016-08-04 22:31:22 +02:00
Unrud
8ce6d1af30 Use flock locks for storage locking
These locks are compatible with the command line utility flock,
which comes preinstalled with most Linux distributions.
2016-08-04 06:15:05 +02:00
Unrud
066b5994d1 Improve rights checking and request handlers
* Access rights are checked before the storage is locked and
    collections are loaded.
  * DELETE sends 410 instead of doing nothing or crashing if the target
    doesn't exist.
  * GET always returns 404 if the target doesn't exist.
  * GET doesn't crash if a collection without tag property is requested.
  * MKCOL and MKCALENDAR send 409 if the target already exists.
  * MOVE checks if the target collection of an item actually exists and
    sends 409 otherwise.
  * PUT doesn't crash if a whole collection that doesn't exist yet is
    uploaded and ``content-type`` is ``text/vcard`` or
    ``text/calendar``.
  * PUT distinguishes between simple items and whole collections by the
    following criteria: Target is a collection; Parent exists; Parent
    has the tag property set; Parent contains other items. Before only
    the first two criteria where used, which was very unrelieable. #384
  * PROPPATCH is only allowed on collections and 409 is send otherwise.
  * ``Rights.authorized`` takes a path instead of a collection.
  * ``Collection.discover`` only returns items in ``path``, that
    actually exist. #442
2016-08-04 06:08:08 +02:00
Unrud
ae89082c24 Atomic creation of collections 2016-08-03 15:50:55 +02:00
Unrud
e34d1c46cd Move collections into collection-root folder
This is required for atomic creation and deletion of the "/" collection.
2016-08-03 15:50:38 +02:00
Unrud
bd7641699e Atomic PROPPATCH 2016-08-03 14:45:52 +02:00