void fill_recursive_propfind_cache(const char *uri, const char *curi) {
    fetch_resource_list_recursive(uri, curi);

    if (propfind_recursive_cache_depth <= 2) {
        DEBUG_WEBDAV("fill_recursive_propfind_cache %s Server maybe did not give us an 'infinity' depth result", curi);
        /* transform the cache to the normal cache in propfind_cache */
        propfind_cache = get_listdir_context_from_recursive_cache(curi);
        /* clear the cache, it is bogus since the server returned only results for Depth 1 */
        clear_propfind_recursive_cache();
    } else {
        DEBUG_WEBDAV("fill_recursive_propfind_cache %s We received %d elements deep for 'infinity' depth (%d folders, %d files)",
                     curi,
                     propfind_recursive_cache_depth,
                     propfind_recursive_cache_folder_count,
                     propfind_recursive_cache_file_count);

    }
}
Exemplo n.º 2
0
/*
 * directory functions
 */
csync_vio_handle_t *owncloud_opendir(const char *uri) {
    struct listdir_context *fetchCtx = NULL;
    char *curi = NULL;

    DEBUG_WEBDAV("opendir method called on %s", uri );

    dav_connect( uri );

    curi = _cleanPath( uri );
    if (is_first_propfind && !dav_session.no_recursive_propfind) {
        is_first_propfind = false;
        // Try to fill it
        fill_recursive_propfind_cache(uri, curi);
    }
    if (propfind_recursive_cache) {
        // Try to fetch from recursive cache (if we have one)
        fetchCtx = get_listdir_context_from_recursive_cache(curi);
    }
    SAFE_FREE(curi);
    is_first_propfind = false;
    if (fetchCtx) {
        return fetchCtx;
    }

    /* fetchCtx = fetch_resource_list( uri, NE_DEPTH_ONE ); */
    fetchCtx = fetch_resource_list_attempts( uri, NE_DEPTH_ONE);
    if( !fetchCtx ) {
        /* errno is set properly in fetch_resource_list */
        DEBUG_WEBDAV("Errno set to %d", errno);
        return NULL;
    } else {
        fetchCtx->currResource = fetchCtx->list;
        DEBUG_WEBDAV("opendir returning handle %p (count=%d)", (void*) fetchCtx, fetchCtx->result_count );
        return fetchCtx;
    }
    /* no freeing of curi because its part of the fetchCtx and gets freed later */
}