httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@wired.com>
Subject conditional html
Date Thu, 12 Oct 1995 16:26:00 GMT
My conditional html code is 'finished' and we're testing it now.  After I'm
satisfied it's working fine I'm willing to release it.  However I'm not
sure it'll match everyone's expectations here.  I made some design choices
that were driven by local concerns.

The code doesn't use flex (I found myself using too many states).  It
only uses bison for parsing the expressions.  It does include a new
scanner that should be more efficient than the old find_string -- but I
don't have profiling information on it yet.

Just for interest sake:  I profiled our servers (before the rewrite) and 
the top 3 routines in order were _encrypt, find_string, and rputc.
Unfortunately there's no gprof for IRIX, so this is just flat profile
information.

Included below is some rough documentation.

Dean

<html>
<head>
<title>Conditional HTML</title>
</head>
<body>
<p>Conditional HTML constructs allow the author to issue different documents
according to the browser used.
The following tags may be placed anywhere within a document:
<tt><ul>
    <li> &lt;if <i>conditional-expr</i>&gt;
    <li> &lt;elsif <i>conditional-expr</i>&gt;
    <li> &lt;else&gt;
    <li> &lt;endif&gt;
</ul></tt>
<p>A <i>conditional-expr</i> can use the logical operators <tt>and</tt>,
<tt>or</tt>, and <tt>not</tt>.  Parentheses <tt>(</tt>,
and <tt>)</tt>
may be used for grouping.  The actual terms presently have only one
form:
<ul>
    <li><tt>supports=<i>property</i>
</ul>
A <i>property</i> is one of the following:
<dl>
    <dt><tt>backgrounds</tt>
    <dt><tt>font</tt>
    <dt><tt>forms</tt>
    <dt><tt>imagealign</tt>
    <dt><tt>images</tt>
    <dt><tt>java</tt>
    <dt><tt>jpeginline</tt>
    <dt><tt>math</tt>
    <dt><tt>tables</tt>
    <dt><tt>vrml</tt>
</dl>
<p>For example:
<pre>
    &lt;p&gt;This paragraph will always be present.
    &lt;if supports=tables&gt;
	&lt;p&gt;This paragraph will only be present on browsers supporting
	tables.
    &lt;else&gt;
	&lt;p&gt;This paragraph will only be present on browsers which do
	not support tables.
    &lt;endif&gt;

    &lt;if supports=tables and supports=forms&gt;
	&lt;p&gt;Text for browsers supporting both forms and tables.
    &lt;endif&gt;
</pre>

<h3>Declaring Properties of Browsers</h3>

<p>The properties of a browser are declared in the <tt>httpd.conf</tt> file
used to boot the webserver.  The configuration tag is <tt>UserAgent</tt>
and has the following format:
<tt><pre>
    UserAgent /regexp/ property1 property2 ...
</pre></tt>
<p>The <tt>UserAgent</tt> tag can be placed in the global section (for all
servers) or in a particular virtual server section.  The <tt>User-Agent</tt>
header is matched against the <tt>UserAgent</tt> tags in the order
given.  The <tt>/</tt> characters can be replaced by any matching character.
For example:
<tt><pre>
    UserAgent '^Mozilla/1' tables forms jpeginline images backgrounds
    UserAgent #^Mozilla/2# tables forms jpeginline images backgrounds java
    UserAgent :^Lynx: forms
</pre></tt>
<p>The regular expressions available correspond to
<a href="http://edit.hotwired.com/info2www/info2www.cgi?(regex)">basic
POSIX regular expressions</a>.

<h3>CGI Support</h3>
The environment variable <TT>BROWSER_SUPPORTS</TT> is set to the list of
properties for the user agent.
</body>
</html>

Mime
View raw message