diff -Npru davfs2-1.4.6.orig/src/cache.c davfs2-1.4.6/src/cache.c
--- davfs2-1.4.6.orig/src/cache.c	2009-11-15 11:15:17.000000000 +0100
+++ davfs2-1.4.6/src/cache.c	2011-12-14 15:30:21.000000000 +0100
@@ -133,10 +133,13 @@ static const char* const type[] = {
 /* File system statistics. */
 static dav_stat *fs_stat;
 
+/* Try to retrieve quota information. */
+static int use_quota = 1;
+
 /* Root node of the directory cache. */
 static dav_node *root;
 
-/* Directory for local buckups. */
+/* Directory for local backups. */
 static dav_node *backup;
 
 /* A hash table to store the nodes. The hash is computed from the pointer
@@ -157,7 +160,7 @@ static dav_node_list_item *changed;
 static time_t dir_refresh;
 
 /* Wait that many seconds from last file access before doing a new
-   GET If-Modiefied request. */
+   GET If-Modified request. */
 static time_t file_refresh;
 
 /* Upload file that many seconds after closing. */
@@ -1550,16 +1553,27 @@ dav_statfs(void)
     if (time(NULL) > (fs_stat->utime + retry)) {
         off64_t total = 0;
         off64_t used = 0;
-        if (dav_quota(root->path, &total, &used) == 0) {
-            fs_stat->blocks = total / fs_stat->bsize;
-            fs_stat->bfree = fs_stat->blocks - (used / fs_stat->bsize) - 1;
-            fs_stat->bavail = fs_stat->bfree;
-            fs_stat->ffree = fs_stat->bfree;
-            fs_stat->utime = time(NULL);
+        
+        if (use_quota) {
+            int ret = dav_quota(root->path, &total, &used);
+
+            if (ret == EINVAL) {
+                use_quota = 0;
+            } else if (ret == 0) {
+                fs_stat->blocks = total / fs_stat->bsize;
+                fs_stat->bfree = fs_stat->blocks - (used / fs_stat->bsize) - 1;
+                fs_stat->bavail = fs_stat->bfree;
+                fs_stat->ffree = fs_stat->bfree;
+            }
+            
         }
+
+        fs_stat->utime = time(NULL);
+        
     }
 
     return fs_stat;
+    
 }
 
 
diff -Npru davfs2-1.4.6.orig/src/dav_fuse.c davfs2-1.4.6/src/dav_fuse.c
--- davfs2-1.4.6.orig/src/dav_fuse.c	2010-02-16 20:29:49.000000000 +0100
+++ davfs2-1.4.6/src/dav_fuse.c	2011-12-13 21:19:16.000000000 +0100
@@ -977,8 +977,9 @@ fuse_stat(void)
         syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_STATFS:");
 
     dav_stat *st = dav_statfs();
+    
     if (!st) {
-        oh->error = -EIO;
+        oh->error = -ENOSYS;
         return sizeof(struct fuse_out_header);
     }
 
diff -Npru davfs2-1.4.6.orig/src/webdav.c davfs2-1.4.6/src/webdav.c
--- davfs2-1.4.6.orig/src/webdav.c	2010-02-16 20:29:59.000000000 +0100
+++ davfs2-1.4.6/src/webdav.c	2011-12-14 15:50:09.000000000 +0100
@@ -221,11 +221,8 @@ static FILE *log_stream;
 /* A user defined header that is added to all requests. */
 char *custom_header;
 
-#if NE_VERSION_MINOR > 25
 /* Session cookie. */
-static char *cookie;
-#endif
-
+static char *cookie_hdr;
 
 /* Private function prototypes and inline functions */
 /*==================================================*/
@@ -300,10 +297,33 @@ quota_reader(void *userdata, const char 
 static int
 ssl_verify(void *userdata, int failures, const ne_ssl_certificate *cert);
 
-#if NE_VERSION_MINOR > 25
+static void
+cookie_out(ne_request *req, void *userdata, ne_buffer *header){
+	if(NULL != cookie_hdr){
+		ne_buffer_zappend(header, cookie_hdr);
+	}
+}
+
 static int
-update_cookie(ne_request *req, void *userdata, const ne_status *status);
-#endif /* NE_VERSION_MINOR > 25 */
+cookie_in(ne_request *req, void *userdata, const ne_status *status){
+	const char* value = ne_get_response_header(req, "Set-Cookie");
+	if(value != NULL){
+		if(cookie_hdr != NULL){
+			ne_free(cookie_hdr);
+		}
+		char* sep = strchr(value, ';');
+		char* clean;
+		if(sep == NULL){
+			clean = ne_strdup(value);
+		}else{
+			clean = ne_strndup(value, sep-value);
+		}
+		cookie_hdr = ne_concat("Cookie: ", clean, "\r\n", NULL);
+		ne_free(clean);
+	}
+
+	return NE_OK;
+}
 
 
 /* Public functions */
@@ -359,6 +379,11 @@ dav_init_webdav(const dav_args *args)
     }
 
     session = ne_session_create(args->scheme, args->host, args->port);
+    
+    if(args->allow_cookie){
+	ne_hook_pre_send(session, cookie_out, NULL);
+	ne_hook_post_send(session, cookie_in, NULL);
+    }
 
     ne_set_read_timeout(session, args->read_timeout);
 
@@ -464,11 +489,6 @@ dav_init_webdav(const dav_args *args)
         ne_hook_pre_send(session, add_header, custom_header);
     }
 
-#if NE_VERSION_MINOR > 25
-    if (args->allow_cookie)
-        ne_hook_post_send(session, update_cookie, NULL);
-#endif /* NE_VERSION_MINOR > 25 */
-
     use_expect100 = args->expect100;
     has_if_match_bug = args->if_match_bug;
     drop_weak_etags = args->drop_weak_etags;
@@ -1129,38 +1149,53 @@ dav_quota(const char *path, off64_t *tot
         ne_propfind_handler *ph = ne_propfind_create(session, spath,
                                                      NE_DEPTH_ZERO);
         ret = ne_propfind_named(ph, quota_names, quota_result, &ctx);
-        ret = get_error(ret, "PROPFIND");
-        ne_propfind_destroy(ph);
-
-        if (!ret && ctx.error) {
-            ret = EIO;
-            if (ctx.error == 2)
-                use_rfc = 0;
+        
+        if (!ret) {
+            ret = get_error(ret, "PROPFIND");
+            if (!ret && ctx.error) {
+                ret = EIO;
+                if (ctx.error == 2)
+                    use_rfc = 0;
+            }
+            
+        } else {
+            use_rfc = 0;
         }
+        
+        ne_propfind_destroy(ph);
+        
     }
 
     if (ret && use_userinfo) {
         ctx.error = 0;
-        ne_request *req = ne_request_create(session, "USERINFO", spath);
-        ne_add_response_body_reader(req, ne_accept_2xx, quota_reader, &ctx);
-        ret = ne_request_dispatch(req);
-        ret = get_error(ret, "USERINFO");
-        ne_request_destroy(req);
+        ne_request *req = ne_request_create(session, "USERINFO", spath);
+        ne_add_response_body_reader(req, ne_accept_2xx, quota_reader, &ctx);
+        ret = ne_request_dispatch(req);
+        ret = get_error(ret, "USERINFO");
 
         if (!ret) {
             if (ctx.error)
                 ret = EIO;
-        } else if (ret == EINVAL) {
-            use_userinfo = 0;
+        } else {
+            if (ne_get_status(req)->klass == 3) {
+                use_userinfo = 0;
+            }
         }
+        ne_request_destroy(req);
+        
     }
 
+    if (!use_rfc && !use_userinfo) {
+        ret = EINVAL;
+    }
+    
     if (!ret) {
         *total = ctx.total;
         *used = ctx.used;
     }
 
     free(spath);
+    
     return ret;
 }
 
@@ -1997,44 +2032,3 @@ ssl_verify(void *userdata, int failures,
     if (digest) free(digest);
     return ret;
 }
-
-
-#if NE_VERSION_MINOR > 25
-static int
-update_cookie(ne_request *req, void *userdata, const ne_status *status)
-{
-    if (status->klass != 2)
-        return NE_OK;
-
-    const char *cookie_hdr = ne_get_response_header(req, "Set-Cookie2");
-    if (!cookie_hdr) {
-        cookie_hdr = ne_get_response_header(req, "Set-Cookie");
-    }
-    if (!cookie_hdr)
-        return NE_OK;
-
-    if (cookie && strstr(cookie_hdr, cookie) == cookie_hdr)
-        return NE_OK;
-
-    char *sep = strpbrk(cookie_hdr, "\",; \n\r\0");
-    if (!sep)
-        return NE_OK;
-    if (*sep == '\"')
-        sep = strpbrk(sep + 1, "\"");
-    if (!sep)
-        return NE_OK;
-
-    if (cookie) {
-        ne_unhook_pre_send(session, add_header, cookie);
-        free(cookie);
-        cookie = NULL;
-    }
-
-    char *value = ne_strndup(cookie_hdr, sep - cookie_hdr + 1);
-    cookie = ne_concat("Cookie: $Version=1;", value, "\r\n", NULL);
-    free(value);
-
-    ne_hook_pre_send(session, add_header, cookie);
-    return NE_OK;
-}
-#endif /* NE_VERSION_MINOR > 25 */
