changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > werc / changeset: initial import of changes from 9front bikeshedding; bundle rc-httpd

changeset 657: fb460a671d19
parent 656: 50a9b770bb43
child 658: b501d0f9afa4
author: sl
date: Thu, 04 Feb 2016 15:05:05 -0500
files: .hgignore README apps/blagh/app.rc apps/blagh/atom.tpl apps/blagh/rss20.tpl apps/bridge/app.rc apps/bridge/comments_list.tpl apps/bridge/foot.tpl apps/dirdir/app.rc apps/dirdir/edit.tpl apps/dirdir/sidebar_controls.tpl apps/paste/app.rc apps/wman/app.rc apps/wman/man_page.tpl apps/wman/page_list.tpl apps/wman/search.tpl apps/wman/section_list.tpl bin/cgilib.rc bin/contrib/hgweb.config bin/contrib/rc-httpd/handlers/__mkfstmp bin/contrib/rc-httpd/handlers/authorize bin/contrib/rc-httpd/handlers/cgi bin/contrib/rc-httpd/handlers/dir-index bin/contrib/rc-httpd/handlers/error bin/contrib/rc-httpd/handlers/redirect bin/contrib/rc-httpd/handlers/serve-static bin/contrib/rc-httpd/handlers/static-or-cgi bin/contrib/rc-httpd/handlers/static-or-index bin/contrib/rc-httpd/rc-httpd bin/contrib/rc-httpd/select-handler bin/contrib/urldecode.awk bin/contrib/urlencode.awk bin/contrib/webserver.rc bin/corehandlers.rc bin/fltr_cache.rc bin/template.awk bin/werc.rc bin/werc_errlog_wrap.rc bin/wercconf.rc bin/werclib.rc etc/initrc pub/default_favicon.ico pub/style/imgs/sgl.png pub/style/sinorca-screen-alt.css pub/style/style.css pub/style/style_old.css
description: initial import of changes from 9front bikeshedding; bundle rc-httpd
     1.1--- a/.hgignore	Sun Aug 19 01:16:10 2012 +0200
     1.2+++ b/.hgignore	Thu Feb 04 15:05:05 2016 -0500
     1.3@@ -1,2 +1,3 @@
     1.4 syntax: glob
     1.5+etc/initrc.local
     1.6 sites/?*/
     2.1--- a/README	Sun Aug 19 01:16:10 2012 +0200
     2.2+++ b/README	Thu Feb 04 15:05:05 2016 -0500
     2.3@@ -14,7 +14,7 @@
     2.4 Requirements:
     2.5 
     2.6 * An http server that can handle CGIs
     2.7-* Plan 9 from User Space: http://plan9.us - Or 9base-5 or later: http://tools.suckless.org/9base
     2.8+* Plan 9 from User Space: http://swtch.com/plan9port - Or 9base-tip: http://tools.suckless.org/9base
     2.9 
    2.10 Note: Werc by default expects the Plan 9 tools to be installed under
    2.11 /usr/local/plan9/bin/, if you have installed them elsewhere you will need to
    2.12@@ -46,7 +46,7 @@
    2.13 customize it as needed. Site (and directory) specific options can be set in a
    2.14 sites/example.com/_werc/config file inside the site's directory. To customize
    2.15 templates and included files you can store your own version of the files in
    2.16-lib/ under sites/example.com/_werc/lib
    2.17+lib/ under sites/example.com/_werc/lib.
    2.18 
    2.19 The source tree for the werc website is included under sites/werc.cat-v.org as
    2.20 an example, feel free to use it as a template for your own site.
    2.21@@ -58,21 +58,17 @@
    2.22 Contact
    2.23 -------
    2.24 
    2.25-For comments, suggestions, bug reports or patches join the werc9 list in
    2.26-google groups: http://groups.google.com/group/werc9 or the irc channel #cat-v
    2.27-in irc.freenode.org
    2.28+For comments, suggestions, bug reports or patches join the werc mailing list
    2.29+at: http://werc.cat-v.org or the irc channel #cat-v in irc.freenode.org
    2.30 
    2.31 If you have a public website that uses werc I would love to hear about it and
    2.32 get feedback about you experience setting it up.
    2.33 
    2.34-If you want to be notified of new releases see the News section of the website
    2.35-or use Freshmeat: http://freshmeat.net/projects/werc/
    2.36-
    2.37 Thanks
    2.38 ------
    2.39 
    2.40-Garbeam, Kris Maglione, sqweek, soul9, mycroftiv, maht, yiyus and many others
    2.41-for their ideas, patches, testing and other contributions.
    2.42+Garbeam, Kris Maglione, sqweek, soul9, mycroftiv, maht, yiyus, cinap_lenrek,
    2.43+khm and many others for their ideas, patches, testing and other contributions.
    2.44 
    2.45 
    2.46 License
     3.1--- a/apps/blagh/app.rc	Sun Aug 19 01:16:10 2012 +0200
     3.2+++ b/apps/blagh/app.rc	Thu Feb 04 15:05:05 2016 -0500
     3.3@@ -26,7 +26,7 @@
     3.4         if(check_user $conf_blog_editors) {
     3.5             editor_mode=on
     3.6             if(~ $"post_arg_date '')
     3.7-                post_date=`{/bin/date +%F|sed 's,-,/,g'}
     3.8+                post_date=`{date -i|sed 's,-,/,g'}  # date -i is 9front/9base only
     3.9             if not
    3.10                 post_date=$post_arg_date
    3.11             ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>'
     4.1--- a/apps/blagh/atom.tpl	Sun Aug 19 01:16:10 2012 +0200
     4.2+++ b/apps/blagh/atom.tpl	Thu Feb 04 15:05:05 2016 -0500
     4.3@@ -5,18 +5,18 @@
     4.4 fn statpost {
     4.5     f = $1
     4.6 
     4.7-    updated = `{/bin/date --rfc-3339'=seconds' -r $f |tr ' ' 'T'} 
     4.8+    updated = `{date -t `{mtime $f | awk '{print $1}'}} # date -t is 9front/9base only
     4.9     post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!'}}^'/'
    4.10     title=`{read $f/index.md}
    4.11     # Not used: date=`{/bin/date -Rd `{basename $f |sed 's/(^[0-9\-]*).*/\1/; s/-[0-9]$//'}}
    4.12     # TODO: use mtime(1) and ls(1) instead of lunix's stat(1)
    4.13-    stat=`{stat -c '%Y %U' $f}
    4.14+    #stat=`{stat -c '%Y %U' $f}
    4.15     #mdate=`{/bin/date -Rd `{mtime $f|awk '{print $1}' }} # Not used because it is unreliable
    4.16-    by=$stat(2)
    4.17+    by=`{ls -m $f | sed 's/^\[//g; s/].*$//g' >[2]/dev/null}
    4.18     #ifs=() { summary=`{cat $f/index.md | crop_text 1024 ... | $formatter } }
    4.19     ifs=() { summary=`{cat $f/index.md | strip_title_from_md_file | ifs=$difs {$formatter} } }
    4.20 }
    4.21-updated = `{/bin/date --rfc-3339'=seconds' |sed 's/ /T/'} 
    4.22+updated = `{date -t} # date -t is 9front/9base only
    4.23 %}
    4.24 
    4.25 <feed xmlns="http://www.w3.org/2005/Atom"
    4.26@@ -28,10 +28,10 @@
    4.27 
    4.28     <link rel="self" href="%($base_url^$req_path%)"/>
    4.29     <id>%($base_url^$req_path%)</id>
    4.30-    <icon>/favicon.ico</icon>
    4.31+    <icon><![CDATA[/favicon.ico]]></icon>
    4.32 
    4.33-    <title>%($siteTitle%)</title>
    4.34-    <subtitle>%($siteSubTitle%)</subtitle>
    4.35+    <title><![CDATA[%($siteTitle%)]]></title>
    4.36+    <subtitle><![CDATA[%($siteSubTitle%)]]></subtitle>
    4.37 
    4.38 % # <updated>2008-09-24T12:47:00-04:00</updated>
    4.39     <updated>%($updated%)</updated>
    4.40@@ -44,13 +44,13 @@
    4.41 % # Maybe we should be smarter, see: http://diveintomark.org/archives/2004/05/28/howto-atom-id, example: <id>tag:intertwingly.net,2004:2899</id>
    4.42         <id>%($post_uri%)</id>
    4.43         <link href="%($post_uri%)"/>
    4.44-        <title>%($title%)</title>
    4.45+        <title><![CDATA[%($title%)]]></title>
    4.46 % # <link rel="replies" href="2899.atom" thr:count="0"/>
    4.47-        <author><name>%($by%)</name></author>
    4.48+        <author><name><![CDATA[%($by%)]]></name></author>
    4.49 
    4.50 
    4.51         <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
    4.52-            %($summary%)
    4.53+            <![CDATA[%($summary%)]]>
    4.54         </div></content>
    4.55 
    4.56         <updated>%($updated%)</updated>
    4.57@@ -61,79 +61,3 @@
    4.58 </feed>
    4.59 
    4.60 % exit 
    4.61-
    4.62-<feed xmlns="http://www.w3.org/2005/Atom"
    4.63-  xmlns:thr="http://purl.org/syndication/thread/1.0">
    4.64-  <link rel="self" href="http://intertwingly.net/blog/index.atom"/>
    4.65-  <id>http://intertwingly.net/blog/index.atom</id>
    4.66-  <icon>../favicon.ico</icon>
    4.67-
    4.68-  <title>Sam Ruby</title>
    4.69-  <subtitle>It’s just data</subtitle>
    4.70-  <author>
    4.71-    <name>Sam Ruby</name>
    4.72-    <email>rubys@intertwingly.net</email>
    4.73-    <uri>/blog/</uri>
    4.74-  </author>
    4.75-  <updated>2008-09-24T12:47:00-04:00</updated>
    4.76-  <link href="/blog/"/>
    4.77-  <link rel="license" href="http://creativecommons.org/licenses/BSD/"/>
    4.78-
    4.79-  <entry>
    4.80-    <id>tag:intertwingly.net,2004:2899</id>
    4.81-    <link href="/blog/2008/09/11/RubyConf-2008"/>
    4.82-    <link rel="replies" href="2899.atom" thr:count="0"/>
    4.83-    <title>RubyConf 2008</title>
    4.84-    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
    4.85-    
    4.86-<p>My <a href="http://www.rubyconf.org/talks/14">proposal</a> has been accepted for <a href="http://www.rubyconf.org/talks">RubyConf 2008</a>.  Because of the presence of Ruby implementers, this is going to be a bit challenging as it will likely turn into two talks at once.  One sharing experiences with fellow developers concerning things they may need to watch out for, and another with language designers about the impact of their changes.  It also is likely to be true, as it was at <a href="http://intertwingly.net/blog/2008/07/24/Ruby-1-9-What-to-Expect">OSCON</a>, that there will be members of the audience who know way more about this subject than I do.</p>
    4.87-<p>I had originally requested a slot on Saturday.  My current slot requires me to shave a day off of <a href="http://us.apachecon.com/c/acus2008/">ApacheCon</a>.  I’ve again asked that the slot be changed, but even if it doesn’t move, I can manage this.  At least we are only talking about a short hop from New Orleans to Orlando.</p>
    4.88-
    4.89-    </div></content>
    4.90-    <updated>2008-09-11T06:51:36-04:00</updated>
    4.91-  </entry>
    4.92-
    4.93-  <entry>
    4.94-    <id>tag:intertwingly.net,2004:2898</id>
    4.95-    <link href="/blog/2008/09/10/Small-Updates"/>
    4.96-    <link rel="replies" href="2898.atom" thr:count="8" thr:updated="2008-09-10T15:31:05-04:00"/>
    4.97-    <title>Small Updates</title>
    4.98-    <summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
    4.99-    
   4.100-    <p><a href="http://hublog.hubmed.org/archives/001744.html">Alf Eaton</a>: <em>Aside: if you’re reading a Planet that contains HubLog, those posts will all jump to the top - sorry! (I wish Planets dealt better with small updates so I didn’t have to worry about it).</em></p>
   4.101-<p>I don’t know what publishing software you use, but I see you provide an Atom feed, and Planet 2.0 and Venus both implement <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php#element.updated">atom:updated</a> as specified in RFC 4287.</p>
   4.102-
   4.103-    </div></summary>
   4.104-    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
   4.105-
   4.106-<p><a href="http://hublog.hubmed.org/archives/001744.html"><cite>Alf Eaton</cite></a>: <em>Aside: if you’re reading a Planet that contains HubLog, those posts will all jump to the top - sorry! (I wish Planets dealt better with small updates so I didn’t have to worry about it).</em></p>
   4.107-<p>I don’t know what publishing software you use, but I see you provide an Atom feed, and Planet 2.0 and Venus both implement <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php#element.updated">atom:updated</a> as specified in RFC 4287.</p>
   4.108-<p>More specifically, if you have a minor update and leave the updated date alone, the posts will not jump to the top.  The next release of WordPress, for example, will contain the necessary hooks for a <a href="http://blog.ciarang.com/posts/wp-minor-edit/">plugin</a> to provide a simple checkbox for indicating that the change constitutes a minor edit.</p>
   4.109-
   4.110-    </div></content>
   4.111-    <updated>2008-09-10T10:18:47-04:00</updated>
   4.112-  </entry>
   4.113-
   4.114-  <entry>
   4.115-    <id>tag:intertwingly.net,2004:2897</id>
   4.116-    <link href="/blog/2008/09/07/SVG-via-CSS"/>
   4.117-    <link rel="replies" href="2897.atom" thr:count="10" thr:updated="2008-09-12T02:21:21-04:00"/>
   4.118-    <title>SVG via CSS</title>
   4.119-    <summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
   4.120-    
   4.121-    <p>Now that I have my weblog looking reasonably consistent between Gecko and WebKit based browsers, I’ve taken another look at Opera.  Opera doesn’t have support for border-radius, but does have support for background images in SVG, which can be <a href="http://dev.opera.com/articles/view/new-development-techniques-using-opera-k/">used to provide the same effect</a>.  My Nav Bar on <a href="http://rails.intertwingly.net/blog/">my test site</a> now employs this technique, and it requires two separate images: <a href="http://rails.intertwingly.net/stylesheets/rc-039-CCD.svg">039 on CCD</a> and <a href="http://rails.intertwingly.net/stylesheets/rc-CCD-FFF.svg">CCD on FFF</a>.</p>
   4.122-<p>Frankly, my first reaction to this was mixed.  The pluses for SVG in CSS is that it doesn’t require either adjusting your markup or JavaScript to achieve these effects, a desirable characteristic that generally the <a href="http://www.cssjuice.com/25-rounded-corners-techniques-with-css/">other techniques</a> don’t share.</p>
   4.123-
   4.124-    </div></summary>
   4.125-
   4.126-    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
   4.127-    
   4.128-<p>Now that I have my weblog looking reasonably consistent between Gecko and WebKit based browsers, I’ve taken another look at Opera.  Opera doesn’t have support for border-radius, but does have support for background images in SVG, which can be <a href="http://dev.opera.com/articles/view/new-development-techniques-using-opera-k/">used to provide the same effect</a>.  My Nav Bar on <a href="http://rails.intertwingly.net/blog/">my test site</a> now employs this technique, and it requires two separate images: <a href="http://rails.intertwingly.net/stylesheets/rc-039-CCD.svg">039 on CCD</a> and <a href="http://rails.intertwingly.net/stylesheets/rc-CCD-FFF.svg">CCD on FFF</a>.</p>
   4.129-<p>Meanwhile, Robert O’Callahan has been exploring <a href="http://weblogs.mozillazine.org/roc/archives/2008/06/applying_svg_ef.html">other ways</a> to integrate these technologies.</p>
   4.130-
   4.131-    </div></content>
   4.132-    <updated>2008-09-07T11:12:29-04:00</updated>
   4.133-  </entry>
   4.134-
   4.135-</feed>
   4.136-
     5.1--- a/apps/blagh/rss20.tpl	Sun Aug 19 01:16:10 2012 +0200
     5.2+++ b/apps/blagh/rss20.tpl	Thu Feb 04 15:05:05 2016 -0500
     5.3@@ -6,13 +6,13 @@
     5.4 
     5.5     post_uri = `{echo $f | sed 's,^'$sitedir',,'}
     5.6     #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' }
     5.7-        title=`{read $f/index.md}
     5.8-    date=`{/bin/date -Rd `{echo $f|sed 's,.*/([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])/.*,\1,'}}
     5.9+    title=`{read $f/index.md}
    5.10+    date=`{date `{mtime $f | awk '{print $1}'}} # rss 2.0 spec says pubDate should conform to rfc822
    5.11     # TODO: use mtime(1) and ls(1) instead of lunix's stat(1)
    5.12-    stat=`{stat -c '%Y %U' $f}
    5.13+    #stat=`{stat -c '%Y %U' $f}
    5.14     #mdate=`{/bin/date -Rd $stat(1)} # Not used because it is unreliable
    5.15     post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!'}}^'/'
    5.16-    by=$stat(2)
    5.17+    by=`{ls -m $f | sed 's/^\[//g; s/].*$//g' >[2]/dev/null}
    5.18     ifs=() {summary=`{ cat $f/index.md |strip_title_from_md_file| ifs=$difs {$formatter | escape_html} }}
    5.19 }
    5.20 
    5.21@@ -21,11 +21,11 @@
    5.22 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    5.23     <channel>
    5.24         <atom:link href="%($base_url^$req_path%)" rel="self" type="application/rss+xml" />
    5.25-        <title>%($siteTitle%)</title>
    5.26+        <title><![CDATA[%($siteTitle%)]]></title>
    5.27         <link>%($base_url^$req_path%)</link>
    5.28-        <description>%($blogDesc%)</description>
    5.29+        <description><![CDATA[%($blogDesc%)]]></description>
    5.30         <language>en-us</language>
    5.31-        <generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator>
    5.32+        <generator><![CDATA[Tom Duff's rc, and Kris Maglione's clever hackery]]></generator>
    5.33 %{
    5.34         # <webMaster>uriel99+rss@gmail.com (Uriel)</webMaster>
    5.35         for(f in `{get_post_list $blagh_root$blagh_dirs}) {
    5.36@@ -39,12 +39,12 @@
    5.37             #}
    5.38 %}
    5.39         <item>
    5.40-            <title>%($title%)</title>
    5.41-            <author>%($by%)@noreply.cat-v.org (%($by%))</author>
    5.42+            <title><![CDATA[%($title%)]]></title>
    5.43+            <author><![CDATA[%($by%)@noreply.cat-v.org (%($by%))]]></author>
    5.44             <link>%($post_uri%)</link>
    5.45             <guid isPermaLink="true">%($post_uri%)</guid>
    5.46             <pubDate>%($date%)</pubDate>
    5.47-            <description>%($summary%)</description>
    5.48+            <description><![CDATA[%($summary%)]]></description>
    5.49         </item>
    5.50 %        }
    5.51 
     9.1--- a/apps/dirdir/app.rc	Sun Aug 19 01:16:10 2012 +0200
     9.2+++ b/apps/dirdir/app.rc	Thu Feb 04 15:05:05 2016 -0500
     9.3@@ -7,7 +7,7 @@
     9.4 fn dirdir_init {
     9.5     if(! ~ $#enable_wiki 0 && check_user $wiki_editors_groups) {
     9.6         lp=$local_path
     9.7-        # werc.rc doesn't append /index when $local_path doesn't exit
     9.8+        # werc.rc doesn't append /index when $local_path doesn't exist
     9.9         # maybe it should, but for now we can fix it up here.
    9.10         if(~ $lp */) 
    9.11             lp=$lp^'index'
    12.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2+++ b/apps/paste/app.rc	Thu Feb 04 15:05:05 2016 -0500
    12.3@@ -0,0 +1,33 @@
    12.4+fn conf_enable_paste {
    12.5+        paste_url=$conf_wd
    12.6+        paste_dir=`{pwd}
    12.7+        conf_enable_app paste
    12.8+}
    12.9+
   12.10+fn paste_init {
   12.11+        if (~ $REQUEST_METHOD POST && ~ $post_arg_url url && ~ $req_path $paste_url ) { # incoming paste 
   12.12+                now=`{ date -n }
   12.13+                cksum=`{ echo $"post_arg_paste | sum | awk '{ print $1 }' }
   12.14+                if (~ $cksum '1715a8eb' ) { # empty paste; discard
   12.15+                        post_redirect $base_url^$paste_url
   12.16+                }
   12.17+                if not {  # save and redirect
   12.18+                        # TODO: stop using echo
   12.19+                        echo $"post_arg_paste > $paste_dir^/^$now^.^$cksum
   12.20+#cat<<EOF > $paste_dir^/^$now^.^$cksum
   12.21+#$"post_arg_paste
   12.22+#EOF
   12.23+                        #post_redirect $base_url^$paste_url^$now^.^$cksum
   12.24+                        echo 'Content-type: text/plain'; echo ''; exec echo $base_url^$paste_url^$now^.^$cksum
   12.25+                }
   12.26+        } 
   12.27+        if not { # show a paste if there is one
   12.28+                if (test -r $werc_root/$local_path && ~ $QUERY_STRING raw ) { 
   12.29+                                echo 'Content-type: text/plain'; echo ''; exec cat $werc_root/$local_path
   12.30+                        } 
   12.31+        }
   12.32+
   12.33+# if we haven't done anything by now, we don't care.  we just exit and let
   12.34+# werc handle it from here.
   12.35+}
   12.36+
    13.1--- a/apps/wman/app.rc	Sun Aug 19 01:16:10 2012 +0200
    13.2+++ b/apps/wman/app.rc	Thu Feb 04 15:05:05 2016 -0500
    13.3@@ -71,7 +71,6 @@
    13.4 
    13.5 fn wman_page_gen {
    13.6     #troff -manhtml $1| troff2html -t 'Plan 9 from User Space'
    13.7-    # Using GNU col here to remove nroffs garbage (eg., from .ft B); p9p has no col(1) :(
    13.8     troff -N -m$wman_tmac $1 | wman_out_filter
    13.9 }
   13.10 
   13.11@@ -80,10 +79,11 @@
   13.12 }
   13.13 
   13.14 fn wman_default_out_filter {
   13.15+    # Using GNU col here to remove nroffs garbage (eg., from .ft B); p9p has no col(1) :(
   13.16     escape_html \
   13.17     | sed 's!([\.\-a-zA-Z0-9]+)\(('^`{echo $wman_cat_list|tr ' ' '|'}^')\)!<a href="../\2/\1">&</a>!g' \
   13.18-    | awk '/^$/ {if(n != 1) print; n=1; next} /./ {n=0; print}'
   13.19-
   13.20+    | awk '/^$/ {if(n != 1) print; n=1; next} /./ {n=0; print}' \
   13.21+    | col -x
   13.22 }
   13.23 
   13.24 
    14.1--- a/apps/wman/man_page.tpl	Sun Aug 19 01:16:10 2012 +0200
    14.2+++ b/apps/wman/man_page.tpl	Thu Feb 04 15:05:05 2016 -0500
    14.3@@ -1,7 +1,3 @@
    14.4 <pre>
    14.5-%{
    14.6-
    14.7-wman_page_gen $wman_page_file
    14.8-
    14.9-%}
   14.10+% wman_page_gen $wman_page_file
   14.11 </pre>
    15.1--- a/apps/wman/page_list.tpl	Sun Aug 19 01:16:10 2012 +0200
    15.2+++ b/apps/wman/page_list.tpl	Thu Feb 04 15:05:05 2016 -0500
    15.3@@ -1,11 +1,8 @@
    15.4-% d=`{wman_get_section_desc $wman_cat} 
    15.5-<h1>Manual pages - Section %($wman_cat%): %($"d%)</h1>
    15.6 
    15.7+% d=`{wman_get_section_desc $wman_cat}
    15.8+<h1>Manual pages - Section
    15.9+% echo $wman_cat': '$"d2
   15.10+</h1>
   15.11 <ul style="float:left">
   15.12-%{
   15.13-wman_ls_pages $wman_cat_path \
   15.14-    | awk -F/ '{ print "<li><a href=\""$(NF)"\">"$(NF)"</a></li>" }
   15.15-    NR%20 == 0 { print "</ul><ul style=\"float: left\">" }'
   15.16-%}
   15.17+% wman_ls_pages $wman_cat_path | awk -F/ '{ print "<li><a href=\""$(NF)"\">"$(NF)"</a></li>" } NR%20 == 0 { print "</ul><ul style=\"float: left\">" }'
   15.18 </ul>
   15.19-
    18.1--- a/bin/cgilib.rc	Sun Aug 19 01:16:10 2012 +0200
    18.2+++ b/bin/cgilib.rc	Thu Feb 04 15:05:05 2016 -0500
    18.3@@ -2,7 +2,7 @@
    18.4 
    18.5 fn dprint { echo $* >[1=2] }
    18.6 fn dprintv { { for(v in $*) { echo -n $v^'#'^$#$v^'=' $$v '; '  }; echo } >[1=2] }
    18.7-
    18.8+fn echo {if(! ~ $1 -n || ! ~ $2 '') /bin/echo $*}
    18.9 fn escape_html { sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' $* }
   18.10 
   18.11 fn http_redirect {
   18.12@@ -12,7 +12,7 @@
   18.13         t=$"base_url^$1
   18.14     if not
   18.15         t=$"base_url^$"req_path^$1
   18.16-    echo 'Status: '^$2^'
   18.17+    exec /bin/echo 'Status: '^$2^'
   18.18 Location: '^$t^'
   18.19 
   18.20 '
   18.21@@ -29,7 +29,7 @@
   18.22         ifs='&
   18.23 '       for(pair in `{cat}) {
   18.24             ifs='=' { pair=`{echo -n $pair} }
   18.25-            n='post_arg_'^`{echo $pair(1)|tr -cd 'a-zA-Z0-9_'}
   18.26+            n='post_arg_'^`{echo $pair(1)|urldecode|tr -cd 'a-zA-Z0-9_'}
   18.27             post_args=( $post_args $n )
   18.28             ifs=() { $n=`{echo -n $pair(2)|urldecode|tr -d '
'} }
   18.29         }
   18.30@@ -64,89 +64,52 @@
   18.31     END { printf "%s", buf }'
   18.32 }
   18.33 
   18.34-fn urldecode {
   18.35-awk '
   18.36-BEGIN {
   18.37-    hextab ["0"] = 0; hextab ["8"] = 8;
   18.38-    hextab ["1"] = 1; hextab ["9"] = 9;
   18.39-    hextab ["2"] = 2; hextab ["A"] = hextab ["a"] = 10
   18.40-    hextab ["3"] = 3; hextab ["B"] = hextab ["b"] = 11;
   18.41-    hextab ["4"] = 4; hextab ["C"] = hextab ["c"] = 12;
   18.42-    hextab ["5"] = 5; hextab ["D"] = hextab ["d"] = 13;
   18.43-    hextab ["6"] = 6; hextab ["E"] = hextab ["e"] = 14;
   18.44-    hextab ["7"] = 7; hextab ["F"] = hextab ["f"] = 15;
   18.45-}
   18.46-{
   18.47-    decoded = ""
   18.48-    i = 1
   18.49-    len = length ($0)
   18.50-    while ( i <= len ) {
   18.51-        c = substr ($0, i, 1)
   18.52-        if ( c == "%" ) {
   18.53-            if ( i+2 <= len ) {
   18.54-                c1 = substr ($0, i+1, 1)
   18.55-                c2 = substr ($0, i+2, 1)
   18.56-                if ( hextab [c1] == "" || hextab [c2] == "" ) {
   18.57-                    print "WARNING: invalid hex encoding: %" c1 c2 | "cat >&2"
   18.58-                } else {
   18.59-                    code = 0 + hextab [c1] * 16 + hextab [c2] + 0
   18.60-                    c = sprintf ("%c", code)
   18.61-                    i = i + 2
   18.62-                }
   18.63-            } else {
   18.64-                print "WARNING: invalid % encoding: " substr ($0, i, len - i)
   18.65-            }
   18.66-        } else if ( c == "+" ) {
   18.67-            c = " "
   18.68-        }
   18.69-        decoded = decoded c
   18.70-        ++i
   18.71-    }
   18.72-    printf "%s", decoded
   18.73-}
   18.74-'
   18.75-}
   18.76+fn urldecode { /bin/urlencode -d }
   18.77 
   18.78-fn url_encode {
   18.79-    awk '
   18.80-    BEGIN {
   18.81-    # We assume an awk implementation that is just plain dumb.
   18.82-    # We will convert an character to its ASCII value with the
   18.83-    # table ord[], and produce two-digit hexadecimal output
   18.84-    # without the printf("%02X") feature.
   18.85+#fn urldecode {
   18.86+#awk '
   18.87+#BEGIN {
   18.88+#    hextab ["0"] = 0; hextab ["8"] = 8;
   18.89+#    hextab ["1"] = 1; hextab ["9"] = 9;
   18.90+#    hextab ["2"] = 2; hextab ["A"] = hextab ["a"] = 10
   18.91+#    hextab ["3"] = 3; hextab ["B"] = hextab ["b"] = 11;
   18.92+#    hextab ["4"] = 4; hextab ["C"] = hextab ["c"] = 12;
   18.93+#    hextab ["5"] = 5; hextab ["D"] = hextab ["d"] = 13;
   18.94+#    hextab ["6"] = 6; hextab ["E"] = hextab ["e"] = 14;
   18.95+#    hextab ["7"] = 7; hextab ["F"] = hextab ["f"] = 15;
   18.96+#}
   18.97+#{
   18.98+#    decoded = ""
   18.99+#    i = 1
  18.100+#    len = length ($0)
  18.101+#    while ( i <= len ) {
  18.102+#        c = substr ($0, i, 1)
  18.103+#        if ( c == "%" ) {
  18.104+#            if ( i+2 <= len ) {
  18.105+#                c1 = substr ($0, i+1, 1)
  18.106+#                c2 = substr ($0, i+2, 1)
  18.107+#                if ( hextab [c1] == "" || hextab [c2] == "" ) {
  18.108+#                    print "WARNING: invalid hex encoding: %" c1 c2 | "cat >&2"
  18.109+#                } else {
  18.110+#                    code = 0 + hextab [c1] * 16 + hextab [c2] + 0
  18.111+#                    c = sprintf ("%c", code)
  18.112+#                    i = i + 2
  18.113+#                }
  18.114+#            } else {
  18.115+#                print "WARNING: invalid % encoding: " substr ($0, i, len - i)
  18.116+#            }
  18.117+#        } else if ( c == "+" ) {
  18.118+#            c = " "
  18.119+#        }
  18.120+#        decoded = decoded c
  18.121+#        ++i
  18.122+#    }
  18.123+#    printf "%s", decoded
  18.124+#}
  18.125+#'
  18.126+#}
  18.127 
  18.128-    EOL = "%0A"     # "end of line" string (encoded)
  18.129-    split ("1 2 3 4 5 6 7 8 9 A B C D E F", hextab, " ")
  18.130-    hextab [0] = 0
  18.131-    for ( i=1; i<=255; ++i ) ord [ sprintf ("%c", i) "" ] = i + 0
  18.132-    if ("'^$"EncodeEOL^'" == "yes") EncodeEOL = 1; else EncodeEOL = 0
  18.133-    }
  18.134-    {
  18.135-    encoded = ""
  18.136-    for ( i=1; i<=length ($0); ++i ) {
  18.137-        c = substr ($0, i, 1)
  18.138-        if ( c ~ /[a-zA-Z0-9.-]/ ) {
  18.139-        encoded = encoded c     # safe character
  18.140-        } else if ( c == " " ) {
  18.141-        encoded = encoded "+"   # special handling
  18.142-        } else {
  18.143-        # unsafe character, encode it as a two-digit hex-number
  18.144-        lo = ord [c] % 16
  18.145-        hi = int (ord [c] / 16);
  18.146-        encoded = encoded "%" hextab [hi] hextab [lo]
  18.147-        }
  18.148-    }
  18.149-    if ( EncodeEOL ) {
  18.150-        printf ("%s", encoded EOL)
  18.151-    } else {
  18.152-        print encoded
  18.153-    }
  18.154-    }
  18.155-    END {
  18.156-        #if ( EncodeEOL ) print ""
  18.157-    }
  18.158-' $* 
  18.159-}
  18.160+fn url_encode { /bin/urlencode $* }
  18.161 
  18.162 # Cookies
  18.163 fn set_cookie {
  18.164@@ -165,10 +128,10 @@
  18.165 
  18.166 
  18.167 fn static_file {
  18.168-    echo 'Content-Type: '`{select_mime $1}
  18.169+    echo -n 'Content-Type: '
  18.170+    select_mime $1
  18.171     echo
  18.172-    cat $1
  18.173-    exit
  18.174+    exec cat $1
  18.175 }
  18.176 
  18.177 fn select_mime {
    20.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2+++ b/bin/contrib/rc-httpd/handlers/__mkfstmp	Thu Feb 04 15:05:05 2016 -0500
    20.3@@ -0,0 +1,14 @@
    20.4+#!/bin/rc
    20.5+cgiargs=$*
    20.6+
    20.7+fn error{
    20.8+	if(~ $1 404)
    20.9+		exec cgi $cgiargs
   20.10+	if not
   20.11+		$rc_httpd_dir/handlers/error $1
   20.12+}
   20.13+
   20.14+if(~ $location */)
   20.15+	exec cgi $cgiargs
   20.16+if not
   20.17+	exec serve-static
    21.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2+++ b/bin/contrib/rc-httpd/handlers/authorize	Thu Feb 04 15:05:05 2016 -0500
    21.3@@ -0,0 +1,6 @@
    21.4+#!/bin/rc
    21.5+if(~ $REMOTE_USER ''){
    21.6+	extra_headers=($extra_headers 'WWW-Authenticate: Basic realm="'$"SERVER_NAME'"')
    21.7+	error 401
    21.8+	exit
    21.9+}
    22.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2+++ b/bin/contrib/rc-httpd/handlers/cgi	Thu Feb 04 15:05:05 2016 -0500
    22.3@@ -0,0 +1,46 @@
    22.4+#!/bin/rc
    22.5+fn filter_headers{
    22.6+	response=(200 OK)
    22.7+	lines=''
    22.8+	done=false
    22.9+	while(~ $done false){
   22.10+		line=`{getline}
   22.11+		head=`{echo $line | awk '{print tolower($1)}'}
   22.12+		if(~ $head status:*)
   22.13+			response=`{echo $line | awk '{$1="" ; print}'}
   22.14+		if not if(~ $line '')
   22.15+			done=true
   22.16+		if not
   22.17+			lines=$"lines^$"line^$cr^'
   22.18+'
   22.19+	}
   22.20+	echo 'HTTP/1.1' $"response^$cr
   22.21+	echo -n $"lines
   22.22+	do_log $response(1)
   22.23+}
   22.24+
   22.25+fn run_cgi {
   22.26+	path=$cgi_path exec $"cgi_bin $params || echo 'Status: 500'
   22.27+}
   22.28+
   22.29+cgi_bin=$1
   22.30+cgi_dir=.
   22.31+if(! ~ $#* 1)
   22.32+	cgi_dir=$*($#*)
   22.33+if not if(~ $"cgi_bin /*){
   22.34+	cgi_dir=`{basename -d $"cgi_bin}
   22.35+	cgi_dir=$"cgi_dir
   22.36+}
   22.37+if(! ~ $"cgi_bin */*)
   22.38+	cgi_bin=./$"cgi_bin
   22.39+if(! builtin cd $"cgi_dir >[2]/dev/null || ! test -x $"cgi_bin){
   22.40+	error 500
   22.41+	exit
   22.42+}
   22.43+
   22.44+run_cgi | {
   22.45+	filter_headers
   22.46+	emit_extra_headers
   22.47+	echo $cr
   22.48+	exec cat
   22.49+}
    23.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2+++ b/bin/contrib/rc-httpd/handlers/dir-index	Thu Feb 04 15:05:05 2016 -0500
    23.3@@ -0,0 +1,111 @@
    23.4+#!/bin/rc
    23.5+PATH_INFO=`{echo $PATH_INFO | urlencode -d}
    23.6+full_path=$"FS_ROOT^$"PATH_INFO
    23.7+full_path=$"full_path
    23.8+if(! test -d $full_path){
    23.9+	error 404
   23.10+	exit
   23.11+}
   23.12+if(! test -r $full_path -x $full_path){
   23.13+	error 503
   23.14+	exit
   23.15+}
   23.16+do_log 200
   23.17+builtin cd $full_path
   23.18+if(~ $"NOINDEXFILE ^ $"NOINDEX ''){
   23.19+	ifile=index.htm*
   23.20+	if(! ~ $ifile(1) *'*'){
   23.21+		PATH_INFO=$ifile(1)
   23.22+		FS_ROOT=''
   23.23+		exec serve-static
   23.24+	}
   23.25+}
   23.26+title=`{echo $SITE_TITLE | sed s,%s,^$"PATH_INFO^,}
   23.27+title=$"title
   23.28+lso=()
   23.29+switch($2){
   23.30+case size
   23.31+	# ls has no option to sort by size
   23.32+	# could pipe it through sort, I suppose
   23.33+case date
   23.34+	lso=-t
   23.35+}
   23.36+echo 'HTTP/1.1 200 OK'^$cr
   23.37+emit_extra_headers
   23.38+echo 'Content-type: text/html'^$cr
   23.39+echo $cr
   23.40+echo '<html>
   23.41+<head>
   23.42+<title>'^$title^'</title>
   23.43+<style type="text/css">
   23.44+	.size {
   23.45+		text-align: right;
   23.46+		padding-right: 4pt;
   23.47+	}
   23.48+	.day {
   23.49+		text-align: right;
   23.50+		padding-right: 3pt;
   23.51+	}
   23.52+	.datetime {
   23.53+		text-align: right;
   23.54+	}
   23.55+	.name {
   23.56+		text-align: right;
   23.57+		padding-left: 3pt;
   23.58+	}
   23.59+</style>
   23.60+</head>
   23.61+<body>'
   23.62+echo '<h1>'^$title^'</h1>'
   23.63+if(! ~ $PATH_INFO /)
   23.64+	echo '<a href="../">Parent directory</a>'
   23.65+echo '<table>'
   23.66+ls -lQ $lso | awk '
   23.67+function urlencode(loc){
   23.68+	# very minimal encoding, just enough for our static-file purposes
   23.69+	url=loc
   23.70+	gsub("%", "%25", url)		# this one first!
   23.71+	gsub("\\$", "%24", url)
   23.72+	gsub("&", "%26", url)
   23.73+	gsub("\\+", "%2B", url)
   23.74+	gsub("\\?", "%3F", url)
   23.75+	gsub(" ", "%20", url)
   23.76+	gsub("\"", "%22", url)
   23.77+	gsub("#", "%23", url)
   23.78+	return url
   23.79+}
   23.80+function hrsize(size){
   23.81+	if(size > 1073741824) return sprintf("%.1fGB", size/1073741824)
   23.82+	if(size > 10485760) return sprintf("%iMB", size/1048576)
   23.83+	if(size > 1048576) return sprintf("%.1fMB", size/1048576)
   23.84+	if(size > 10240) return sprintf("%iKB", size/1024)
   23.85+	if(size > 1024) return sprintf("%.1fKB", size/1024)
   23.86+	return sprintf("%iB", size)
   23.87+}
   23.88+/^(-|a)/ {
   23.89+	print "<tr>"
   23.90+	print "<td class=\"size\">"hrsize($6)"</td>"
   23.91+	print "<td class=\"month\">"$7"</td>"
   23.92+	print "<td class=\"day\">"$8"</td>"
   23.93+	print "<td class=\"datetime\">"$9"</td>"
   23.94+	$1="" ; $2="" ; $3="" ; $4="" ; $5="" ; $6="" ; $7="" ; $8="" ; $9=""
   23.95+	sub("^ *?", "")
   23.96+	print "<td><a class=\"file name\" href=\""urlencode($0)"\">"$0"</a></td>"
   23.97+	print "</tr>"
   23.98+	$0=""
   23.99+}
  23.100+/^d/ {
  23.101+	print "<tr>"
  23.102+	print "<td class=\"size\"> </td>"
  23.103+	print "<td class=\"month\">"$7"</td>"
  23.104+	print "<td class=\"day\">"$8"</td>"
  23.105+	print "<td class=\"datetime\">"$9"</td>"
  23.106+	$1="" ; $2="" ; $3="" ; $4="" ; $5="" ; $6="" ; $7="" ; $8="" ; $9=""
  23.107+	sub("^ *?", "")
  23.108+	print "<td><a class=\"dir name\" href=\""urlencode($0)"/\">"$0"/</a></td>"
  23.109+	print "</tr>"
  23.110+}'
  23.111+echo '</table>
  23.112+
  23.113+</body>
  23.114+</html>'
    24.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2+++ b/bin/contrib/rc-httpd/handlers/error	Thu Feb 04 15:05:05 2016 -0500
    24.3@@ -0,0 +1,43 @@
    24.4+#!/bin/rc
    24.5+# DO NOT make this script callable directly from the web!
    24.6+fn do_error{
    24.7+	echo 'HTTP/1.1 '^$1^$cr
    24.8+	emit_extra_headers
    24.9+	echo 'Content-type: text/html'^$cr
   24.10+	echo $cr
   24.11+	echo '<html>
   24.12+<head>
   24.13+<title>'^$1^'</title>
   24.14+</head>
   24.15+<body>
   24.16+<h1>'^$1^'</h1>'
   24.17+	echo $2
   24.18+	echo '<p><i>rc-httpd at' $SERVER_NAME '</i>'
   24.19+	echo '
   24.20+	</body>
   24.21+	</html>
   24.22+	'
   24.23+}
   24.24+
   24.25+fn 401{
   24.26+	do_error '401 Unauthorized' \
   24.27+	'The requested path '^$"location^' requires authorization.'
   24.28+}
   24.29+
   24.30+fn 404{
   24.31+	do_error '404 Not Found' \
   24.32+	'The requested path '^$"location^' was not found on this server.'
   24.33+}
   24.34+
   24.35+fn 500{
   24.36+	do_error '500 Internal Server Error' \
   24.37+	'The server has encountered an internal misconfiguration and is unable to satisfy your request.'
   24.38+}
   24.39+
   24.40+fn 503{
   24.41+	do_error '503 Forbidden' \
   24.42+	'You do not have permission to access '^$"location^' on this server.'
   24.43+}
   24.44+
   24.45+do_log $1
   24.46+$1
    25.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2+++ b/bin/contrib/rc-httpd/handlers/redirect	Thu Feb 04 15:05:05 2016 -0500
    25.3@@ -0,0 +1,30 @@
    25.4+#!/bin/rc
    25.5+if(~ $#2 0){
    25.6+	error 500
    25.7+	exit
    25.8+}
    25.9+switch($1){
   25.10+case perm*
   25.11+	do_log 301
   25.12+	echo 'HTTP/1.1 301 Moved Permanently'^$cr
   25.13+case temp*
   25.14+	do_log 302
   25.15+	echo 'HTTP/1.1 302 Moved Temporarily'^$cr
   25.16+case seeother
   25.17+	do_log 303
   25.18+	echo 'HTTP/1.1 303 See Other'^$cr
   25.19+case *
   25.20+	error 500
   25.21+	exit
   25.22+}
   25.23+echo 'Location: ' ^ $2 ^ $cr
   25.24+emit_extra_headers
   25.25+echo 'Content-type: text/html'^$cr
   25.26+echo $cr
   25.27+echo '<html><body>'
   25.28+if(~ $#3 0)
   25.29+	echo 'Browser did not accept redirect.'
   25.30+if not
   25.31+	echo $3
   25.32+echo '<a href="'^$"location^'/">Click here</a>'
   25.33+echo '</body></html>'
    26.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2+++ b/bin/contrib/rc-httpd/handlers/serve-static	Thu Feb 04 15:05:05 2016 -0500
    26.3@@ -0,0 +1,43 @@
    26.4+#!/bin/rc
    26.5+full_path=`{echo $"FS_ROOT^$"PATH_INFO | urlencode -d}
    26.6+full_path=$"full_path
    26.7+if(~ $full_path */)
    26.8+	error 503
    26.9+if(test -d $full_path){
   26.10+	redirect perm $"location^'/' \
   26.11+		'URL not quite right, and browser did not accept redirect.'
   26.12+	exit
   26.13+}
   26.14+if(! test -e $full_path){
   26.15+	error 404
   26.16+	exit
   26.17+}
   26.18+if(! test -r $full_path){
   26.19+	error 503
   26.20+	exit
   26.21+}
   26.22+do_log 200
   26.23+switch($full_path){
   26.24+case *.html *.htm
   26.25+        type=text/html
   26.26+case *.css
   26.27+        type=text/css
   26.28+case *.txt
   26.29+        type='text/plain; charset=utf-8'
   26.30+case *.jpg *.jpeg
   26.31+        type=image/jpeg
   26.32+case *.gif
   26.33+        type=image/gif
   26.34+case *.png
   26.35+        type=image/png
   26.36+case *
   26.37+        type=`{file -m $full_path}
   26.38+}
   26.39+max_age=3600	# 1 hour
   26.40+echo 'HTTP/1.1 200 OK'^$cr
   26.41+emit_extra_headers
   26.42+echo 'Content-type: '^$type^'; charset=utf-8'^$cr
   26.43+echo 'Content-length: '^`{ls -l $full_path | awk '{print $6}'}
   26.44+echo 'Cache-control: max-age='^$max_age^$cr
   26.45+echo $cr
   26.46+exec cat $full_path
    27.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2+++ b/bin/contrib/rc-httpd/handlers/static-or-cgi	Thu Feb 04 15:05:05 2016 -0500
    27.3@@ -0,0 +1,14 @@
    27.4+#!/bin/rc
    27.5+cgiargs=$*
    27.6+
    27.7+fn error{
    27.8+	if(~ $1 404)
    27.9+		exec cgi $cgiargs
   27.10+	if not
   27.11+		$rc_httpd_dir/handlers/error $1
   27.12+}
   27.13+
   27.14+if(~ $location */)
   27.15+	exec cgi $cgiargs
   27.16+if not
   27.17+	exec serve-static
    28.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2+++ b/bin/contrib/rc-httpd/handlers/static-or-index	Thu Feb 04 15:05:05 2016 -0500
    28.3@@ -0,0 +1,5 @@
    28.4+#!/bin/rc
    28.5+if(~ $PATH_INFO */)
    28.6+	exec dir-index $params
    28.7+if not
    28.8+	exec serve-static
    29.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2+++ b/bin/contrib/rc-httpd/rc-httpd	Thu Feb 04 15:05:05 2016 -0500
    29.3@@ -0,0 +1,101 @@
    29.4+#!/bin/rc
    29.5+rc_httpd_dir=/rc/bin/rc-httpd
    29.6+path=(/bin $rc_httpd_dir/handlers)
    29.7+cgi_path=/bin
    29.8+SERVER_PORT=80 # default for CGI scripts, may be overridden by the Host header
    29.9+extra_headers='Server: rc-httpd'
   29.10+cr=
   29.11+
   29.12+fn do_log{
   29.13+	echo `{date} :: $SERVER_NAME :: $request :: \
   29.14+	$HTTP_USER_AGENT :: $1 :: $HTTP_REFERER >[1=2]
   29.15+}
   29.16+
   29.17+fn emit_extra_headers{
   29.18+	for(header in $extra_headers)
   29.19+		echo $"header^$cr
   29.20+}
   29.21+
   29.22+fn getline{ read | sed 's/'^$"cr^'$//g' }
   29.23+
   29.24+fn terminate{
   29.25+	echo `{date} connection terminated >[1=2]
   29.26+	exit terminate
   29.27+}
   29.28+
   29.29+fn trim_input{ read -c $CONTENT_LENGTH }
   29.30+
   29.31+request=`{getline}
   29.32+if(~ $#request 0)
   29.33+	terminate
   29.34+REQUEST_METHOD=$request(1)
   29.35+REQUEST_URI=$request(2)
   29.36+reqlines=''
   29.37+HTTP_COOKIE=''
   29.38+REMOTE_USER=''
   29.39+done=false
   29.40+chunked=no
   29.41+while(~ $"done false){
   29.42+	line=`{getline}
   29.43+	if(~ $#line 0)
   29.44+		done=true
   29.45+	reqlines=$"reqlines$"line'
   29.46+'
   29.47+	h=`{echo $line | awk '{print tolower($1)}'}
   29.48+	switch($h){
   29.49+	case ''
   29.50+		done=true
   29.51+	case host:
   29.52+		SERVER_NAME=$line(2)
   29.53+	case referer:
   29.54+		HTTP_REFERER=$line(2)
   29.55+	case user-agent:
   29.56+		HTTP_USER_AGENT=`{echo $line | sed 's;[^:]+:[ 	]+;;'}
   29.57+	case content-length:
   29.58+		CONTENT_LENGTH=$line(2)
   29.59+	case content-type:
   29.60+		CONTENT_TYPE=$line(2)
   29.61+	case cookie:
   29.62+		cookie=`{echo $line | sed 's;^[^:]+:[ 	]*;;'}
   29.63+		HTTP_COOKIE=$"HTTP_COOKIE^$"cookie^'; '
   29.64+	case authorization:
   29.65+		REMOTE_USER=`{auth/httpauth $line(3)}
   29.66+	case transfer-encoding:
   29.67+		~ $line(2) chunked && chunked=yes
   29.68+	}
   29.69+}
   29.70+if(~ $REQUEST_URI *://* //*){
   29.71+	SERVER_NAME=`{echo $REQUEST_URI | sed '
   29.72+		s;^[^:]+:;;
   29.73+		s;^//([^/]+).*;\1;'}
   29.74+	REQUEST_URI=`{echo $REQUEST_URI | sed '
   29.75+		s;^[^:]+:;;
   29.76+		s;^//[^/]+/?;/;'}
   29.77+}
   29.78+QUERY_STRING=`{echo $REQUEST_URI | sed 's;[^?]*\??;;'}
   29.79+params=`{echo $QUERY_STRING | sed 's;\+; ;g'}
   29.80+location=`{echo $REQUEST_URI | sed 's;\?.*;;'}
   29.81+location=`{echo $location | sed '
   29.82+	s;[^/]+/\.\./;/;g
   29.83+	s;/\./;/;g
   29.84+	s;//+;/;g
   29.85+'}
   29.86+SERVER_NAME=`{echo $SERVER_NAME | sed 's;^(\[[^\]]+\]|[^:]+)\:([0-9]+)$;\1 \2;'}
   29.87+if(~ $#SERVER_NAME 2){
   29.88+	SERVER_PORT=$SERVER_NAME(2)
   29.89+	SERVER_NAME=$SERVER_NAME(1)
   29.90+}
   29.91+if(~ $REQUEST_METHOD (PUT POST)){
   29.92+	if(! ~ $"CONTENT_LENGTH '')
   29.93+		trim_input | exec $rc_httpd_dir/select-handler
   29.94+	if not{
   29.95+		if(~ $chunked yes){
   29.96+			echo 'HTTP/1.1 411 Length required'^$cr
   29.97+			echo $cr
   29.98+			exit
   29.99+		}
  29.100+		exec $rc_httpd_dir/select-handler
  29.101+	}
  29.102+}
  29.103+if not
  29.104+	. $rc_httpd_dir/select-handler
    30.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2+++ b/bin/contrib/rc-httpd/select-handler	Thu Feb 04 15:05:05 2016 -0500
    30.3@@ -0,0 +1,177 @@
    30.4+#!/bin/rc
    30.5+# 2016-02-01T19:31:03-0500
    30.6+rfork n
    30.7+fn do_error{
    30.8+	do_log $1
    30.9+	echo 'HTTP/1.1 '^$1^$cr
   30.10+	emit_extra_headers
   30.11+	echo 'Content-type: text/html'^$cr
   30.12+	echo $cr
   30.13+	echo '<html>
   30.14+<head>
   30.15+<title>'^$1^'</title>
   30.16+</head>
   30.17+<body>
   30.18+<h1>'^$1^'</h1>'
   30.19+	echo $2
   30.20+	echo '<p><i>rc-httpd at' $SERVER_NAME '</i>'
   30.21+	echo '
   30.22+	</body>
   30.23+	</html>
   30.24+	'
   30.25+}
   30.26+
   30.27+fn http_redirect {
   30.28+    if(~ $1 http://* https://*)
   30.29+        t=$1
   30.30+    if not if(~ $1 /*)
   30.31+        t=$"base_url^$1
   30.32+    if not
   30.33+        t=$"base_url^$"req_path^$1
   30.34+    exec /bin/echo 'Status: '^$2^'
   30.35+Location: '^$t^'
   30.36+
   30.37+'
   30.38+    exit
   30.39+}
   30.40+
   30.41+fn okstatic{
   30.42+	full_path=`{echo $"FS_ROOT^$"PATH_INFO | urlencode -d}
   30.43+	full_path=$"full_path
   30.44+	if(~ $full_path */)
   30.45+		error 503
   30.46+	if(test -d $full_path){
   30.47+		redirect perm $"location^'/' \
   30.48+			'URL not quite right, and browser did not accept redirect.'
   30.49+		exit
   30.50+	}
   30.51+	if(! test -e $full_path){
   30.52+		error 404
   30.53+		exit
   30.54+	}
   30.55+	if(! test -r $full_path){
   30.56+		error 503
   30.57+		exit
   30.58+	}
   30.59+	do_log 200
   30.60+	type='text/plain'
   30.61+	max_age=3600	# 1 hour
   30.62+	echo 'HTTP/1.1 200 OK'^$cr
   30.63+	emit_extra_headers
   30.64+	echo 'Content-type: '^$type^'; charset=utf-8'^$cr
   30.65+	echo 'Content-length: '^`{ls -l $full_path | awk '{print $6}'}
   30.66+	echo 'Cache-control: max-age='^$max_age^$cr
   30.67+	echo $cr
   30.68+	exec cat $full_path
   30.69+}
   30.70+
   30.71+# surprise!
   30.72+if(~ $HTTP_REFERER *hiphopstan.com/forum* *slax.*/forum*){
   30.73+	PATH_INFO=$location
   30.74+	FS_ROOT=/usr/sl/www/werc/sites/hotlink
   30.75+	exec static-or-index
   30.76+}
   30.77+if(~ $HTTP_REFERER 'http://okturing.com/index.rc?start=100' || {~ $SERVER_NAME okturing.com && ~ $location /index.rc} || ~ $location /qemu/plan9.flp.gz){
   30.78+	do_error '402 PAYMENT REQUIRED'
   30.79+	exit
   30.80+}
   30.81+if(~ $location /*/wp-admin* /wiki/index.php* /wp/wp-admin* /wp-config* /wp-content/* wp-login.php* /admin.php* /index.php/admin* /phpinfo.php* /phpMyAdmin/* /phpMyAdmin-2/* /*xmlrpc.php){
   30.82+	do_error '402 PAYMENT REQUIRED'
   30.83+	exit
   30.84+}
   30.85+
   30.86+# build environment and namespace
   30.87+SERVER_NAME=`{echo $SERVER_NAME | sed 's/^www\.//g'}
   30.88+
   30.89+if(~ $location *~nis*)
   30.90+	location=`{echo $location | sed 's/\/\~nis/\/_nis/g'}
   30.91+
   30.92+if(~ $SERVER_NAME 9front.org){
   30.93+	bind /usr/sl/plan9front /usr/sl/www/werc/sites/9front.org/9front
   30.94+	bind /usr/sl/www/werc/sites/9front.org/_werc/pub/style.css /usr/sl/www/werc/pub/style/style.css
   30.95+	bind /usr/sl/www/werc/sites/plan9.stanleylieber.com/src /usr/sl/www/werc/sites/9front.org/extra
   30.96+	aux/stub -d /usr/sl/www/werc/sites/9front.org/extra/rc
   30.97+	bind /usr/sl/www/werc/sites/plan9.stanleylieber.com/rc /usr/sl/www/werc/sites/9front.org/extra/rc
   30.98+	bind /usr/sl/www/werc/sites/bell-labs.co/9front/iso /usr/sl/www/werc/sites/9front.org/iso
   30.99+	bind /usr/sl/www/werc/sites/plan9.stanleylieber.com/pkg /usr/sl/www/werc/sites/9front.org/pkg
  30.100+	if(~ $location /who/*){
  30.101+		for(i in Aram aiju alvaro cinap_lenrek eekee erik joy kenji lf94 martian67 mveety rminnich sl)
  30.102+		bind /usr/sl/www/werc/sites/9front.org/$i /usr/sl/www/werc/sites/9front.org/who/$i/index.txt
  30.103+	}
  30.104+	aux/stub /usr/sl/www/werc/sites/9front.org/9front.torrent
  30.105+	bind /usr/sl/www/werc/sites/bell-labs.co/9front/iso/9front-5048.e16a172bcae6.iso.bz2.torrent /usr/sl/www/werc/sites/9front.org/9front.torrent
  30.106+	if(~ $location /list.html)
  30.107+		location=/lists.html
  30.108+}
  30.109+if(~ $SERVER_NAME bugs.9front.org){
  30.110+	bind /usr/sl/www/werc/sites/bugs.9front.org/_werc/pub/style.css /usr/sl/www/werc/pub/style/style.css
  30.111+	bind -a /usr/bugs /usr/sl/www/werc/sites/bugs.9front.org
  30.112+	if(~ $location /closed/[a-z0-9]* /open/[a-z0-9]*){
  30.113+		d=`{basename -d $location}
  30.114+		aux/stub /usr/sl/www/werc/sites/bugs.9front.org^$d^/index.md
  30.115+		bind /usr/bugs^$d^/readme /usr/sl/www/werc/sites/bugs.9front.org^$d^/index.md
  30.116+	}
  30.117+}
  30.118+if(~ $SERVER_NAME fqa.9front.org){
  30.119+	#location=`{echo $"location | sed 's/^(fqa|appendix).*\.html$//g'}
  30.120+}
  30.121+if(~ $SERVER_NAME lists.9front.org){
  30.122+	for(i in 9atom 9changes 9fans 9front 9front-bugs 9front-commits 9front-sysinfo 9nag acme-sac cat-v cypherpunks dlr harvey harvey-commits harvey-issues inferno nix plan9port-dev sam-fans sierra31 skunk-works tscm-l tuhs werc www-html www-talk www-vrml)
  30.123+		bind /mail/box/$i/mbox /usr/sl/www/werc/sites/lists.9front.org/$i
  30.124+}
  30.125+if(~ $SERVER_NAME wiki.9front.org)
  30.126+	bind /usr/sl/www/werc/sites/wiki.9front.org/_werc/pub/style.css /usr/sl/www/werc/pub/style/style.css
  30.127+if(~ $SERVER_NAME golang.cat-v.org)
  30.128+	bind /usr/sl/www/werc/sites/go-lang.cat-v.org /usr/sl/www/werc/sites/golang.cat-v.org
  30.129+if(~ $SERVER_NAME plan9.stanleylieber.com){
  30.130+	bind /usr/sl/www/werc/sites/plan9.stanleylieber.com/_werc/pub/style.css /usr/sl/www/werc/pub/style/style.css
  30.131+	bind /mail/lib /usr/sl/www/werc/sites/plan9.stanleylieber.com/mail/lib
  30.132+	bind /sys/lib/dist/mail/lib/names.local /usr/sl/www/werc/sites/plan9.stanleylieber.com/mail/lib/names.local
  30.133+	bind /rc/bin/service.crazy/tcp587 /usr/sl/www/werc/sites/plan9.stanleylieber.com/mail/service/tcp587
  30.134+	bind /rc/bin/service.crazy/tcp993 /usr/sl/www/werc/sites/plan9.stanleylieber.com/mail/service/tcp993
  30.135+	bind /rc/bin/rc-httpd/select-handler /usr/sl/www/werc/sites/plan9.stanleylieber.com/rc-httpd/select-handler
  30.136+	bind /rc/bin/service.crazy/tcp80 /usr/sl/www/werc/sites/plan9.stanleylieber.com/rc-httpd/tcp80
  30.137+	bind /rc/bin/service.crazy/tcp443 /usr/sl/www/werc/sites/plan9.stanleylieber.com/rc-httpd/tcp443
  30.138+}
  30.139+
  30.140+# route requests
  30.141+if(~ $SERVER_NAME okturing.com && ~ $location /src/*/body){
  30.142+	PATH_INFO=$location
  30.143+	FS_ROOT=/usr/sl/www/werc/sites/okturing.com
  30.144+	okstatic
  30.145+}
  30.146+if not if(~ $SERVER_NAME emma.stanleylieber.com fqa.* gl.* iawtp.com ln.* lists.* mold.dk nm.* nsacom.net osuny.co.uk osx.* ph.* pop.* pp.* qualitycountrylyrics.com ragnarok.* tcasey.* tip.9front.org tn.* ur.* volksutils.com weekly.9front.org zeroxpark.com || ~ $location /cbz/* /favicon.ico /img/* /pdf/* /src/* /txt/*){
  30.147+	PATH_INFO=$location
  30.148+	FS_ROOT=/usr/sl/www/werc/sites/$SERVER_NAME
  30.149+	exec static-or-index
  30.150+}
  30.151+if not if(~ $SERVER_NAME *bell-labs.co){
  30.152+	bind -a /usr/sl/www/werc/sites/9front.org/who /usr/sl/www/werc/sites/bell-labs.co/who
  30.153+	PATH_INFO=$location
  30.154+	FS_ROOT=/usr/sl/www/werc/sites/bell-labs.co
  30.155+	exec static-or-index
  30.156+}
  30.157+if not if(~ $SERVER_NAME ttr.inri.net){
  30.158+	PATH_INFO=$location
  30.159+	FS_ROOT=/usr/sl/t
  30.160+	exec static-or-index
  30.161+}
  30.162+if not if(~ $SERVER_NAME vr.stanleylieber.com){
  30.163+	if(~ $location / /bin/* /etc/* /*htaccess /*htpasswd /index.rc* /lib/* /stats/*){
  30.164+		PATH_INFO=$location
  30.165+		FS_ROOT=/usr/sl/www/werc/sites/vr.stanleylieber.com
  30.166+		exec cgi /usr/sl/www/werc/sites/vr.stanleylieber.com/index.rc $*
  30.167+	}
  30.168+	if not{
  30.169+		PATH_INFO=$location
  30.170+		FS_ROOT=/usr/sl/www/werc/sites/vr.stanleylieber.com
  30.171+		exec static-or-index
  30.172+	}
  30.173+}
  30.174+if not if(~ $SERVER_NAME *){
  30.175+	PATH_INFO=$location
  30.176+	FS_ROOT=/usr/sl/www/werc/sites/$SERVER_NAME
  30.177+	exec static-or-cgi /usr/sl/www/werc/bin/werc.rc
  30.178+}
  30.179+if not
  30.180+	error 503
    31.1--- a/bin/contrib/urldecode.awk	Sun Aug 19 01:16:10 2012 +0200
    31.2+++ b/bin/contrib/urldecode.awk	Thu Feb 04 15:05:05 2016 -0500
    31.3@@ -1,4 +1,4 @@
    31.4-#!/usr/bin/awk -f
    31.5+#!/bin/awk -f
    31.6 BEGIN {
    31.7 	hextab ["0"] = 0; hextab ["8"] = 8;
    31.8 	hextab ["1"] = 1; hextab ["9"] = 9;
    34.1--- a/bin/corehandlers.rc	Sun Aug 19 01:16:10 2012 +0200
    34.2+++ b/bin/corehandlers.rc	Thu Feb 04 15:05:05 2016 -0500
    34.3@@ -75,9 +75,9 @@
    34.4     d=`{basename -d $1}
    34.5     if(~ $#d 0)
    34.6         d='/'
    34.7-    echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; s/[\-_]/ /g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
    34.8+    echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
    34.9     # Symlinks suck: '/.' forces ls to list the linked dir if $d is a symlink.
   34.10-    ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{match($0, "/[^/]*/?$"); l=substr($0, RSTART+1, RLENGTH-1);n=l; gsub(/[\-_]/, " ", n); print "<li><a href=\""l"\">"n"</a></li>"; }' | uniq
   34.11+    ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'
   34.12     echo '</ul>'
   34.13 }
   34.14 
   34.15@@ -121,13 +121,8 @@
   34.16     # Dir listing
   34.17     if not if(~ $local_path */index) {
   34.18         handler_body_main=(dir_listing_handler $req_path)
   34.19-        if(test -f $sitedir$req_path'_header.md') {
   34.20-            t=`{get_file_title $sitedir$req_path'_header.md'}
   34.21-            if(! ~ $"t '')
   34.22-                pageTitle=$t
   34.23-
   34.24-            ll_add handlers_body_head md_handler $sitedir$req_path'_header.md' 
   34.25-        }
   34.26+        if(test -f $sitedir$req_path'_header.md')
   34.27+            ll_add handlers_body_head md_handler $sitedir$req_path'_header.md'            
   34.28         if(test -f $sitedir$req_path'_footer.md')
   34.29             ll_add handlers_body_foot md_handler $sitedir$req_path'_footer.md'            
   34.30     }
    35.1--- a/bin/fltr_cache.rc	Sun Aug 19 01:16:10 2012 +0200
    35.2+++ b/bin/fltr_cache.rc	Thu Feb 04 15:05:05 2016 -0500
    35.3@@ -1,4 +1,4 @@
    35.4-#!/usr/bin/env rc
    35.5+#!/bin/rc
    35.6 
    35.7 fn fltr_cache {
    35.8     a=()
    36.1--- a/bin/template.awk	Sun Aug 19 01:16:10 2012 +0200
    36.2+++ b/bin/template.awk	Thu Feb 04 15:05:05 2016 -0500
    36.3@@ -1,4 +1,4 @@
    36.4-#!/usr/bin/awk -f
    36.5+#!/bin/awk -f
    36.6 function pr(str) {
    36.7 	if(lastc !~ "[{(]")
    36.8 		gsub(/'/, "''", str)
    37.1--- a/bin/werc.rc	Sun Aug 19 01:16:10 2012 +0200
    37.2+++ b/bin/werc.rc	Thu Feb 04 15:05:05 2016 -0500
    37.3@@ -1,4 +1,4 @@
    37.4-#!/usr/local/plan9/bin/rc
    37.5+#!/bin/rc
    37.6 . ./cgilib.rc
    37.7 . ./werclib.rc
    37.8 . ./wercconf.rc
    37.9@@ -15,7 +15,7 @@
   37.10 dirclean=' s/\.(md|html|txt)$//; '
   37.11 
   37.12 # Careful, the proper p9p path might not be set until initrc.local is sourced
   37.13-path=(. $PLAN9/bin ./bin /bin /usr/bin) 
   37.14+path=(. /bin ./bin)
   37.15 
   37.16 headers=lib/headers.tpl
   37.17 res_tail='</body></html>'
   37.18@@ -35,14 +35,14 @@
   37.19 
   37.20 fn werc_exec_request {
   37.21     site=$SERVER_NAME
   37.22-    base_url=http://$site
   37.23+    base_url=http://$site:$SERVER_PORT
   37.24     sitedir=$sitesdir/$site
   37.25     master_template=`{get_lib_file default_master.tpl}
   37.26     current_date_time=`{date}
   37.27 
   37.28     # Note: $REQUEST_URI is not officially in CGI 1.1, but seems to be de-facto
   37.29     # Note: We only urldecode %5F->'_' because some sites (stackoverflow.com?) urlencode it in their links,
   37.30-    # perhaps we should completely urldecode the whole url.
   37.31+    # perhaps we should completel urldecode the whole url.
   37.32     req_path=`{echo -n $REQUEST_URI | sed 's/\?.*//; s!//+!/!g; s/%5[Ff]/_/g; s/'^$forbidden_uri_chars^'//g; s/\.\.*/./g; 1q'}
   37.33     req_url=$base_url^$req_path
   37.34     local_path=$sitedir$req_path
   37.35@@ -61,15 +61,9 @@
   37.36     if(~ $local_path */) {
   37.37         if(test -d $local_path)
   37.38             local_path=$local_path^'index'
   37.39-
   37.40-	# If path has a trailing /, and a plain file exists matching that 'name.*'
   37.41-	# remove the traling / and redirect to 'name' .
   37.42         # XXX: This redir might step on apps with synthetic dirs.
   37.43-        if not {
   37.44-		# TODO: Maybe we should be smarter about how to check for existing files
   37.45-		if(ls `{basename -d $local_path}^'.*' >/dev/null >[2]/dev/null)
   37.46-		    perm_redirect `{echo $req_path|sed 's,/+$,,'}
   37.47-	}
   37.48+        if not if(ls `{basename -d $local_path}^* >/dev/null >[2]/dev/null)
   37.49+            perm_redirect `{echo $req_path|sed 's,/+$,,'}
   37.50     }
   37.51     if not if(~ $req_path *'.' *',' *';' *':')
   37.52         perm_redirect `{echo $req_path | sed 's/[.,;:)]$//'}
   37.53@@ -128,17 +122,17 @@
   37.54 
   37.55     for(h in $extraHttpHeaders)
   37.56         echo $h
   37.57-    echo 'Content-Type: '^$http_content_type
   37.58+    echo Content-Type: $http_content_type
   37.59     echo # End of HTTP headers
   37.60 
   37.61     if(! ~ $#debug 0)
   37.62-        dprint $"SERVER_NAME^$"REQUEST_URI - $"HTTP_USER_AGENT - $"REQUEST_METHOD - $"handler_body_main - $"master_template
   37.63+		dprint $"SERVER_NAME^$"REQUEST_URI - $"HTTP_USER_AGENT - $"REQUEST_METHOD - $"handler_body_main - $"master_template
   37.64 
   37.65     if(~ $REQUEST_METHOD HEAD)
   37.66         exit
   37.67-    
   37.68-    template $headers $master_template | awk_buffer
   37.69+
   37.70+    template $headers $master_template # | awk_buffer
   37.71     echo $res_tail
   37.72 }
   37.73 
   37.74-werc_exec_request # >[2]/tmp/wercdebug.log
   37.75+werc_exec_request
    38.1--- a/bin/werc_errlog_wrap.rc	Sun Aug 19 01:16:10 2012 +0200
    38.2+++ b/bin/werc_errlog_wrap.rc	Thu Feb 04 15:05:05 2016 -0500
    38.3@@ -1,4 +1,4 @@
    38.4-#!/usr/local/plan9/bin/rc
    38.5+#!/bin/rc
    38.6 
    38.7 # This is a wrapper script for broken http servers like recent lighttpd versions which throw away cgi's stderr.
    38.8 
    40.1--- a/bin/werclib.rc	Sun Aug 19 01:16:10 2012 +0200
    40.2+++ b/bin/werclib.rc	Thu Feb 04 15:05:05 2016 -0500
    40.3@@ -102,7 +102,7 @@
    40.4 
    40.5     # As a backup we might want to pick the first 'non-tag' text in the file with:
    40.6     if(~ $"t '')
    40.7-        t=`{sed -n -e 's/^[ 	]*(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | sed 1q}
    40.8+        t=`{sed -n -e 's/^(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | sed 1q}
    40.9 
   40.10     echo $t
   40.11 }
    45.1--- a/pub/style/style.css	Sun Aug 19 01:16:10 2012 +0200
    45.2+++ b/pub/style/style.css	Thu Feb 04 15:05:05 2016 -0500
    45.3@@ -1,330 +1,330 @@
    45.4-/* Default werc style */
    45.5-
    45.6-body {
    45.7-  color: black;
    45.8-  background-color: white;
    45.9-  font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif;
   45.10-  font-size: 84%;  /* Enables font size scaling in MSIE */
   45.11-  margin: 0;
   45.12-  padding: 0;
   45.13-}
   45.14-
   45.15-
   45.16-/* # Header # */
   45.17-.superHeader {
   45.18-  color: white;
   45.19-  background-color: rgb(100,135,220);
   45.20-  height: 1.6em;
   45.21-}
   45.22-
   45.23-.superHeader img { vertical-align: bottom; }
   45.24-
   45.25-.superHeader a {
   45.26-  color: white;
   45.27-  background-color: transparent;
   45.28-  font-size: 91%;
   45.29-  margin: 0;
   45.30-  padding: 0 0.5ex 0 0.25ex;
   45.31-}
   45.32-
   45.33-a { text-decoration: none; }
   45.34-a:hover { text-decoration: underline; }
   45.35-
   45.36-.superHeader div {
   45.37-  position: absolute;
   45.38-  top: 0.40ex;
   45.39-}
   45.40-
   45.41-.superHeader .left { left: 0.4em; }
   45.42-.superHeader .right { right: 0.4em; }
   45.43-
   45.44-.midHeader {
   45.45-  color: rgb(39,78,144);
   45.46-  background-color: rgb(140,170,230);
   45.47-  background-color: #ff6d06;
   45.48-  border: solid 0 black;
   45.49-  border-width: 2px 0;
   45.50-}
   45.51-
   45.52-.headerTitle {
   45.53-  color: black;
   45.54-  font-size: 233%;
   45.55-  font-weight: normal;
   45.56-  margin: 0 0 0 4mm;
   45.57-  padding: 0.25ex 0;
   45.58-}
   45.59-#headerSubTitle {
   45.60-  font-size: 50%;
   45.61-  font-style: italic;
   45.62-  margin-left: 1em;
   45.63-}
   45.64-
   45.65-.headerTitle a { color: black; }
   45.66-.headerTitle a:hover { text-decoration: none; }
   45.67-
   45.68-.subHeader {
   45.69-  display: none;
   45.70-  color: white;
   45.71-  background-color: rgb(0,51,153);
   45.72-  margin: 0;
   45.73-  padding: 1ex 1ex 1ex 1.5mm;
   45.74-}
   45.75-
   45.76-.subHeader a {
   45.77-  color: white;
   45.78-  background-color: transparent;
   45.79-  font-weight: bold;
   45.80-  margin: 0;
   45.81-  padding: 0 0.75ex 0 0.5ex;
   45.82-}  
   45.83-
   45.84-.superHeader .highlight, .subHeader .highlight {
   45.85-  color: rgb(253,160,91);
   45.86-  background-color: transparent;
   45.87-}
   45.88-
   45.89-
   45.90-/* # Side # */
   45.91-#side-bar {
   45.92-  width: 16em;
   45.93-  float: left;
   45.94-  clear: left;
   45.95-  border-right: 1px solid #ddd;
   45.96-}
   45.97-
   45.98-#side-bar div {
   45.99-  border-bottom: 1px solid #ddd;
  45.100-}
  45.101-
  45.102-.sideBarTitle {
  45.103-  font-weight: bold;
  45.104-  margin: 0 0 0.5em 2mm;
  45.105-  padding: 1em 0 0 0;
  45.106-}
  45.107-
  45.108-#side-bar ul {
  45.109-  list-style-type: none;
  45.110-  list-style-position: outside;
  45.111-  margin: 0;
  45.112-  padding: 0 0 0.3em 0;
  45.113-}
  45.114-
  45.115-li ul {
  45.116-  padding-left: 0.6em !important;
  45.117-}
  45.118-
  45.119-#side-bar li {
  45.120-  margin: 0;
  45.121-  padding: 0.1ex 0;  /* Circumvents a rendering bug (?) in MSIE 6.0  XXX should move to iehacks.css, this causes an ugly gap */
  45.122-}
  45.123-
  45.124-#side-bar a {
  45.125-  color: rgb(0,102,204);
  45.126-  background-color: transparent;
  45.127-  margin: 0;
  45.128-  padding: 0.25em 1ex 0.25em 2mm;
  45.129-  display: block;
  45.130-  text-transform: capitalize;
  45.131-  font-weight: bold!important;
  45.132-  font-size: 102%;
  45.133-  border-left: white solid 0.2em;
  45.134-}
  45.135-
  45.136-.thisPage, .thisPage a {
  45.137-  color: black!important;
  45.138-  background-color: white;
  45.139-  padding-left: 5mm;
  45.140-}
  45.141-
  45.142-#side-bar a:hover {
  45.143-  color: white;
  45.144-  background-color: rgb(100,135,220);
  45.145-  border-left: black solid 0.2em;
  45.146-  text-decoration: none;
  45.147-}
  45.148-
  45.149-.sideBarText {
  45.150-  line-height: 1.5em;
  45.151-  margin: 0 0 1em 0;
  45.152-  padding: 0 1.5ex 0 2.5mm;
  45.153-  display: block;
  45.154-}
  45.155-
  45.156-#side-bar .sideBarText a {
  45.157-  margin: 0;
  45.158-  padding: 0;
  45.159-  display: inline;
  45.160-}
  45.161-
  45.162-#side-bar .sideBarText a:hover {
  45.163-  color: rgb(0,102,204);
  45.164-  background-color: transparent;
  45.165-  text-decoration: none;
  45.166-}
  45.167-
  45.168-
  45.169-/* # Main Copy # */
  45.170-#main-copy {
  45.171-  max-width: 70em;
  45.172-  color: black;
  45.173-  background-color: transparent;
  45.174-  text-align: justify;
  45.175-  line-height: 1.5em;
  45.176-  margin: 0em 0 0 16em;
  45.177-  padding: 0.5mm 5mm 5mm 5mm;
  45.178-  border-left: 1px solid #ddd;
  45.179-}
  45.180-
  45.181-#bodyText {
  45.182-  margin: 0 0 0 15.5em;
  45.183-  padding: 2mm 5mm 2mm 5mm;
  45.184-}
  45.185-
  45.186-#main-copy p {
  45.187-  margin: 1em 1ex 1em 1ex !important; /* Need !important so troff-generated pages don't look totally squezed */
  45.188-  padding: 0;
  45.189-}
  45.190-
  45.191-#main-copy a {
  45.192-  color: rgb(0,102,204);
  45.193-  background-color: transparent;
  45.194-}
  45.195-
  45.196-#main-copy a:hover {
  45.197-  color:  rgb(100,135,220);
  45.198-}
  45.199-
  45.200-#main-copy h1, #main-copy h2 {
  45.201-  color: rgb(0,102,204);
  45.202-  background-color: transparent;
  45.203-  font-size: 145.5%;
  45.204-  font-weight: bold;
  45.205-  margin: 2em 0 0 0;
  45.206-  padding: 0.5ex 0 0.5ex 0.6ex;
  45.207-  border-bottom: 2px solid rgb(0,102,204);
  45.208-}
  45.209-
  45.210-#main-copy h2 {
  45.211-  font-size: 115.5%;
  45.212-  border-bottom: 1px solid rgb(0,102,204);
  45.213-}
  45.214-
  45.215-#main-copy .topOfPage {
  45.216-  color: rgb(0,102,204);
  45.217-  background-color: transparent;
  45.218-  font-size: 91%;
  45.219-  font-weight: bold;
  45.220-  text-decoration: none;
  45.221-  margin: 3ex 1ex 0 0;
  45.222-  padding: 0;
  45.223-  float: right;
  45.224-}
  45.225-
  45.226-dl {
  45.227-  margin: 1em 1ex 2em 1ex;
  45.228-  padding: 0;
  45.229-}
  45.230-
  45.231-dt {
  45.232-  font-weight: bold;
  45.233-  margin: 0 0 0 0;
  45.234-  padding: 0;
  45.235-}
  45.236-
  45.237-dd {
  45.238-  margin: 0 0 2em 2em;
  45.239-  padding: 0;
  45.240-}
  45.241-
  45.242-
  45.243-/* # Footer # */
  45.244-#footer {
  45.245-  color: white;
  45.246-  background-color: rgb(100,135,220);
  45.247-  padding: 1em;
  45.248-  clear: both;
  45.249-}
  45.250-
  45.251-#footer .left {
  45.252-  text-align: left;
  45.253-  line-height: 1.55em;
  45.254-  float: left;
  45.255-  clear: left;
  45.256-}
  45.257-
  45.258-#footer .right {
  45.259-  text-align: right;
  45.260-  line-height: 1.45em;
  45.261-}
  45.262-
  45.263-#footer a {
  45.264-  color: white;
  45.265-  background-color: transparent;
  45.266-}
  45.267-
  45.268-
  45.269-/* GENERAL */
  45.270-
  45.271-table {
  45.272-  border: solid 1px black;
  45.273-}
  45.274-th {
  45.275-  background-color: #abc;
  45.276-  border: solid 1px black;
  45.277-   text-align: center;
  45.278-}
  45.279-td {
  45.280-  background-color: #def;
  45.281-  border: solid 1px black;
  45.282-}
  45.283-
  45.284-hr {
  45.285-  border-width: 0px 0px 0.1em 0px;
  45.286-  border-color: black;
  45.287-}
  45.288-
  45.289-acronym, .titleTip {
  45.290-  border-bottom: 1px solid #ddd;
  45.291-  cursor: help;
  45.292-  margin: 0;
  45.293-  padding: 0 0 0.4px 0;
  45.294-}
  45.295-
  45.296-pre {
  45.297-  margin-left: 2em; 
  45.298-  font-size: 1.2em;
  45.299-}
  45.300-
  45.301-blockquote {
  45.302-  border-left: 1px solid blue;
  45.303-  font-style: italic;
  45.304-}
  45.305-
  45.306-.smallCaps {
  45.307-  font-size: 110%;
  45.308-  font-variant: small-caps;
  45.309-}
  45.310-
  45.311-.doNotDisplay { display: none; }
  45.312-
  45.313-
  45.314-.notify_errors,
  45.315-.notify_notes,
  45.316-.notify_success { padding: .8em; margin-bottom: 1em; border: 2px solid #ddd; }
  45.317- 
  45.318-.notify_errors { background: #FBE3E4; color: #8a1f11; border-color: #FBC2C4; }
  45.319-.notify_notes { background: #FFF6BF; color: #514721; border-color: #FFD324; }
  45.320-.notify_success { background: #E6EFC2; color: #264409; border-color: #C6D880; }
  45.321-.notify_errors a { color: #8a1f11; }
  45.322-.notify_notes a { color: #514721; }
  45.323-.notify_success a { color: #264409; }
  45.324-
  45.325-
  45.326-/* # Page/Handler specific # */
  45.327-h1.dir-list-head, ul.dir-list {
  45.328-  text-transform: capitalize;
  45.329-  font-weight: bold;
  45.330-}
  45.331-ul.sitemap-list a {
  45.332-  text-transform: capitalize;
  45.333-}
  45.334+/* Default werc style */
  45.335+
  45.336+body {
  45.337+  color: black;
  45.338+  background-color: white;
  45.339+  font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif;
  45.340+  font-size: 84%;  /* Enables font size scaling in MSIE */
  45.341+  margin: 0;
  45.342+  padding: 0;
  45.343+}
  45.344+
  45.345+
  45.346+/* # Header # */
  45.347+.superHeader {
  45.348+  color: white;
  45.349+  background-color: rgb(100,135,220);
  45.350+  height: 1.6em;
  45.351+}
  45.352+
  45.353+.superHeader img { vertical-align: bottom; }
  45.354+
  45.355+.superHeader a {
  45.356+  color: white;
  45.357+  background-color: transparent;
  45.358+  font-size: 91%;
  45.359+  margin: 0;
  45.360+  padding: 0 0.5ex 0 0.25ex;
  45.361+}
  45.362+
  45.363+a { text-decoration: none; }
  45.364+a:hover { text-decoration: underline; }
  45.365+
  45.366+.superHeader div {
  45.367+  position: absolute;
  45.368+  top: 0.40ex;
  45.369+}
  45.370+
  45.371+.superHeader .left { left: 0.4em; }
  45.372+.superHeader .right { right: 0.4em; }
  45.373+
  45.374+.midHeader {
  45.375+  color: rgb(39,78,144);
  45.376+  background-color: rgb(140,170,230);
  45.377+  background-color: #ff6d06;
  45.378+  border: solid 0 black;
  45.379+  border-width: 2px 0;
  45.380+}
  45.381+
  45.382+.headerTitle {
  45.383+  color: black;
  45.384+  font-size: 233%;
  45.385+  font-weight: normal;
  45.386+  margin: 0 0 0 4mm;
  45.387+  padding: 0.25ex 0;
  45.388+}
  45.389+#headerSubTitle {
  45.390+  font-size: 50%;
  45.391+  font-style: italic;
  45.392+  margin-left: 1em;
  45.393+}
  45.394+
  45.395+.headerTitle a { color: black; }
  45.396+.headerTitle a:hover { text-decoration: none; }
  45.397+
  45.398+.subHeader {
  45.399+  display: none;
  45.400+  color: white;
  45.401+  background-color: rgb(0,51,153);
  45.402+  margin: 0;
  45.403+  padding: 1ex 1ex 1ex 1.5mm;
  45.404+}
  45.405+
  45.406+.subHeader a {
  45.407+  color: white;
  45.408+  background-color: transparent;
  45.409+  font-weight: bold;
  45.410+  margin: 0;
  45.411+  padding: 0 0.75ex 0 0.5ex;
  45.412+}  
  45.413+
  45.414+.superHeader .highlight, .subHeader .highlight {
  45.415+  color: rgb(253,160,91);
  45.416+  background-color: transparent;
  45.417+}
  45.418+
  45.419+
  45.420+/* # Side # */
  45.421+#side-bar {
  45.422+  width: 16em;
  45.423+  float: left;
  45.424+  clear: left;
  45.425+  border-right: 1px solid #ddd;
  45.426+}
  45.427+
  45.428+#side-bar div {
  45.429+  border-bottom: 1px solid #ddd;
  45.430+}
  45.431+
  45.432+.sideBarTitle {
  45.433+  font-weight: bold;
  45.434+  margin: 0 0 0.5em 2mm;
  45.435+  padding: 1em 0 0 0;
  45.436+}
  45.437+
  45.438+#side-bar ul {
  45.439+  list-style-type: none;
  45.440+  list-style-position: outside;
  45.441+  margin: 0;
  45.442+  padding: 0 0 0.3em 0;
  45.443+}
  45.444+
  45.445+li ul {
  45.446+  padding-left: 0.6em !important;
  45.447+}
  45.448+
  45.449+#side-bar li {
  45.450+  margin: 0;
  45.451+  padding: 0.1ex 0;  /* Circumvents a rendering bug (?) in MSIE 6.0  XXX should move to iehacks.css, this causes an ugly gap */
  45.452+}
  45.453+
  45.454+#side-bar a {
  45.455+  color: rgb(0,102,204);
  45.456+  background-color: transparent;
  45.457+  margin: 0;
  45.458+  padding: 0.25em 1ex 0.25em 2mm;
  45.459+  display: block;
  45.460+  text-transform: capitalize;
  45.461+  font-weight: bold!important;
  45.462+  font-size: 102%;
  45.463+  border-left: white solid 0.2em;
  45.464+}
  45.465+
  45.466+.thisPage, .thisPage a {
  45.467+  color: black!important;
  45.468+  background-color: white;
  45.469+  padding-left: 5mm;
  45.470+}
  45.471+
  45.472+#side-bar a:hover {
  45.473+  color: white;
  45.474+  background-color: rgb(100,135,220);
  45.475+  border-left: black solid 0.2em;
  45.476+  text-decoration: none;
  45.477+}
  45.478+
  45.479+.sideBarText {
  45.480+  line-height: 1.5em;
  45.481+  margin: 0 0 1em 0;
  45.482+  padding: 0 1.5ex 0 2.5mm;
  45.483+  display: block;
  45.484+}
  45.485+
  45.486+#side-bar .sideBarText a {
  45.487+  margin: 0;
  45.488+  padding: 0;
  45.489+  display: inline;
  45.490+}
  45.491+
  45.492+#side-bar .sideBarText a:hover {
  45.493+  color: rgb(0,102,204);
  45.494+  background-color: transparent;
  45.495+  text-decoration: none;
  45.496+}
  45.497+
  45.498+
  45.499+/* # Main Copy # */
  45.500+#main-copy {
  45.501+  max-width: 70em;
  45.502+  color: black;
  45.503+  background-color: transparent;
  45.504+  text-align: justify;
  45.505+  line-height: 1.5em;
  45.506+  margin: 0em 0 0 16em;
  45.507+  padding: 0.5mm 5mm 5mm 5mm;
  45.508+  border-left: 1px solid #ddd;
  45.509+}
  45.510+
  45.511+#bodyText {
  45.512+  margin: 0 0 0 15.5em;
  45.513+  padding: 2mm 5mm 2mm 5mm;
  45.514+}
  45.515+
  45.516+#main-copy p {
  45.517+  margin: 1em 1ex 1em 1ex !important; /* Need !important so troff-generated pages don't look totally squezed */
  45.518+  padding: 0;
  45.519+}
  45.520+
  45.521+#main-copy a {
  45.522+  color: rgb(0,102,204);
  45.523+  background-color: transparent;
  45.524+}
  45.525+
  45.526+#main-copy a:hover {
  45.527+  color:  rgb(100,135,220);
  45.528+}
  45.529+
  45.530+#main-copy h1, #main-copy h2 {
  45.531+  color: rgb(0,102,204);
  45.532+  background-color: transparent;
  45.533+  font-size: 145.5%;
  45.534+  font-weight: bold;
  45.535+  margin: 2em 0 0 0;
  45.536+  padding: 0.5ex 0 0.5ex 0.6ex;
  45.537+  border-bottom: 2px solid rgb(0,102,204);
  45.538+}
  45.539+
  45.540+#main-copy h2 {
  45.541+  font-size: 115.5%;
  45.542+  border-bottom: 1px solid rgb(0,102,204);
  45.543+}
  45.544+
  45.545+#main-copy .topOfPage {
  45.546+  color: rgb(0,102,204);
  45.547+  background-color: transparent;
  45.548+  font-size: 91%;
  45.549+  font-weight: bold;
  45.550+  text-decoration: none;
  45.551+  margin: 3ex 1ex 0 0;
  45.552+  padding: 0;
  45.553+  float: right;
  45.554+}
  45.555+
  45.556+dl {
  45.557+  margin: 1em 1ex 2em 1ex;
  45.558+  padding: 0;
  45.559+}
  45.560+
  45.561+dt {
  45.562+  font-weight: bold;
  45.563+  margin: 0 0 0 0;
  45.564+  padding: 0;
  45.565+}
  45.566+
  45.567+dd {
  45.568+  margin: 0 0 2em 2em;
  45.569+  padding: 0;
  45.570+}
  45.571+
  45.572+
  45.573+/* # Footer # */
  45.574+#footer {
  45.575+  color: white;
  45.576+  background-color: rgb(100,135,220);
  45.577+  padding: 1em;
  45.578+  clear: both;
  45.579+}
  45.580+
  45.581+#footer .left {
  45.582+  text-align: left;
  45.583+  line-height: 1.55em;
  45.584+  float: left;
  45.585+  clear: left;
  45.586+}
  45.587+
  45.588+#footer .right {
  45.589+  text-align: right;
  45.590+  line-height: 1.45em;
  45.591+}
  45.592+
  45.593+#footer a {
  45.594+  color: white;
  45.595+  background-color: transparent;
  45.596+}
  45.597+
  45.598+
  45.599+/* GENERAL */
  45.600+
  45.601+table {
  45.602+  border: solid 1px black;
  45.603+}
  45.604+th {
  45.605+  background-color: #abc;
  45.606+  border: solid 1px black;
  45.607+   text-align: center;
  45.608+}
  45.609+td {
  45.610+  background-color: #def;
  45.611+  border: solid 1px black;
  45.612+}
  45.613+
  45.614+hr {
  45.615+  border-width: 0px 0px 0.1em 0px;
  45.616+  border-color: black;
  45.617+}
  45.618+
  45.619+acronym, .titleTip {
  45.620+  border-bottom: 1px solid #ddd;
  45.621+  cursor: help;
  45.622+  margin: 0;
  45.623+  padding: 0 0 0.4px 0;
  45.624+}
  45.625+
  45.626+pre {
  45.627+  margin-left: 2em; 
  45.628+  font-size: 1.2em;
  45.629+}
  45.630+
  45.631+blockquote {
  45.632+  border-left: 1px solid blue;
  45.633+  font-style: italic;
  45.634+}
  45.635+
  45.636+.smallCaps {
  45.637+  font-size: 110%;
  45.638+  font-variant: small-caps;
  45.639+}
  45.640+
  45.641+.doNotDisplay { display: none; }
  45.642+
  45.643+
  45.644+.notify_errors,
  45.645+.notify_notes,
  45.646+.notify_success { padding: .8em; margin-bottom: 1em; border: 2px solid #ddd; }
  45.647+ 
  45.648+.notify_errors { background: #FBE3E4; color: #8a1f11; border-color: #FBC2C4; }
  45.649+.notify_notes { background: #FFF6BF; color: #514721; border-color: #FFD324; }
  45.650+.notify_success { background: #E6EFC2; color: #264409; border-color: #C6D880; }
  45.651+.notify_errors a { color: #8a1f11; }
  45.652+.notify_notes a { color: #514721; }
  45.653+.notify_success a { color: #264409; }
  45.654+
  45.655+
  45.656+/* # Page/Handler specific # */
  45.657+h1.dir-list-head, ul.dir-list {
  45.658+  text-transform: capitalize;
  45.659+  font-weight: bold;
  45.660+}
  45.661+ul.sitemap-list a {
  45.662+  text-transform: capitalize;
  45.663+}