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>
This commit is contained in:
parent
687788e4d3
commit
b7d0001390
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user