gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: add more mime types, handle etag


From: gnunet
Subject: [taler-exchange] branch master updated: add more mime types, handle etag nicely
Date: Mon, 02 Dec 2019 21:41:26 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 6c5d4632 add more mime types, handle etag nicely
6c5d4632 is described below

commit 6c5d46327bc09b1de2c5f1fb41290b7da4aed8d0
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Dec 2 21:41:24 2019 +0100

    add more mime types, handle etag nicely
---
 src/exchange/taler-exchange-httpd_terms.c | 34 +++++++++++++++++++++++++++++--
 src/exchange/taler-exchange-httpd_terms.h |  9 ++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_terms.c 
b/src/exchange/taler-exchange-httpd_terms.c
index dadc1588..8c25e538 100644
--- a/src/exchange/taler-exchange-httpd_terms.c
+++ b/src/exchange/taler-exchange-httpd_terms.c
@@ -311,6 +311,13 @@ load_terms (const char *path,
     const char *mime;
   } mm[] = {
     { .ext = "html", .mime = "text/html" },
+    { .ext = "htm", .mime = "text/html" },
+    { .ext = "txt", .mime = "text/plain" },
+    { .ext = "pdf", .mime = "application/pdf" },
+    { .ext = "jpg", .mime = "image/jpeg" },
+    { .ext = "jpeg", .mime = "image/jpeg" },
+    { .ext = "png", .mime = "image/png" },
+    { .ext = "gif", .mime = "image/gif" },
     { .ext = NULL, .mime = NULL }
   };
   const char *ext = strrchr (name, '.');
@@ -325,6 +332,18 @@ load_terms (const char *path,
                 lang);
     return;
   }
+  if (0 != strncmp (terms_etag,
+                    name,
+                    ext - name - 1))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Filename `%s' does not match Etag `%s' in directory `%s/%s'. 
Ignoring it.\n",
+                name,
+                terms_etag,
+                path,
+                lang);
+    return;
+  }
   mime = NULL;
   for (unsigned int i = 0; NULL != mm[i].ext; i++)
     if (0 == strcasecmp (mm[i].ext,
@@ -476,15 +495,26 @@ TEH_load_terms (const struct GNUNET_CONFIGURATION_Handle 
*cfg)
   char *path;
   DIR *d;
 
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (cfg,
+                                             "exchange",
+                                             "TERMS_ETAG",
+                                             &terms_etag))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+                               "exchange",
+                               "TERMS_ETAG");
+    return;
+  }
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (cfg,
                                                "exchange",
-                                               "terms",
+                                               "TERMS_DIR",
                                                &path))
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
                                "exchange",
-                               "TERMS");
+                               "TERMS_DIR");
 
     return;
   }
diff --git a/src/exchange/taler-exchange-httpd_terms.h 
b/src/exchange/taler-exchange-httpd_terms.h
index 1cfd8239..18a42809 100644
--- a/src/exchange/taler-exchange-httpd_terms.h
+++ b/src/exchange/taler-exchange-httpd_terms.h
@@ -46,4 +46,13 @@ TEH_handler_terms (struct TEH_RequestHandler *rh,
                    const char *upload_data,
                    size_t *upload_data_size);
 
+/**
+ * Load our terms of service as per configuration.
+ *
+ * @param cfg configuration to process
+ */
+void
+TEH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
+
 #endif

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]