httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elu...@apache.org
Subject svn commit: r1769899 - /httpd/httpd/trunk/docs/manual/mod/mod_headers.xml
Date Tue, 15 Nov 2016 22:57:18 GMT
Author: elukey
Date: Tue Nov 15 22:57:18 2016
New Revision: 1769899

URL: http://svn.apache.org/viewvc?rev=1769899&view=rev
Log:
Added a note in the mod_headers docs about Content-Type and setifempty

This note has been added as a follow up of a stack overflow post
(thanks to Michael Allan for the research):

http://stackoverflow.com/questions/29398123/apache-2-4-set-mime-type-of-file-without-extension

After a chat in #httpd-dev it seems that the issue boils down to how %{CONTENT_TYPE}
is evaluated in util_expr_eval.c (r->content_type) vs how setifempty is (only a check
of the response headers). This particular behavior might be a bug or feature,
but it is worth to alert our users.




Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_headers.xml

Modified: httpd/httpd/trunk/docs/manual/mod/mod_headers.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_headers.xml?rev=1769899&r1=1769898&r2=1769899&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_headers.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_headers.xml Tue Nov 15 22:57:18 2016
@@ -410,8 +410,17 @@ available in 2.4.10 and later</compatibi
 
     <dt><code>setifempty</code></dt>
     <dd>The request header is set, but only if there is no previous header
-    with this name.<br />
-    Available in 2.4.7 and later.</dd>
+    with this name.
+    <note>
+    The Content-Type header is a special use case since there might be
+    the chance that its value have been determined but the header is not part
+    of the response when <code>setifempty</code> is evaluated.
+    It is safer to use <code>set</code> for this use case like in the
+    following example:
+    <highlight language="config">
+    Header set Content-Type "text/plain" "expr=-z %{CONTENT_TYPE}"
+    </highlight>
+    </note></dd>
 
     <dt><code>unset</code></dt>
     <dd>The response header of this name is removed, if it exists.



Mime
View raw message