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