When doing the first propfindProp, if we get a 404, it might mean that the username was wrong, so the server gave us a not found error. It's better to let the user know that, because we don't have a clear heuristic to determin whether this might have been a true 404 error.
See also: https://bugs.meego.com/show_bug.cgi?id=17862 --- src/backends/webdav/WebDAVSource.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/backends/webdav/WebDAVSource.cpp b/src/backends/webdav/WebDAVSource.cpp index 816eba8..b409b71 100644 --- a/src/backends/webdav/WebDAVSource.cpp +++ b/src/backends/webdav/WebDAVSource.cpp @@ -551,6 +551,17 @@ void WebDAVSource::contactServer() } else { candidates.push_front(next.m_path); } + } catch (const TransportStatusException &ex) { + SE_LOG_DEBUG(NULL, NULL, "TransportStatusException: %s", ex.what()); + if (ex.syncMLStatus() == 404) { + // We're actually looking at an authentication error: the path to the calendar has + // not been found, so the username was wrong. Let's hijack the error message and + // code of the exception by throwing a new one. + string descr = StringPrintf("Path not found: %s. Is the username '%s' correct?", + path.c_str(), username.c_str()); + int code = 401; + SE_THROW_EXCEPTION_STATUS(TransportStatusException, descr, SyncMLStatus(code)); + } } catch (const Exception &ex) { if (candidates.empty()) { // nothing left to try, bail out with this error -- 1.7.4.1 _______________________________________________ SyncEvolution mailing list [email protected] http://lists.syncevolution.org/listinfo/syncevolution
