about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--NEWS6
-rw-r--r--doc/index.html4
-rw-r--r--doc/tipidee.conf.html2
-rw-r--r--doc/upgrade.html7
-rw-r--r--package/info2
-rw-r--r--src/config/lexparse.c23
-rw-r--r--src/libtipidee/tipidee_conf_get_content_type.c5
8 files changed, 36 insertions, 15 deletions
diff --git a/INSTALL b/INSTALL
index 878170f..813d401 100644
--- a/INSTALL
+++ b/INSTALL
@@ -7,7 +7,7 @@ Build Instructions
   - A POSIX-compliant C development environment
   - GNU make version 3.81 or later
   - skalibs version 2.14.1.1 or later: https://skarnet.org/software/skalibs/
-  - (optional but recommended): s6-networking version 2.7.0.2 or later:
+  - (optional but recommended): s6-networking version 2.7.0.3 or later:
       https://skarnet.org/software/s6-networking/
 
  This software will run on any operating system that implements
diff --git a/NEWS b/NEWS
index b933658..abd5caf 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
 Changelog for tipidee.
 
+In 0.0.5.0
+----------
+
+ - "" is now understood as the empty extension for the content-type directive
+
+
 In 0.0.4.0
 ----------
 
diff --git a/doc/index.html b/doc/index.html
index 0557d6f..3336cbb 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -115,7 +115,7 @@ make it shorter. Just like the code.
 requirement if you link against the shared version of the skalibs
 library. </li>
  <li> Recommended at run-time: <a href="//skarnet.org/software/s6-networking/">s6-networking</a> version
-2.7.0.2 or later. It's not a strict requirement, but tipidee relies on a super-server such as
+2.7.0.3 or later. It's not a strict requirement, but tipidee relies on a super-server such as
 <a href="//skarnet.org/software/s6-networking/s6-tcpserver.html">s6-tcpserver</a>
 to listen to the network and provide connection
 information via environment variables. It also defers to tools such as
@@ -143,7 +143,7 @@ Don't take my word for it; try it out for yourself. </li>
 
 <ul>
  <li> The current released version of tipidee is
-<a href="tipidee-0.0.4.0.tar.gz">0.0.4.0</a>. </li>
+<a href="tipidee-0.0.5.0.tar.gz">0.0.5.0</a>. </li>
  <li> You can checkout a copy of the
 <a href="//git.skarnet.org/cgi-bin/cgit.cgi/tipidee/">tipidee
 git repository</a>:
diff --git a/doc/tipidee.conf.html b/doc/tipidee.conf.html
index 17c1a4f..d33a05e 100644
--- a/doc/tipidee.conf.html
+++ b/doc/tipidee.conf.html
@@ -499,6 +499,8 @@ to clients with the <tt>Content-Type: <em>type</em></tt> header.
  <li> Extensions must be listed <em>with</em> their initial dot. </li>
  <li> Example: <tt>content-type text/html .html .htm</tt> means that files
 ending in <tt>.html</tt> or <tt>.htm</tt> should be served as <tt>text/html</tt>.
+ <li> As a special case, <tt>content-type some/thing ""</tt> means that files without an
+extension should be served as <tt>some/thing</tt>. </li>
  <li> tipidee already comes with a
 <a href="https://git.skarnet.org/cgi-bin/cgit.cgi/tipidee/tree/src/config/defaults.c#n19">large
 list</a> of default Content-Type mappings; this directive should only be necessary if you're
diff --git a/doc/upgrade.html b/doc/upgrade.html
index b7a7d29..9e0192c 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,6 +18,13 @@
 
 <h1> What has changed in tipidee </h1>
 
+<h2> in 0.0.5.0 </h2>
+
+<ul>
+ <li> <a href="//skarnet.org/software/s6-networking/">s6-networking</a>
+recommendation bumped to 2.7.0.3 </li>
+</ul>
+
 <h2> in 0.0.4.0 </h2>
 
 <ul>
diff --git a/package/info b/package/info
index 0feefa4..cacce49 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
 package=tipidee
-version=0.0.4.0
+version=0.0.5.0
 category=web
 package_macro_name=TIPIDEE
diff --git a/src/config/lexparse.c b/src/config/lexparse.c
index d5fcf6d..a799a6b 100644
--- a/src/config/lexparse.c
+++ b/src/config/lexparse.c
@@ -182,15 +182,20 @@ static inline void parse_contenttype (char const *s, size_t const *word, size_t
   n-- ;
   for (size_t i = 0 ; i < n ; i++)
   {
-    size_t len = strlen(s + word[i]) ;
-    char key[len + 2] ;
-    if (s[word[i]] != '.')
-      strerr_dief6x(1, "file extensions must start with a dot", " - check directive content-type", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ;
-    key[0] = 'T' ;
-    key[1] = ':' ;
-    memcpy(key + 2, s + word[i] + 1, len - 1) ;
-    key[len + 1] = 0 ;
-    add_unique(key, ct, strlen(ct) + 1, md) ;
+    if (s[word[i]] == '\"' && s[word[i]+1] == '\"' && !s[word[i]+2])
+      add_unique("T:", ct, strlen(ct) + 1, md) ;
+    else if (s[word[i]] != '.')
+      strerr_dief6x(1, "file extensions must be \"\" or start with a dot", " - check directive content-type", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ;
+    else
+    {
+      size_t len = strlen(s + word[i]) ;
+      char key[len + 2] ;
+      key[0] = 'T' ;
+      key[1] = ':' ;
+      memcpy(key + 2, s + word[i] + 1, len - 1) ;
+      key[len + 1] = 0 ;
+      add_unique(key, ct, strlen(ct) + 1, md) ;
+    }
   }
 }
 
diff --git a/src/libtipidee/tipidee_conf_get_content_type.c b/src/libtipidee/tipidee_conf_get_content_type.c
index 7ee8866..98e9f5d 100644
--- a/src/libtipidee/tipidee_conf_get_content_type.c
+++ b/src/libtipidee/tipidee_conf_get_content_type.c
@@ -7,16 +7,17 @@
 
 char const *tipidee_conf_get_content_type (tipidee_conf const *conf, char const *res)
 {
+  char const *value = 0 ;
   char const *ext = strrchr(res, '.') ;
   if (ext && !strchr(ext, '/'))
   {
-    char const *value = 0 ;
     size_t extlen = strlen(ext+1) ;
     char key[3 + extlen] ;
     key[0] = 'T' ; key[1] = ':' ;
     memcpy(key + 2, ext + 1, extlen + 1) ;
     value = tipidee_conf_get_string(conf, key) ;
-    if (value || errno != ENOENT) return value ;
   }
+  else value = tipidee_conf_get_string(conf, "T:") ;
+  if (value || errno != ENOENT) return value ;
   return "application/octet-stream" ;
 }