Pārlūkot izejas kodu

Add option for building civetweb without timegm().

This disables the caching feature. Civetweb will not be able to detect a
unchanged file.
Christian Mauderer 9 gadi atpakaļ
vecāks
revīzija
c95e1ab2f1
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      src/civetweb.c

+ 6 - 0
src/civetweb.c

@@ -4832,6 +4832,7 @@ get_month_index(const char *s)
 
 
 
 
 /* Parse UTC date-time string, and return the corresponding time_t value. */
 /* Parse UTC date-time string, and return the corresponding time_t value. */
+#if !defined(NO_TIMEGM)
 static time_t
 static time_t
 parse_date_string(const char *datetime)
 parse_date_string(const char *datetime)
 {
 {
@@ -4885,6 +4886,7 @@ parse_date_string(const char *datetime)
 
 
 	return result;
 	return result;
 }
 }
+#endif /* !NO_TIMEGM */
 
 
 
 
 /* Protect against directory disclosure attack by removing '..',
 /* Protect against directory disclosure attack by removing '..',
@@ -6965,6 +6967,7 @@ substitute_index_file(struct mg_connection *conn,
 static int
 static int
 is_not_modified(const struct mg_connection *conn, const struct file *filep)
 is_not_modified(const struct mg_connection *conn, const struct file *filep)
 {
 {
+#if !defined(NO_TIMEGM)
 	char etag[64];
 	char etag[64];
 	const char *ims = mg_get_header(conn, "If-Modified-Since");
 	const char *ims = mg_get_header(conn, "If-Modified-Since");
 	const char *inm = mg_get_header(conn, "If-None-Match");
 	const char *inm = mg_get_header(conn, "If-None-Match");
@@ -6974,6 +6977,9 @@ is_not_modified(const struct mg_connection *conn, const struct file *filep)
 	}
 	}
 	return (inm != NULL && !mg_strcasecmp(etag, inm))
 	return (inm != NULL && !mg_strcasecmp(etag, inm))
 	       || (ims != NULL && (filep->last_modified <= parse_date_string(ims)));
 	       || (ims != NULL && (filep->last_modified <= parse_date_string(ims)));
+#else /* NO_TIMEGM */
+	return false;
+#endif /* !NO_TIMEGM */
 }
 }