summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-08-13 15:10:37 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-08-26 17:20:21 -0300
commit8b95942a2be4a65222b1758f2cb63b9dd86ea69d (patch)
treef9fbf7f1402a168119a61bd8385baff47c641d19 /server/src
parent20966f78951d734f100ed6a6a6feedd15dbe79e7 (diff)
[bug] process put after last BadRequest check
If we check for a BadRequest after calling meth_put we will end up on a scenario where the server replies with an error, but everything got processed.
Diffstat (limited to 'server/src')
-rw-r--r--server/src/leap/soledad/server/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py
index 7a03f6fb..1b795016 100644
--- a/server/src/leap/soledad/server/__init__.py
+++ b/server/src/leap/soledad/server/__init__.py
@@ -238,6 +238,7 @@ class HTTPInvocationByMethodWithBody(
if content_type == 'application/x-soledad-sync-put':
meth_put = self._lookup('%s_put' % method)
meth_end = self._lookup('%s_end' % method)
+ entries = []
while True:
line = body_getline()
entry = line.strip()
@@ -246,9 +247,11 @@ class HTTPInvocationByMethodWithBody(
if not entry or not comma: # empty or no prec comma
raise http_app.BadRequest
entry, comma = utils.check_and_strip_comma(entry)
- meth_put({}, entry)
+ entries.append(entry)
if comma or body_getline(): # extra comma or data
raise http_app.BadRequest
+ for entry in entries:
+ meth_put({}, entry)
return meth_end()
# handle outgoing documents
elif content_type == 'application/x-soledad-sync-get':