932e0c
diff --git a/src/Http.cc b/src/Http.cc
932e0c
index 5364c94..0018670 100644
932e0c
--- a/src/Http.cc
932e0c
+++ b/src/Http.cc
932e0c
@@ -26,6 +26,7 @@
932e0c
 #include <errno.h>
932e0c
 #include <stdarg.h>
932e0c
 #include <time.h>
932e0c
+#include <limits.h>
932e0c
 #include <fnmatch.h>
932e0c
 #include <locale.h>
932e0c
 #include <assert.h>
932e0c
diff --git a/src/Http.cc b/src/Http.cc
932e0c
index b84a729..faf0cc5 100644
932e0c
--- a/src/Http.cc
932e0c
+++ b/src/Http.cc
932e0c
@@ -786,9 +786,11 @@ void Http::SendRequest(const char *connection,const char *f)
932e0c
 		     (long long)((limit==FILE_END || limit>entity_size ? entity_size : limit)-1),
932e0c
 		     (long long)entity_size);
932e0c
       }
932e0c
-      if(entity_date!=NO_DATE)
932e0c
+      if((entity_date!=NO_DATE) && (entity_date>0L && entity_date
932e0c
       {
932e0c
-	 Send("Last-Modified: %s\r\n",FormatLastModified(entity_date).get());
932e0c
+	 char d[256];
932e0c
+	 strftime(d, sizeof(d), "%a, %d %b %H:%M:%S %Y GMT", gmtime(&entity_date));
932e0c
+	 Send("Last-Modified: %s\r\n",d);
932e0c
 	 Send("X-OC-MTime: %ld\r\n",(long)entity_date);	 // for OwnCloud
932e0c
       }
932e0c
       break;