httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Weiss <we...@druga.org>
Subject mod_include features request
Date Thu, 25 Aug 2005 17:39:34 GMT
Hello.

As it looks like mod_include isn't changing a lot, but some new features
could be implemented there and would suite well.

- Smart and efficient server-side caching mechanism! (extremly useful in
static sites but also for headers and footers that include many other
static files).
 The idea of how it should work is quite simple: The first time
something is included via SSI the caching extension would remember all
the files that were involved, the modification time of the file that was
last modified along them and the resulting output. The next time a
request would be made the cache mechanism would simply check if the
requested file that should be parsed is already cached and if true, then
just check the modification times of all the files that are included
(filename list was generated before) and see if all of them are older
than the cached outputs last modification time.
 Problems will occur when you try to include a CGI script, so the CGI
directory should be marked in the apache config as dynamic (SSI would
include everything from scratch - like now). But there is also a
efficient solution to caching "the expensive" CGI script executions:
Every (or just some) script should print out in it's header a
Cache-Control or Expires field! Then the cache mechanism would just
check if it is already over when a url is requested.
 So if you think it over you will see that this would be a good way to
reduce CPU and disk load directly at the server (on the costs of memory
or even disk caching).
 Everything described above would work fine if the originaly requested
file would be SSI parsed, but problems accour if you want to "use it on
a sub-include call". In such a case SSI variables that are not constant
could play an important role (but if they are not used in "subtree of
inclusions" they can be ignored). The solution of this would simply
store all the additionaly set SSI variables in the cache and then
compare them too with the current before including. If everything would
be the same then there is no reason to not post the cached output.
 It would be really nice to have this.
--


- Anyone who has ever used SSI directives knows the annoying newlines
that appear if you just put the code without thinking of them. Hereby I
mean the new lines that are preceding or following a directive.
 So if you write sth like:
...one line of text...
<!--#if expr="$fooline"--><!--#echo var="fooline"--><!--#endif -->
...another line...
 And if $fooline is not set you will get:
...one line of text...

...another line...
 So, that empty line in between is annoying and could be "simply" fixed
with an extra parameter that would be present in every SSI directive and
for example called join with the values: "l" (left), "r"(right) or
"b"(both) (or maybe even special "ls", "rs", "bs" that would also remove
normal spaces and tabs). And then the code:
...one line of text...
<!--#if expr="$fooline" join="l"-->
  <!--#echo var="fooline" join="bs"-->
<!--#endif join="r"-->
...another line...
 Would result if $fooline would not be set would then be:
...one line of text...
...another line...
 And if it is set:
...one line of text...
contents of fooline without the spaces around
...another line...
--


- The abilitys of this module could be added:
http://modules.apache.org/search?id=423 (or:
http://minimal.cx/2002/06/10/mod_include/).
 They are here named as #define and #macro and work like:
<!--#define var="FONT_FACE" value="<FONT FACE="Times">$TEXT</FONT>" -->
<!--#macro var="TEXT" value="Hello" def="FONT_FACE" -->
 Output:
<FONT FACE="Times">Hello</FONT>
--

I hope all or only some of them will get implemented sooner or later. Or
maybe they could be added to a module calles mod_include2 or sth that
would have most of the code the same.


   gw

Mime
View raw message