diff options
author | Vincent Petry <PVince81@yahoo.fr> | 2021-01-04 15:21:53 +0100 |
---|---|---|
committer | Vincent Petry <PVince81@yahoo.fr> | 2021-01-04 21:49:38 +0100 |
commit | b7d0001390766127cb51b7e12b5765cfc04ed807 (patch) | |
tree | 0bce48bb3f3f42a58328985080e3211776f27cf0 /src/storage | |
parent | 687788e4d30bf36dd93c39d72335f331f49f0745 (diff) |
Fix parsing propstat blocks
There can be more than one propstat block each with their own status
code. We're only interested in the one with the 200 status, the found
properties.
This fixes parsing to make sure we process all propstat blocks instead
of just the last one, which might have a 404 status for not-found
properties.
Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/plugins/CurlStorage.cxx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx index ad6f71fce..c986a8a49 100644 --- a/src/storage/plugins/CurlStorage.cxx +++ b/src/storage/plugins/CurlStorage.cxx @@ -243,6 +243,7 @@ class PropfindOperation : BlockingHttpRequest, CommonExpatParser { enum class State { ROOT, RESPONSE, + PROPSTAT, HREF, STATUS, TYPE, @@ -322,9 +323,13 @@ private: break; case State::RESPONSE: - if (strcmp(name, "DAV:|href") == 0) + if (strcmp(name, "DAV:|propstat") == 0) + state = State::PROPSTAT; + else if (strcmp(name, "DAV:|href") == 0) state = State::HREF; - else if (strcmp(name, "DAV:|status") == 0) + break; + case State::PROPSTAT: + if (strcmp(name, "DAV:|status") == 0) state = State::STATUS; else if (strcmp(name, "DAV:|resourcetype") == 0) state = State::TYPE; @@ -354,9 +359,15 @@ private: case State::RESPONSE: if (strcmp(name, "DAV:|response") == 0) { - FinishResponse(); state = State::ROOT; } + break; + + case State::PROPSTAT: + if (strcmp(name, "DAV:|propstat") == 0) { + FinishResponse(); + state = State::RESPONSE; + } break; @@ -367,22 +378,22 @@ private: case State::STATUS: if (strcmp(name, "DAV:|status") == 0) - state = State::RESPONSE; + state = State::PROPSTAT; break; case State::TYPE: if (strcmp(name, "DAV:|resourcetype") == 0) - state = State::RESPONSE; + state = State::PROPSTAT; break; case State::MTIME: if (strcmp(name, "DAV:|getlastmodified") == 0) - state = State::RESPONSE; + state = State::PROPSTAT; break; case State::LENGTH: if (strcmp(name, "DAV:|getcontentlength") == 0) - state = State::RESPONSE; + state = State::PROPSTAT; break; } } @@ -390,6 +401,7 @@ private: void CharacterData(const XML_Char *s, int len) final { switch (state) { case State::ROOT: + case State::PROPSTAT: case State::RESPONSE: case State::TYPE: break; |