nanoweb_2.2.9/0000755000000000000000000000000011023557654011745 5ustar rootrootnanoweb_2.2.9/modules/0000755000000000000000000000000011023557654013415 5ustar rootrootnanoweb_2.2.9/modules/mod_mysqllog.php0000644000000000000000000000476311023557654016646 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_mysqllog { function mod_mysqllog() { global $conf; $this->modtype="log"; $this->modname="MySQL logging"; if (!$cid=@mysql_pconnect($conf["global"]["mysqlloghost"][0], $conf["global"]["mysqlloguser"][0], $conf["global"]["mysqllogpassword"][0])) errexit("Unable to connect to database"); mysql_close($cid); } function log_hit($vhost, $remote_host, $remote_ip, $logged_user, $http_request, $rq_err, $sent_content_length, $http_referer, $http_user_agent) { global $conf; if ($conf[$vhost]["mysqllog"][0]) $mlog=$conf[$vhost]["mysqllog"][0]; else if ($conf["global"]["mysqllog"][0]) $mlog=$conf["global"]["mysqllog"][0]; else $mlog=false; if ($mlog) { $cid=mysql_pconnect($conf["global"]["mysqlloghost"][0], $conf["global"]["mysqlloguser"][0], $conf["global"]["mysqllogpassword"][0]); mysql_select_db($conf["global"]["mysqllogdatabase"][0]); mysql_query("CREATE TABLE IF NOT EXISTS `".$mlog."` (`hit_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `hit_datetime` DATETIME NOT NULL, `hit_vhost` VARCHAR(64) NOT NULL, `hit_host` VARCHAR(128) NOT NULL, `hit_ip` VARCHAR(16) NOT NULL, `hit_authuser` VARCHAR(16) NOT NULL, `hit_request` VARCHAR(255) NOT NULL, `hit_status` INT NOT NULL, `hit_size` INT NOT NULL, `hit_referer` VARCHAR(255) NOT NULL, `hit_useragent` VARCHAR(255) NOT NULL, INDEX (`hit_vhost`))"); mysql_query("INSERT INTO `".$mlog."` VALUES (0, now(), \"".addslashes($vhost)."\", \"".addslashes($remote_host)."\", \"".addslashes($remote_ip)."\", \"".addslashes($logged_user)."\", \"".addslashes($http_request)."\", ".$rq_err.", ".$sent_content_length.", \"".addslashes($http_referer)."\", \"".addslashes($http_user_agent)."\")"); mysql_close($cid); } } } ?> nanoweb_2.2.9/modules/mod_stdlog.php0000644000000000000000000000461111023557654016263 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_stdlog { var $modtype="log"; var $modname="starndard logging"; function log_strfilter($s) { return (str_replace("\"", "\\\"", $s)); } function log_hit($vhost, $remote_host, $remote_ip, $logged_user, $http_request, $rq_err, $sent_content_length, $http_referer, $http_user_agent) { global $conf; $logline=$remote_host." - ".(($logged_user && $logged_user!=" ")?$logged_user:"-")." [".date("d/M/Y:H:i:s O")."] \"".mod_stdlog::log_strfilter($http_request)."\" ".$rq_err." ".(int)$sent_content_length; switch (strtolower($conf[$vhost]["logtype"][0])) { case "common": case "clf": $logline.="\n"; break; case "common-with-vhost": case "clf-vhost": $logline=$vhost." ".$logline."\n"; break; case "combined": default: $logline.=" \"".($http_referer?mod_stdlog::log_strfilter($http_referer):"-")."\" \"".($http_user_agent?mod_stdlog::log_strfilter($http_user_agent):"-")."\"\n"; break; } $srv_logline="[".$vhost."] ".$logline; if ($conf["global"]["loghitstoconsole"][0] && !$GLOBALS["quiet"]) echo $srv_logline; log_srv($srv_logline, NW_EL_HIT); $fdir=$conf[$vhost]["logdir"][0]; if ($fn_ar=$conf[$vhost]["log"]) foreach ($fn_ar as $fname) { if (($GLOBALS["os"]=="unix")?($fname{0}=="/"):(($fname{0}=="\\") || ($fname{1}==":"))) { $lfn=$fname; } else { $lfn=$fdir.DIRECTORY_SEPARATOR.$fname; } if ($lf=@fopen($lfn, NW_BSAFE_APP_OPEN)) { fputs($lf, $logline); fclose($lf); } else { techo("WARN: unable to write to log file '".$lfn."'", NW_EL_WARNING); } } } } ?> nanoweb_2.2.9/modules/mod_fcgi.php0000644000000000000000000001426711023557654015707 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ define(FCGI_VERSION_1, 1); define(FCGI_BEGIN_REQUEST, 1); define(FCGI_ABORT_REQUEST, 2); define(FCGI_END_REQUEST, 3); define(FCGI_PARAMS, 4); define(FCGI_STDIN, 5); define(FCGI_STDOUT, 6); define(FCGI_STDERR, 7); define(FCGI_DATA, 8); define(FCGI_GET_VALUES, 9); define(FCGI_GET_VALUES_RESULT, 10); class mod_fcgi { function mod_fcgi() { $this->modtype="parser_FCGI"; $this->modname="FastCGI support"; } function build_fcgi_packet($type, $content) { $clen=strlen($content); $packet=chr(FCGI_VERSION_1); $packet.=chr($type); $packet.=chr(0).chr(1); // Request id = 1 $packet.=chr((int)($clen/256)).chr($clen%256); // Content length $packet.=chr(0).chr(0); // No padding and reserved $packet.=$content; return($packet); } function build_fcgi_nvpair($name, $value) { $nlen = strlen($name); $vlen = strlen($value); if ($nlen < 128) { $nvpair = chr($nlen); } else { $nvpair = chr(($nlen >> 24) | 0x80) . chr(($nlen >> 16) & 0xFF) . chr(($nlen >> 8) & 0xFF) . chr($nlen & 0xFF); } if ($vlen < 128) { $nvpair .= chr($vlen); } else { $nvpair .= chr(($vlen >> 24) | 0x80) . chr(($vlen >> 16) & 0xFF) . chr(($vlen >> 8) & 0xFF) . chr($vlen & 0xFF); } return $nvpair . $name . $value; } function decode_fcgi_packet($data) { $ret["version"]=ord($data{0}); $ret["type"]=ord($data{1}); $ret["length"]=(ord($data{4}) << 8)+ord($data{5}); $ret["content"]=substr($data, 8, $ret["length"]); return($ret); } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $conf, $add_errmsg; // Connect to FastCGI server $fcgi_server=explode(":", $args); if (!$this->sck=fsockopen($fcgi_server[0], $fcgi_server[1], $errno, $errstr, 5)) { $rq_err=500; $tmperr="mod_fcgi: unable to contact application server ($errno : $errstr)."; $add_errmsg.=($tmperr."

"); techo("WARN: ".$tmperr, NW_EL_WARNING); return (false); } // Begin session $begin_rq_packet=chr(0).chr(1).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0); fwrite($this->sck, $this->build_fcgi_packet(FCGI_BEGIN_REQUEST, $begin_rq_packet)); // Build params $fcgi_params_packet.=$this->build_fcgi_nvpair("GATEWAY_INTERFACE", "FastCGI/1.0"); $nsv=nw_server_vars(); if ($conf["global"]["fcgifilterpathinfo"][0]) unset($nsv["PATH_INFO"]); foreach($nsv as $key=>$var) $fcgi_params_packet.=$this->build_fcgi_nvpair($key, $var); if ($rq_hdrs=$GLOBALS["htreq_headers"]) foreach ($rq_hdrs as $key=>$val) $fcgi_params_packet.=$this->build_fcgi_nvpair("HTTP_".str_replace("-", "_", $key),$val); if ($GLOBALS["http_action"]=="POST" && $GLOBALS["htreq_content"]) { $fcgi_params_packet.=$this->build_fcgi_nvpair("CONTENT_TYPE", $rq_hdrs["CONTENT-TYPE"]); $fcgi_params_packet.=$this->build_fcgi_nvpair("CONTENT_LENGTH", $rq_hdrs["CONTENT-LENGTH"]); $stdin_content=$GLOBALS["htreq_content"]; } else $stdin_content=""; // Send params fwrite($this->sck, $this->build_fcgi_packet(FCGI_PARAMS, $fcgi_params_packet)); fwrite($this->sck, $this->build_fcgi_packet(FCGI_PARAMS, "")); // Build and send stdin flow if ($stdin_content) fwrite($this->sck, $this->build_fcgi_packet(FCGI_STDIN, $stdin_content)); fwrite($this->sck, $this->build_fcgi_packet(FCGI_STDIN, "")); // Read answers from fastcgi server $content=""; while (($p1=strpos($content, "\r\n\r\n"))===false) { $tmpp=$this->decode_fcgi_packet($packet=fread($this->sck, 8)); $tl=$tmpp["length"]%8; $tadd=($tl?(8-$tl):0); $resp=$this->decode_fcgi_packet($packet.fread($this->sck, $tmpp["length"]+$tadd)); if ($valid_pck=($resp["type"]==FCGI_STDOUT || $resp["type"]==FCGI_STDERR)) $content.=$resp["content"]; if ($resp["type"]==FCGI_STDERR) techo("WARN: mod_fcgi: app server returned error : '".$resp["content"]."'", NW_EL_WARNING); } if (feof($this->sck)) $this->peof=true; if ($p1) { $headers=explode("\n", trim(substr($content, 0, $p1))); $content=substr($content, $p1+4); } $GLOBALS["http_resp"]=""; $cnh=access_query("fcginoheader"); foreach ($headers as $s) if ($s=trim($s)) { if (substr($s, 0, 5)=="HTTP/") { $hd_key="STATUS"; strtok($s, " "); } else { $hd_key=strtok($s, ":"); } $hd_val=trim(strtok("")); $hku=strtoupper($hd_key); if ($cnh) foreach ($cnh as $nohdr) if ($hku==strtoupper($nohdr)) $hd_key=""; if ($hd_key) { if ($hku=="SET-COOKIE") { $cgi_headers["cookies"][]=$hd_val; } else { $cgi_headers[$hd_key]=$hd_val; } } } $this->parsed_output=$content; } function parser_get_output() { if (!$this->peof && !$this->parsed_output) { $tmpp=$this->decode_fcgi_packet($packet=fread($this->sck, 8)); $tl=$tmpp["length"]%8; $tadd=($tl?(8-$tl):0); $resp=$this->decode_fcgi_packet($packet.fread($this->sck, $tmpp["length"]+$tadd)); if ($valid_pck=($resp["type"]==FCGI_STDOUT || $resp["type"]==FCGI_STDERR)) { $content.=$resp["content"]; } else { $this->peof=true; } if ($resp["type"]==FCGI_STDERR) techo("WARN: mod_fcgi: app server returned error : '".$resp["content"]."'", NW_EL_WARNING); } if ($this->parsed_output) { $content=$this->parsed_output; $this->parsed_output=""; } return($content); } function parser_eof() { return($this->peof); } function parser_close() { $this->peof=false; fclose($this->sck); } } ?> nanoweb_2.2.9/modules/mod_cgi.php0000644000000000000000000001352411023557654015534 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_cgi { var $modtype="parser_CGI"; var $modname="CGI support"; var $use_proc_open; var $request_env; var $po; var $p; var $peof; // Init function init() { // Register also as a core hook module $GLOBALS["modules"]["core_after_decode"][]=&$this; if (is_callable("proc_open")) $this->use_proc_open=true; } // After decode hook function main() { global $accessdir, $docroot, $http_uri, $pri_parser, $pri_err, $add_errmsg; if (is_file($docroot.$http_uri)) { if ($cgiscd=access_query("cgiscriptsdir")) foreach ($cgiscd as $cgidir) if (strpos(rtrim($accessdir, "/"), rtrim($cgidir, "/"))===0) { if (is_callable("is_executable")) { $isexec=is_executable($docroot.$http_uri); } else $isexec=true; if ($isexec) { $pri_parser='CGI $SCRIPT_FILENAME'; } else { switch (access_query("cgiscriptnoexec", 0)) { case "error": $pri_err=500; $add_errmsg="mod_cgi: the file is not executable

"; break; case "raw": default: } } break; } } } // Parser functions function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $conf, $os, $htreq_headers; $cgiexec=$args; if ($phpopts=access_query("cgiphpoption")) foreach ($phpopts as $opt) $cgiexec.=" -d ".$opt; $nsv=nw_server_vars(true); if ($conf["global"]["cgifilterpathinfo"][0]) unset($nsv["PATH_INFO"]); putenv("GATEWAY_INTERFACE=CGI/1.1"); foreach($nsv as $key=>$var) putenv($key."=".$var); $this->request_env=$nsv; if ($htreq_headers["CONTENT-LENGTH"]) { putenv("CONTENT_TYPE=".$htreq_headers["CONTENT-TYPE"]); putenv("CONTENT_LENGTH=".$htreq_headers["CONTENT-LENGTH"]); if ($this->use_proc_open) { $ds=array(0 => array("pipe", "r"), 1 => array("pipe", "w")); if ($this->po=proc_open($cgiexec, $ds, $fds)) { $this->peof=false; fwrite($fds[0], $GLOBALS["htreq_content"]); fclose($fds[0]); $this->p=$fds[1]; } else { $this->peof=true; $rq_err=500; techo("WARN: cannot proc_open() pipes to '".$cgiexec."'", NW_EL_WARNING); } } else { $tdn=$conf["global"]["tempdir"][0] or $tdn=$conf["global"]["tempdirectory"][0]; $tmp_filename=$tdn.DIRECTORY_SEPARATOR."nweb_cgi_post.".$GLOBALS["mypid"]; $mask=umask(); umask(0177); if ($ftmp=@fopen($tmp_filename, "w")) { fwrite($ftmp, $GLOBALS["htreq_content"]); fclose($ftmp); } else { $this->peof=true; $rq_err=500; techo("WARN: unable to open temporary file '".$tmp_filename."' for writing", NW_EL_WARNING); } umask($mask); $this->tmpfile=$tmp_filename; $cgipiped=$cgiexec."<".$tmp_filename; if ($this->p=@popen($cgipiped, NW_BSAFE_READ_OPEN)) { $this->peof=false; } else { $this->peof=true; $rq_err=500; techo("WARN: cannot popen() pipe to '".$cgiexec."'", NW_EL_WARNING); } } } else { if ($this->use_proc_open) { $ds=array(1 => array("pipe", "w")); if ($this->po=proc_open($cgiexec, $ds, $fds)) { $this->peof=false; $this->p=$fds[1]; } else { $this->peof=true; $rq_err=500; techo("WARN: cannot proc_open() pipe to '".$cgiexec."'", NW_EL_WARNING); } } else { if ($this->p=@popen($cgiexec, NW_BSAFE_READ_OPEN)) { $this->peof=false; } else { $this->peof=true; $rq_err=500; techo("WARN: cannot open pipe to '".$cgiexec."'", NW_EL_WARNING); } } } if ($this->p) while ($lastread!="\r\n" && $lastread!="\n") { if (!$lastread=fgets($this->p, 1024)) break; $content.=$lastread; } if ( (($p1=strpos($content, "\r\n\r\n"))!==false) || (($p1=strpos($content, "\n\n"))!==false) ) { if ((strpos($content, "\r\n\r\n"))!==false) $pn=4; else $pn=2; $headers=explode("\n", trim(substr($content, 0, $p1))); $content=substr($content, $p1+$pn); } $GLOBALS["http_resp"]=""; $cnh=access_query("cginoheader"); foreach ($headers as $s) if ($s=trim($s)) { if (substr($s, 0, 5)=="HTTP/") { $hd_key="STATUS"; strtok($s, " "); } else { $hd_key=strtok($s, ":"); } $hd_val=trim(strtok("")); $hku=strtoupper($hd_key); if ($cnh) foreach ($cnh as $nohdr) if ($hku==strtoupper($nohdr)) $hd_key=""; if ($hd_key) { if ($hku=="SET-COOKIE") { $cgi_headers["cookies"][]=$hd_val; } else { $cgi_headers[$hd_key]=$hd_val; } } } } function parser_get_output() { $tmp=fread($this->p, 1024); if (feof($this->p)) $this->peof=true; return($tmp); } function parser_eof() { return($this->peof); } function parser_close() { if ($this->tmpfile && is_file($this->tmpfile)) unlink($this->tmpfile); if ($this->use_proc_open) { fclose($this->p); proc_close($this->po); } else { @pclose($this->p); } if (is_array($this->request_env)) { foreach (array_keys($this->request_env) as $cleanenv) putenv($cleanenv."="); unset($this->request_env); } } } ?> nanoweb_2.2.9/modules/mod_status.php0000644000000000000000000002121011023557654016304 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_status { function mod_status() { global $conf; $this->modtype="url"; $this->modname="Server status report"; $this->urls=array("/server-status"); } function url(&$rq_err, &$out_contenttype, &$out_add_headers) { global $stats_start, $stats_cnx, $stats_hits, $stats_modlist, $stats_resperr, $stats_vhosts, $stats_xfer, $stats_rej, $remote_ip, $remote_host, $modules, $conf, $logger_pids, $scoreboard, $mypid, $query_string, $htreq_headers, $banned_ips; if ($allow=$conf["global"]["statusallowhost"]) for ($a=0;$a$st_arr) { $s.=str_pad($pid, 5, " ", STR_PAD_LEFT)." - ".str_pad($this->ts2str($t - $st_arr[NW_SB_FORKTIME]), 7, " ", STR_PAD_LEFT)." - ".$st_arr[NW_SB_PEERHOST]."\n -> ".$st_arr[NW_SB_STATUS]."\n"; $pst["pid"]=$pid; $pst["peer_host"]=$st_arr[NW_SB_PEERHOST]; $pst["status"]=$st_arr[NW_SB_STATUS]; $pst["uptime"]=$t - $st_arr[NW_SB_FORKTIME]; $st["who"][]=$pst; } } } else { if (is_callable("memory_get_usage")) { $im = memory_get_usage(); $um = (int)($im/1024)." KB"; } else { $um = false; } $out_contenttype="text/html"; $startd=gmdate("D, d M Y H:i:s T", $stats_start); $uptime=time()-$stats_start; $upstr=$this->ts2str($uptime); $nst=nw_server_string(); $s="
Nanoweb server status module

"; $s.="
"; $s.="Server : ".$nst."
"; $s.="Started : ".$startd."
"; $s.="Uptime : ".$upstr."
"; if ($um) $s.="Memory : ".$um."
"; $s.="
"; $st["status"]["server_string"]=$nst; $st["status"]["started_str"]=$startd; $st["status"]["uptime_str"]=$upstr; $st["status"]["started"]=$stats_start; $st["status"]["uptime"]=$uptime; if ($im) $st["status"]["memory_usage"] = $im; $acs=(count($scoreboard)+1); if (!$conf["global"]["singleprocessmode"][0]) { $s.="Active servers : ".$acs."/".((int)$conf["global"]["maxservers"][0]?(int)$conf["global"]["maxservers"][0]:"-")." ("; $st["status"]["active_servers"]=$acs; $st["status"]["max_active_servers"]=(int)$conf["global"]["maxservers"][0]; unset($tmp); foreach ($scoreboard as $pid=>$dummy) $tmp[]=$pid; $tmp[]=$mypid; $s.=implode(" ", $tmp); $st["status"]["servers_pid"]=$tmp; $s.=")
"; } if ($conf["global"]["loggerprocess"][0]) { $acl=count($logger_pids); $s.="Active loggers : ".$acl. "/".(int)$conf["global"]["loggerprocess"][0]." ("; $st["status"]["active_loggers"]=$acl; $st["status"]["configured_loggers"]=(int)$conf["global"]["loggerprocess"][0]; if ($c=count($logger_pids)) { unset($tmp); while (list($pid, $lgid)=each($logger_pids)) $tmp[]="#".$lgid."=".$pid; $s.=implode(" ", $tmp); $st["status"]["loggers_pid"]=array_keys($logger_pids); } $s.=")
"; } $s.="
"; $s.="Total hits/connections : ".($stats_hits+1)."/".($stats_cnx)." (avg ".sprintf("%.2f", (($stats_hits/$uptime)*60))."/m ".sprintf("%.2f", ($stats_hits/$uptime))."/s)
"; $st["stats"]["total_hits"]=($stats_hits+1); $st["stats"]["total_connections"]=$stats_cnx; $s.="Total sent size : ".number_format(sprintf("%.1f", $stats_xfer/1024))." KB (avg ".sprintf("%.2f", ((($stats_xfer/1024)/$uptime)*60))." KB/m ".sprintf("%.2f", (($stats_xfer/1024)/$uptime)*8)." Kbit/s)
"; $st["stats"]["total_sent_bytes"]=$stats_xfer; $s.="
"; if (strpos($query_string, "detailed")!==false) { $s.="Loaded modules

"; for ($a=0;$a"; $mst["module_name"]=$stats_modlist[$a][0]; $mst["module_desc"]=$stats_modlist[$a][1]; $st["modules"][]=$mst; } $s.="
"; $tresp=$stats_resperr; ksort($tresp); $s.="HTTP responses statistics

"; foreach ($tresp as $key=>$val) { $s.=str_pad($GLOBALS["HTTP_HEADERS"][$key], 26)." : ".$val."
"; $tst["response_code"]=$key; $tst["hits"]=$val; $st["responses"][]=$tst; } $s.="
"; $bln_str=", ".(int)$stats_rej." total rejected connections"; if (($nbip=count($banned_ips))==0) { $s.="No blocked IP address".($nbip>1?"es":"").$bln_str."

"; } else { $s.=$nbip." blocked IP addresses".$bln_str."

"; $s.="Source Address Type (expires) Rej
-------------------- ---------------- ------------------------------ -------
"; foreach ($banned_ips as $addr=>$bip) { $bip["address"]=$addr; $s.=str_pad($bip["source"], 20)." ".str_pad($addr, 16)." ".str_pad($bip["type"].($bip["type"]=="TEMP"?(" (".date("Y-m-d H:i:s", $bip["expires"]).")"):""), 30)." ".(int)$bip["rejects"]."
"; $st["blocked_ips"][]=$bip; } $s.="
"; } } if (strpos($query_string, "vstats")!==false) { $s.="Virtual hosts statistics

"; $sv=$stats_vhosts; arsort($sv); foreach ($sv as $vh=>$hits) { if (!$hmax) $hmax=$hits or $hmax=1; $s.=str_pad(substr($vh, 0, 20), 20, " ", STR_PAD_LEFT)." ".str_pad("", (int)($hits/$hmax*50), "#")." ".$hits."
"; $vst["name"]=$vh; $vst["hits"]=$hits; $st["vhosts"][]=$vst; } $s.="
"; } $s.="
The server is working properly
"; if (strpos($htreq_headers["USER-AGENT"], "Lynx")===0) { $out_contenttype="text/plain"; $s=strip_tags(str_replace("
", "\n", $s)); } } } else { // Return 403 Forbidden if hit is not coming from allowed host $rq_err=403; $s="no access"; } if (strpos($query_string, "php-serialize")!==false) { $out_contenttype="text/plain"; $s=serialize($st); } else if (strpos($query_string, "wddx")!==false) { if (is_callable("wddx_packet_start")) { $wd=wddx_packet_start("nanoweb mod_status"); wddx_add_vars($wd, "st"); $s=wddx_packet_end($wd); } else { $s="wddx support not built in PHP"; } } else if (strpos($query_string, "xml")!==false) { $out_contenttype="text/xml"; $s=$this->arr_to_xml($st, "nanoweb_mod_status"); } return($s); } function ts2str($timestamp) { $up_d=(int)($timestamp/86400); $up_h=((int)($timestamp/3600))%24; $up_m=((int)($timestamp/60))%60; $up_s=$timestamp%60; $tstr=($up_d?($up_d."d, "):"").(($up_h||$up_d)?($up_h."h, "):"").(($up_m||$up_h||$up_d)?($up_m."m, "):"").$up_s."s"; return ($tstr); } function arr_to_xml($arr, $rootname="php_array", $lvl=0) { $fill=($lvl+1)*4; for ($a=0;$a<$fill;$a++) $filler.=" "; if ($lvl==0) { $s="<"."?xml version=\"1.0\"?".">\n\n<$rootname>\n\n"; } foreach ($arr as $key=>$val) { if (is_int($key)) { $skey_o="element id=\"".$key."\""; $skey_c="element"; } else { $skey_o=$skey_c=$key; } if (is_array($val)) { $s.=$filler."<$skey_o>\n\n".$this->arr_to_xml($val, false, $lvl+1).$filler."\n\n"; } else { $s.=$filler."<$skey_o>$val\n\n"; } } if ($lvl==0) { $s.="\n"; } return($s); } } ?> nanoweb_2.2.9/modules/mod_gzip.php0000644000000000000000000000546311023557654015746 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # it now adds itself to the parser/filter chain # */ class mod_gzip extends pfilter { function mod_gzip() { $this->modtype = "core_after_pfilters"; $this->modname = "gzip content encoding support"; } function init() { register_filter("gzip", $this, NW_PFILTER_ALL); } function main() { if ((access_query("gzipenable", 0) && $GLOBALS["gz_av"])) { global $lf; $this->pp = $lf; $this->content_length = $this->pp->content_length; $lf=$this; } } function filter_func(&$lf, $args) { global $htreq_headers, $out_add_headers, $first_chunk, $chunky; if ($first_chunk) { $this->gz_method = false; foreach (array("deflate", "gzip", "compress") as $m) { if (strpos($htreq_headers["ACCEPT-ENCODING"], $m) !== false) { $this->gz_method = $m; break; } } if (!($this->gz_level=access_query("gziplevel", 0))) { $this->gz_level=3; } $this->engaged = $this->gz_method && empty($out_add_headers["Content-Encoding"]); $this->engaged = $this->engaged && ( !($chunky || (nw_use_chunked_encoding()==true)) || (access_query("gzipenable",0)>=2) ); } if ($this->engaged) { switch ($this->gz_method) { case "deflate": $gz_content=gzdeflate($lf, $this->gz_level); break; case "compress": $gz_content=gzcompress($lf, $this->gz_level); break; case "gzip": $gz_content=gzencode($lf, $this->gz_level); //(..., FORCE_DEFLATE) ?? default: } #techo("compressing " . strlen($lf) . " bytes using " . $this->gz_method . " level=".$this->gz_level); if (!$chunky || isset($this->pp->content_length)) { if (!$maxratio=(access_query("gzipmaxratio", 0)/100)) $maxratio=0.90; if (!(strlen($gz_content)<(strlen($lf)*$maxratio))) { return(0); } $this->content_length = strlen($gz_content); } $lf=$gz_content; $out_add_headers["Content-Encoding"]=$this->gz_method; } else { $this->content_length = $this->pp->content_length; } } } ?> nanoweb_2.2.9/modules/mod_mispell.php0000644000000000000000000000267611023557654016445 0ustar rootrootmodtype="core_after_decode"; $this->modname="Mispelled URL correction"; } function check_d($path_arr, $dir="", $i=0) { global $docroot, $docroot_prefix, $url_fa; $handle = opendir(realpath($docroot.$dir)); while ($f = readdir($handle)) if ($f != "." && $f != "..") $t[$f] = levenshtein($path_arr[$i], $f); closedir($handle); asort($t); while((list($rep,$val)=each($t))) if (($val>=0) && ($val<=1)) { if ($i+1==count($path_arr)) $url_fa[]=url_to_absolute($docroot_prefix.$dir.$rep); else if (is_dir($docroot.$dir.$rep)) $this->check_d($path_arr, $dir.$rep."/", $i+1); } } function main() { global $conf, $http_uri, $docroot, $add_errmsg, $pri_redir, $url_fa; if (is_file($docroot.$http_uri) || is_dir($docroot.$http_uri)) return(true); $this->check_d(explode("/",rtrim($http_uri, "/"))); sort($url_fa); $r=count($url_fa); if ($r!=0) { switch (strtolower($conf["global"]["mispellaction"][0])) { case "advice": $add_errmsg.="You may find what you were looking for at the following location(s) :
"; for($j=0;$j<$r;$j++) $add_errmsg.="
  • ".$url_fa[$j]."
    "; $add_errmsg.="
    "; break; case "redirect": $pri_redir=$url_fa[0]; break; } } } } ?> nanoweb_2.2.9/modules/mod_worms.php0000644000000000000000000000767311023557654016151 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_worms { function mod_worms() { $this->modtype="core_before_decode"; $this->modname="HTTP worms detection"; $this->urls=array("/scripts/root.exe", "/default.ida"); } function main() { global $conf, $query_string, $pri_err; if (strpos($query_string, "system(chr(") !== false) { $wormid = "phpbb"; } else if ((strpos($query_string, "wget") !== false) && (strpos($query_string, "perl") !== false)) { $wormid = "probable"; } if (!isset($wormid)) return; if ($bt=access_query("wormsblocktime", 0)) { // Block source IP address $bsrc="mod_worms.".$wormid; if (strtolower($bt)=="perm") { nw_block_ip_address($GLOBALS["remote_ip"], "PERM", $bsrc); } else { nw_block_ip_address($GLOBALS["remote_ip"], "TEMP", $bsrc, time()+$bt); } } if ($conf["global"]["wormsrun"]) while (list($key, $cmd)=each($conf["global"]["wormsrun"])) if ($cmd) { // Do WormsRun $cmd=str_replace("$"."REMOTE_IP", $GLOBALS["remote_ip"], $cmd); $cmd=str_replace("$"."REMOTE_HOST", $GLOBALS["remote_host"], $cmd); exec($cmd); } if ($conf["global"]["wormswpoptext"]) { // Do WormsWpopText while (list($key, $msgline)=each($conf["global"]["wormswpoptext"])) $msg.=$msgline."\n"; $msg=str_replace("$"."SERVERNAME", $conf[$vhost]["servername"][0], $msg); $msg=str_replace("$"."SERVERADMIN", $conf[$vhost]["serveradmin"][0], $msg); if ($p=@popen("wpop ".$GLOBALS["remote_ip"], "w")) { fputs($p, $msg); pclose($p); } else { techo("mod_worms: unable to popen() wpop", NW_EL_WARNING); } } // Return 404 Not found $pri_err=404; return ""; } function url(&$rq_err, &$out_contenttype, &$out_add_headers) { global $conf, $vhost; if (strpos($GLOBALS["http_uri"], "root.exe")!==false) $wormid="Nimda"; else if ($GLOBALS["query_string"]{0}=="N") $wormid="CodeRed"; else if ($GLOBALS["query_string"]{0}=="X") $wormid="CodeRed2"; else $wormid="unknown"; if ($bt=access_query("wormsblocktime", 0)) { // Block source IP address $bsrc="mod_worms.".$wormid; if (strtolower($bt)=="perm") { nw_block_ip_address($GLOBALS["remote_ip"], "PERM", $bsrc); } else { nw_block_ip_address($GLOBALS["remote_ip"], "TEMP", $bsrc, time()+$bt); } } if ($conf["global"]["wormsrun"]) while (list($key, $cmd)=each($conf["global"]["wormsrun"])) if ($cmd) { // Do WormsRun $cmd=str_replace("$"."REMOTE_IP", $GLOBALS["remote_ip"], $cmd); $cmd=str_replace("$"."REMOTE_HOST", $GLOBALS["remote_host"], $cmd); exec($cmd); } if ($conf["global"]["wormswpoptext"]) { // Do WormsWpopText while (list($key, $msgline)=each($conf["global"]["wormswpoptext"])) $msg.=$msgline."\n"; $msg=str_replace("$"."SERVERNAME", $conf[$vhost]["servername"][0], $msg); $msg=str_replace("$"."SERVERADMIN", $conf[$vhost]["serveradmin"][0], $msg); if ($p=@popen("wpop ".$GLOBALS["remote_ip"], "w")) { fputs($p, $msg); pclose($p); } else { techo("mod_worms: unable to popen() wpop", NW_EL_WARNING); } } // Return 404 Not found $rq_err=404; return(""); } } ?> nanoweb_2.2.9/modules/mod_bsp.php0000644000000000000000000001445611023557654015563 0ustar rootroot Makes heavy use of Brainfuck interpreter in PHP Copyright (C) 2002 Daniel Lorch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_bsp { function mod_bsp() { $this->modtype="parser_BSP"; $this->modname="BSP support (Brainfuck Server Pages)"; } function parser_open($args, $filename, $rq_err, &$cgi_headers) { $f=fopen($filename, NW_BSAFE_READ_OPEN); $content=fread($f, filesize($filename)); fclose($f); if ($GLOBALS["query_string"]=="source" && $GLOBALS["conf"]["global"]["bspallowsource"][0]) { $cgi_headers["Content-Type"]="text/plain"; $this->parsed_content=$content; } else { $cgi_headers["X-Powered-By"]="PHP Brainfuck Interpreter 1.01"; $this->parsed_content=brainfuck($content, urldecode($GLOBALS["htreq_content"])); if ($args) $cgi_headers["Content-Type"]=$args; } } function parser_get_output() { $tmp=$this->parsed_content; $this->parsed_content=""; return($tmp); } function parser_eof() { return($this->parsed_content===""); } function parser_close() { } } ?> \n"; $m.="PositionValueASCII\n"; foreach($d as $element => $value) { $m.="\n"; $m.="" . $element . "\n"; $m.="" . ord($value) . "\n"; $m.="" . (ord($value) >= 32 ? htmlentities($value) : " ") . "\n"; $m.="\n"; } $m.="\n"; return($m); } /* The actual interpreter */ function brainfuck_interpret(&$s, &$_s, &$d, &$_d, &$i, &$_i, &$o) { do { switch($s[$_s]) { /* Execute brainfuck commands. Values are not stored as numbers, but as their representing characters in the ASCII table. This is perfect, as chr(256) is automagically converted to chr(0). */ case '+': $d[$_d] = chr(ord($d[$_d]) + 1); break; case '-': $d[$_d] = chr(ord($d[$_d]) - 1); break; case '>': $_d++; if(!isset($d[$_d])) $d[$_d] = chr(0); break; case '<': $_d--; break; /* Output is stored in a variable. Change this to echo $d[$_d]; flush(); if you would like to have a "live" output (when running long calculations, for example. Or if you are just terribly impatient). */ case '.': $o .= $d[$_d]; break; /* Due to PHP's non-interactive nature I have the whole input passed over in a string. I successively read characters from this string and pass it over to BF every time a ',' command is executed. */ case ',': $d[$_d] = $_i==strlen($i) ? chr(0) : $i[$_i++]; break; /* Catch loops */ case '[': /* Skip loop (also nested ones) */ if((int)ord($d[$_d]) == 0) { $brackets = 1; while($brackets && $_s++ < strlen($s)) { if($s[$_s] == '[') $brackets++; else if($s[$_s] == ']') $brackets--; } } /* Execute loop */ else { $pos = $_s++-1; /* The closing ] returns true when the loop has to be executed again. If so, then return to the $pos(ition) where the opening [ is. */ if(brainfuck_interpret($s, $_s, $d, $_d, $i, $_i, $o)) $_s = $pos; } break; /* Return true when loop has to be executed again. It is redundant to the [ checking, but it will save some parsing time (otherwise the interpreter would have to return to [ only to skip all characters again) */ case ']': return ((int)ord($d[$_d]) != 0); /* Call debug function */ case '#': $o.=brainfuck_debug($s, $_s, $d, $_d, $i, $_i, $o); } } while(++$_s < strlen($s)); } /* Call this one in order to interpret brainfuck code */ function brainfuck($source, $input='') { /* Define needed variables: $data Brainfuck's memory $source Source data $input Simulate STDIN $output Save output in here Each with according index variables */ $data = array(); $data[0] = chr(0); /* It is necessary to set every element explicitly, as PHP treats arrays as hashes */ $data_index = 0; $source_index = 0; $input_index = 0; $output = ''; /* Call the actual interpreter */ brainfuck_interpret($source, $source_index, $data, $data_index, $input, $input_index, $output); return $output; } ?> nanoweb_2.2.9/modules/mod_fb.php0000644000000000000000000001422611023557654015361 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ define("NW_TMPL_FB_HEADER", "fb_header"); define("NW_TMPL_FB_FOOTER", "fb_footer"); define("NW_TMPL_FB_PARENT", "fb_parent_name"); define("NW_TMPL_FB_ROW_D", "fb_directory_row"); define("NW_TMPL_FB_ROW_F", "fb_file_row"); class mod_fb { function mod_fb() { $this->modtype="core_directory_handler"; $this->modname="Files and directories browser"; } function main() { global $http_uri, $docroot, $conf, $vhost, $rq_err, $out_contenttype, $real_uri, $out_add_headers, $accessdir, $mime, $query_string; foreach (access_query("fbiconbytype") as $icndef) { $ic=explode(" ", $icndef); $icons[trim($ic[1])]=trim($ic[0]); } $icndef=access_query("fbicondefault", 0); if (!($icndir=access_query("fbicondirectory", 0))) $icndir=$icndef; if ($http_uri[strlen($http_uri)-1]!="/") $http_uri.="/"; if (access_query("filebrowser", 0)) { if (@is_readable($docroot.$http_uri)) { $dfmt=access_query("fbdateformat", 0) or $dfmt="d-M-Y H:i:s"; $rq_err=200; $out_contenttype="text/html"; // Generate directory listing $hnd=opendir(realpath($docroot.$http_uri)); unset($fb_arr); unset($fsort); while ($f=readdir($hnd)) { $fi=stat($docroot.$http_uri.$f); $fi["isdir"]=is_dir($docroot.$http_uri.$f); $fi["f"]=$f; $fb_arr[$f]=$fi; if (!$fi["isdir"]) { $fb_ts+=$fi[7]; $fb_tf++; } } if ($fbstmp=access_query("fbsortorder", 0)) { $fbsort=explode(" ", $fbstmp); } else { $fbsort=array("name"); } parse_str($query_string, $ptmp); if (count($ptmp)) { if ($ptmp["sort"]) $fbsort[0]=$ptmp["sort"]; if ($ptmp["order"]) $fbsort[1]=$ptmp["order"]; } switch ($fbsort[0]) { case "date": $sortidx=9; break; case "size": $sortidx=7; break; case "name": default: $sortidx="f"; } $dsort = $fsort = array(); foreach ($fb_arr as $fstmp) if (!$fstmp["isdir"]) { $fsort[$fstmp["f"]] = $fstmp[$sortidx]; } else { if ($fstmp["f"] != "..") { $dsort[$fstmp["f"]] = $fstmp[$sortidx]; } else { $has_parent = $fstmp[$sortidx]; } } if ($fbsort[1]=="desc") { arsort($fsort); arsort($dsort); } else { asort($fsort); asort($dsort); } if ($has_parent) { $dsort = array_reverse($dsort); $dsort[".."] = $has_parent; $dsort = array_reverse($dsort); } // Do other processing if (@is_readable($wfn=$docroot.$http_uri.$conf[$vhost]["fbwelcomefile"][0])) { $wfc=implode("
    ", file($wfn)); $welcome_formated="
    ".$wfc."

    "; } else $welcome_formated=""; $fhdr=array(); $fhdr["dir_name"]="/".$real_uri; $fhdr["welcome"]=$welcome_formated; $fhdr["total_files"]=$fb_tf; $fhdr["total_files_formated"]=number_format($fb_tf); $fhdr["total_size"]=$fb_ts; $fhdr["total_size_formated"]=number_format($fb_ts); $resp=nw_apply_template(NW_TMPL_FB_HEADER, $fhdr); $dfile=access_query("fbdescfile", 0); unset($fb_desc); if (@is_readable($dfcomp=realpath($accessdir."/".$dfile))) if ($descf=file($dfcomp)) foreach ($descf as $dfline) if (trim($dfline)) { $didx=trim(substr($dfline, 0, strpos($dfline, " "))); $desc=trim(substr($dfline, strpos($dfline, " "))); $fb_desc[$didx]=$desc; } // Display each row foreach (array_keys($dsort) as $fidx) { $fi=$fb_arr[$fidx]; $f=$fi["f"]; if ($f=="..") { $dname=nw_apply_template(NW_TMPL_FB_PARENT, array()); $tmpdl=explode("/", trim($real_uri,"/")); array_pop($tmpdl); $dlink=url_to_absolute(implode("/", $tmpdl)."/"); } else { $dname=$f; $dlink=url_to_absolute($real_uri.rawurlencode($f)."/"); } if (((substr($f, 0, 1)!="." || $f=="..") || $conf[$vhost]["fbshowdotfiles"][0]) && ($f!=".") && !($f==".." && $http_uri=="/")) { $d_row=array(); $d_row["icon"]=$icndir; $d_row["link"]=$dlink; $d_row["name"]=$dname; $d_row["date"]=date($dfmt, $fi[9]); $d_row["desc"]=($fb_desc[$f]?$fb_desc[$f]:"-"); $resp.=nw_apply_template(NW_TMPL_FB_ROW_D, $d_row, true); } } foreach (array_keys($fsort) as $fidx) { $fi=$fb_arr[$fidx]; $f=$fi["f"]; $fp=pathinfo($f); $t=$mime[strtolower($fp["extension"])]; $icnf=$icndef; if ($icons) foreach ($icons as $key=>$val) if (strpos($t, $key)===0) { $icnf=$val; break; } if ((($f[0]!="." || $f=="..") || $conf[$vhost]["fbshowdotfiles"][0]) && ($f!=".") && !($f==".." && $http_uri=="/")) { $f_row=array(); $f_row["icon"]=$icnf; $f_row["link"]=url_to_absolute(($real_uri).rawurlencode($f)); $f_row["name"]=$f; $f_row["date"]=date($dfmt, $fi[9]); $f_row["size"]=number_format($fi[7]); $f_row["desc"]=($fb_desc[$f]?$fb_desc[$f]:"-"); $resp.=nw_apply_template(NW_TMPL_FB_ROW_F, $f_row, true); } } closedir($hnd); $resp.=nw_apply_template(NW_TMPL_FB_FOOTER, $fhdr); } else { $rq_err=403; } } else $rq_err=404; if ($resp) $GLOBALS["lf"] =& new static_response($resp); } } ?> nanoweb_2.2.9/modules/mod_include.php0000644000000000000000000000452311023557654016414 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_include { function mod_include() { $this->modtype="parser_SSI"; $this->modname="Server Side Includes support"; } function parser_open($args, $filename, $rq_err, $cgi_headers) { $f=fopen($filename, NW_BSAFE_READ_OPEN); $content=fread($f, filesize($filename)); fclose($f); while (($p1=strpos($content, "")) { techo("WARN: SSI parse error in ".$filename, NW_EL_WARNING); $rq_err=500; } $s=trim(substr($s, 0, $p2)); $tmp=explode("=", $s); if (count($tmp)!=2) { techo("WARN: SSI parse error in ".$filename, NW_EL_WARNING); $rq_err=500; } $cmd=strtolower(trim($tmp[0])); $arg=trim($tmp[1]," \""); switch($cmd) { case "include virtual": $ext=strstr($arg, "."); $tmp=loadfile($docroot.$arg, substr($ext, 1), $rq_err, $add_headers); $repl=$tmp->parser_get_output(); $tmp->parser_close(); break; case "include file": $ext=strstr($arg, "."); $tmp=loadfile("./".$arg, substr($ext, 1), $rq_err, $add_headers); $repl=$tmp->parser_get_output(); $tmp->parser_close(); break; case "exec cmd": $repl=`$arg`; break; } $content=substr($content, 0, $p1).$repl.substr($content, $p1+$p2+8); } $this->parsed_content=$content; } function parser_get_output() { $tmp=$this->parsed_content; $this->parsed_content=""; return($tmp); } function parser_eof() { return($this->parsed_content===""); } function parser_close() { } } ?> nanoweb_2.2.9/modules/mod_multiviews.php0000644000000000000000000001761111023557654017203 0ustar rootroot */ class mod_multiviews { function mod_multiviews() { $this->modtype="core_after_decode"; $this->modname="MultiViews (content negotiation)"; $GLOBALS["mime_enc"]["gz"] = "gzip"; $GLOBALS["mime_enc"]["Z"] = "compress"; $this->negotiate_features = array( "javascript" => "javascript", "js" => "javascript", "java" => "java", "flash" => "flash", "tables" => "tables", "graphic" => "graphic", "textonly" => "textonly" ); } # fetches extensions that match the given mime glob # function extensions($string = "text/*") { global $mime; $extensions = array(); $compare_part = (strrpos($string, '*')); $string = rtrim($string, '*'); foreach ($mime as $ext => $mimetype) { if ($compare_part && (strpos($mimetype, $string) === 0) || !$compare_part && ($mimetype == $string)) { $extensions[] = $ext; } } return($extensions); } # returns array with quality values indexed by # file name extensions function parseQualities($qstring, $q=0.92, $divide_q=1.05, $set_no_q=false) { $qualities = array(); foreach (explode(',', $qstring) as $qspart) { @list($mime, $options) = explode(';', $qspart, 2); if ($mime = trim($mime)) { //-- mime type or country code? if (strrpos($mime, '/') <= 0) { list($ext) = explode('_', $mime); $ext = array($ext); } else { $ext = $this->extensions($mime); } //-- extract options (q=NN; level=NN; ...) foreach (@explode(";", @$options) as $option) { @list($qsarg, $new_q) = @explode('=', trim(@$option)); if ( ($qsarg[0] == "q") && !empty($new_q) ) { $q = trim($new_q); } } //-- append fetched extensions to qualities array foreach ($ext as $add) { if (empty($qualities[$add])) { $qualities[$add] = $q; } } //-- q value for next round $q /= $divide_q; if ($set_no_q) { $q = $set_no_q; } } } return($qualities); } function main() { global $http_uri, $rq_file, $conf, $docroot, $htreq_headers, $mime, $mime_enc, $out_add_headers, $pri_err; if (access_query("reflectrewriting", 0)) { global $real_uri; } // quick skip $enabled = strtolower(trim(access_query("multiviews", 0))); if ( ($enabled === "0") || ($enabled == "off") || file_exists($docroot.$http_uri) && !is_dir($docroot.$http_uri) ) { return; } // determine file name to be worked on $file = $http_uri; if ($last_slash = strrpos($file, "/")) { $act_path = substr($file, 0, $last_slash + 1); $file = substr($file, $last_slash + 1); } if ($file) { $allowed_filenames = array($file); } else { $allowed_filenames = explode(" ", access_query("directoryindex", 0)); } // find files with same basename and different extensions $alternative_files = array(); $dir = opendir($docroot . $act_path); while($filename = readdir($dir)) { foreach ($allowed_filenames as $filebn) { if (! $filebn) { continue; } $filebn .= "."; if (substr($filename, 0, strlen($filebn)) == $filebn) { $alternative_files[] = $filename; } } } closedir($dir); if (empty($alternative_files)) { return(2); } // quick skip2 #print_r($alternative_files); // fetch priorities $qualities = array_merge( array( /* fallback file extensions */ "php" => 0.75, "shtml" => 0.72, "html" => 0.71, "xhtml"=> 0.70, "png" => 0.33, "jpeg" => 0.32, "gif" => 0.31 ), $this->parseQualities(implode(", ", access_query("otherpriority")), 1.3, 1.1), $this->parseQualities(@$htreq_headers["ACCEPT-FEATURES"], 1.15, 1), $this->parseQualities(strtr(access_query("languagepriority", 0), " ", ","), 0.8, 1.2), $this->parseQualities(@$htreq_headers["ACCEPT-LANGUAGE"], 1, 1.03), $this->parseQualities(@$htreq_headers["ACCEPT"], 1, 1.02), $this->parseQualities((strpos(@$htreq_headers["ACCEPT-ENCODING"], "gzip") !== false) ? "gz" : "", 1.5, 1) ); // other algorithm flags $accept_all = strpos(@$htreq_headers["ACCEPT"], "*/*") !== false; $http10 = $GLOBALS['http_version'] < "1.1"; $agent_negotiate = (strpos($htreq_headers["NEGOTIATE"], "vlist") !== false) || (strpos($htreq_headers["NEGOTIATE"], "trans") !== false); // will contain variants and their attributes $alternates = array(); // go thru filename extensions, and sum qualities foreach ($alternative_files as $filename) { $q_mime = -1; $q_enc = $q_lang = $q_features = $q_else = +1; $file_extensions = array_slice(explode('.', $filename), 1); foreach ($file_extensions as $ext) { $ext_q = $qualities[$ext]; if (empty($ext_q) && ($ext_q !== 0)) { if ($accept_all) { $ext_q = 0.1; } else { $ext_q = 0.001; } } if (@$mime[$ext]) { $alternates[$filename]["type"] = $mime[$ext]; $q_mime += $ext_q + ($q_mime < 0 ? +1 : +0); } elseif (@$mime_enc[$ext]) { $alternates[$filename]["encoding"] = $mime_enc[$ext]; $q_enc *= $ext_q; } elseif (strlen($ext) == 2) { $alternates[$filename]["language"] = $ext; $q_lang = $ext_q; } else { $q_else *= 0.9; } if ($feature = $this->negotiate_features[$ext]) { $alternates[$filename]["feature"] .= " $feature;+1.2-0.9"; $q_features *= ($qualities[$feature]) ? 1.2 : 0.9; $q_else /= 0.9; } } if ($q_mime < 0) { $q_mime = 0.005; } $alternates[$filename]["q"] = ($q_mime * $q_enc * $q_lang * $q_features * $q_else); } // sort uasort($alternates, 'mod_multiviews_uarsort_by_q'); #print_r($alternates); // return selected variant list($file) = array_keys($alternates); $real_uri = $http_uri = $act_path . $file; $rq_file = pathinfo($http_uri); // fallback output $out_add_headers["TCN"] = "adhoc"; $out_add_headers["Vary"] = "negotiate"; // server-driven negotiation if ( !$agent_negotiation ) { $out_add_headers["Content-Location"] = $file; if (!$http10) { $out_add_headers["TCN"] = "choice"; } $out_add_headers["Vary"] = "negotiate, accept, accept-language, accept-features"; foreach ($mime_enc as $ext => $encoding) { // report file's encoding if (strpos($file, ".{$ext}")) { $out_add_headers["Content-Encoding"] = $encoding; $GLOBALS["out_encoded"] = true; } } } // agent-driven negotiation else { $out_add_headers["TCN"] = "list"; $GLOBALS["pri_err"] = $http10 ? 200 : 300; // HTTP 300 Choose Yourself $GLOBALS["out_contenttype"] = "text/html"; $GLOBALS["add_errmsg"] = "The document you requested exists in different variants, and your browser gives you the opportunity to select one of them (or just does not support transparent content negotiation):
      "; foreach ($alternative_files as $f => $q) { $GLOBALS["add_errmsg"] .= '
    • ' . $f . '
    • '; } $GLOBALS["add_errmsg"] .= "
    "; if ($http10) { $out_add_headers["Refresh"] = "10; URL=" . url_to_absolute($http_uri); } } // add alternates-header $ah = " "; foreach ($alternates as $filename => $a) { $qstr = substr($a["q"], 0, 5); if (strpos($qstr, ".") === false) { $qstr .= "."; } while (strlen($qstr) < 5) { $qstr .= "0"; } $ah .= '{ "' . $filename . '" ' . $qstr; unset($a["q"]); foreach($a as $desc => $value) { $ah .= ' {' . $desc . ' ' . $value . '}'; } $ah .= " },\n "; } $ah .= "proxy-rvsa=1.0"; $out_add_headers["Alternates"] = $ah; if ($GLOBALS['path_info']) { // may help(?) $out_add_headers["Content-Base"] = "/" . ($act_path ? "$act_path/" : ""); } if ($http10) { $out_add_headers["Vary"] = "*"; } if (is_dir($docroot . $http_uri) && !is_file($docroot . $http_uri . "/index.html") || (strpos($file, ".var") !== false)) { // very rare error / 506 Variant Also Negotiates $GLOBALS["pri_err"] = 506; } } } function mod_multiviews_uarsort_by_q($a, $b) { return( ($a["q"] < $b["q"]) ? 1 : -1 ); } ?>nanoweb_2.2.9/modules/mod_rewrite.php0000644000000000000000000002331411023557654016451 0ustar rootroot */ class mod_rewrite { function mod_rewrite() { $this->modtype="core_before_decode"; $this->modname="RewriteEngine"; } function init() { $this->redirectiontypes = array("P" => 301, "F" => 302, "S" => 303, "T" => 307); define("NW_R_CHAIN", 1); define("NW_R_FORCED", 4); define("NW_R_NEGATE", 8); define("NW_R_COND", 64); } # fetches rewriting regexs from .htaccess file in # given $path function read_rules($path, $rules_string = '') { $rules = array(); $ht_regex = "((?:[^\s]+|\\\\\s)+)"; $accessfile = access_query("accessfile", 0); if (is_array($rules_string) || is_readable($path .= $accessfile) && ($rules_string = file($path))) foreach ($rules_string as $line) { #-- RewriteRULE/COND if ((strtoupper(substr(ltrim($line), 0, 7)) == "REWRITE") && preg_match("/^\s*Rewrite(Rule|Cond)\s+{$ht_regex}\s+{$ht_regex}(\s+\[(.+)\])*/i", $line, $uu)) { $switch = strtoupper($uu[1]); $r_flags = (($uu[2][0] == "!") || ($uu[3][0] == "!")) ? NW_R_NEGATE : 0; $r_regex = ltrim($uu[2], "!"); $r_replacement = preg_replace('/[$](\d\d?)/', '\\\\\1', ltrim($uu[3], "!")); $flagstr = @$uu[4]; // defaults $r_modifiers = ''; $r_eval = ''; if (!empty($flagstr)) { $flagstr = substr($flagstr, $a = 1 + strpos($flagstr, "["), strpos($flagstr, "]") - $a); foreach( explode(",", $flagstr) as $flag ) { list($flag, $flagopts) = explode("=", trim($flag), 2); $uflag = strtoupper($flag); if (($uflag == "NC") || ($uflag == "NOCASE")) { $r_modifiers .= 'i'; } elseif (($uflag == "R") || ($uflag == "REDIRECT")) { if (!($rq_err=$this->redirectiontypes[strtoupper($flagopts[0])])) { $rq_err = 307; if ($flagopts > 0) { $rq_err = $flagopts; } } $r_eval .= " \$r_posteval = '\$pri_redir = url_to_absolute(\$http_uri); \$this->last = 255; \$rq_err = $rq_err;'; "; } elseif (($uflag == "F") || ($uflag == "FORBIDDEN")) { $r_eval .= ' $pri_err = 403; '; } elseif (($uflag == "G") || ($uflag == "GONE")) { $r_eval .= ' $pri_err = 410; '; } elseif (($uflag == "N") || ($uflag == "NEXT")) { $r_eval .= ' $r_no = -1; '; } elseif (($uflag == "L") || ($uflag == "LAST")) { $r_eval .= ' $this->last = 255; '; } elseif (($uflag == "S") || ($uflag == "SKIP")) { if ($flagopts < 1) { $flagopts = 1; } $r_eval .= " \$r_no += $flagopts; "; } elseif (($uflag == "C") || ($uflag == "CHAIN") || ($uflag == "OR") || ($uflag == "ORNEXT")) { $r_flags |= NW_R_CHAIN; } elseif (($uflag == "T") || ($uflag == "TYPE")) { $r_eval .= " \$GLOBALS['out_contenttype'] = '$flagopts'; "; } elseif (($uflag == "QSA") || ($uflag == "QSAPPEND")) { $r_eval .= ' $QSA = $query_string ? "{$query_string}&" : ""; '; } elseif (($uflag == "P") || ($uflag == "PROXY")) { $r_eval .= ' global $real_uri; '; } elseif (preg_match('/^E(?:NV)?=([^:]+):(.+)$/i', $flag, $uu)) { $r_eval .= " putenv('{$uu[2]}={$uu[3]}'); "; } elseif (preg_match('/^H(?:EAD(?:ER)?)?=([^:]+):(.+)$/i', $flag, $uu)) { $r_eval .= " \$out_add_headers['{$uu[2]}'] = '{$uu[3]}'; "; } else { # (preg_match('/^(PT|passthrough|NS|nosubreq|NE|noescapesomething)$/i', $flag)) { techo("unsupported RewriteRule-flag '$flag'", NW_EL_WARNING); } } } $r_flags |= ($r_replacement == "-") ? NW_R_FORCED : 0; switch ($switch) { case "RULE": $r_regex = "\255{$r_regex}\255$r_modifiers"; break; case "COND": $r_flags |= NW_R_COND; $r_replacement = "\255{$r_replacement}\255$r_modifiers"; break; } $rules[] = array($r_regex, $r_replacement, $r_eval, $r_flags); } }#--if & foreach(line) return($rules); } # interpolates %{ENV_VARs}, %{REGEX_FROM_LAST_COND}, and # some others from the $teststring function backreferences (&$teststring, $for_cond = 0) { global $htreq_headers, $vhost, $conf; $NANOWEB_VARS = nw_server_vars(); $teststring = preg_replace('/%(\d)/e', '$this->last_cond[\1]', $teststring); if ($for_cond) { $teststring = preg_replace('/[$](\d)/e', '$this->last_rule[\1]', $teststring); } $teststring = preg_replace('/%{HTTP[_: ]+([-_A-Z0-9]+?)}/ie', '@$htreq_headers[strtoupper("\1")]', $teststring); $teststring = preg_replace('/%{ENV[_: ]+(.+?)}/ie', '@getenv("\1")', $teststring); $teststring = preg_replace('/%{([-_A-Z0-9]+?)}/ie', '@$NANOWEB_VARS[strtoupper("\1")]', $teststring); } # applies regexs (of the fetched .htaccess file from # $act_path) to the $sub_path function rewrite($act_path, &$sub_path) { global $conf, $http_uri, $docroot, $pri_redir, $rq_err, $pri_err, $add_errmsg, $query_string, $out_add_headers; if (@$conf["global"]["reflectrewriting"][0]) { global $real_uri; } // get rules for actual directory $rules = $this->read_rules("$docroot$act_path"); #echo "ACT/SUB == $act_path / $sub_path\n"; for ($r_no = 0; $r_no < count($rules); $r_no++) { list($r_regex, $r_replacement, $r_eval, $r_flags) = $rules[$r_no]; $r_posteval = ''; $r_negate = $f_flags & NW_R_NEGATE ? 1 : 0; // ======================================== RewriteRule =========== if ($r_flags ^ NW_R_COND) { // replaces %N's and $N's from last Rules/Conds $this->backreferences($r_regex, 1); $this->backreferences($r_replacement, 0); if (($r_flags & NW_R_FORCED) || ($r_negate XOR preg_match($r_regex, $sub_path, $this->last_rule)) ) { techo("TRUERULE preg_replace(\"$r_regex\", \"$r_replacement\", \"$sub_path\");", NW_EL_DEBUG); if (!$r_negate) { $sub_path = preg_replace($r_regex, $r_replacement, $sub_path); } if (!empty($r_eval)) { eval($r_eval); } // did the rule add an querystring? if (preg_match('/[?]/', $sub_path)) { list($sub_path, $appended_querystring) = explode('?', $sub_path); $query_string = @$QSA . $appended_querystring; $QSA = ""; } // which nanoweb variable to put the new uri if ($sub_path[0] == "/") { $real_uri=$http_uri = $sub_path; $this->act = 0; } elseif (substr($sub_path, 0, 7) == "http://") { $pri_redir = $sub_path; $this->last = 255; } else { $real_uri // <- makes rewritten urls visible in errormsgs = $http_uri = ($act_path ? "$act_path/" : "") . $sub_path; } $this->new_parts(); // collapse .. and . in path if (!empty($r_posteval)) { eval($r_posteval); } } elseif ($r_flags & NW_R_CHAIN) { //-- on mismatch+chain skip next rules while (($rules[$r_no][3] & NW_R_CHAIN) && !($rules[$r_no][3] & NW_R_COND)) { $r_no++; } } } // ========================================== RewriteCond =========== else { techo("TRUECONDITION($r_regex, $r_replacement)", NW_EL_DEBUG); // replace $N's and %N's from last Rules/Conds $this->backreferences($r_regex, 1); $this->backreferences($r_replacement, 1); $cond_forced = false && ($r_flags ^ NW_R_FORCED); $cond_or = ($r_flags & NW_R_CHAIN); $r_condpattern = trim(preg_replace('/[a-z]+$/', '', $r_replacement), "\255"); if (preg_match('/^(-[dfslFU])$/', $r_condpattern, $uu)) { $filename = "$docroot$actpath/$r_regex"; switch (strtolower($uu[1])) { case "-u": $cond_match = ("" != implode("", file($r_regex))); break; case "-s": $cond_match = (filesize($filename) > 0); break; case "-d": $cond_match = (is_dir($filename)); break; case "-l": $cond_match = (is_link($filename)); break; default: $cond_match = (file_exists($filename)); } } elseif (preg_match('/^([<>=])(.+)$/', $r_condpattern, $uu)) { if ($uu[2] == '""') $uu[2] = ""; // make really empty switch($uu[1]) { case "<": $cond_match = ($r_regex < $uu[2]); break; case ">": $cond_match = ($r_regex > $uu[2]); break; default: $cond_match = ($r_regex == $uu[2]); } } else { $cond_match = preg_match($r_replacement, $r_regex, $this->last_cond); } $cond_match = $cond_forced OR ($cond_match XOR $r_negate); // skip following RewriteConds + RewriteRule if ((! $cond_match) && (! $cond_or)) { while (($rules[$r_no][3] & NW_R_COND) && !($rules[$r_no][3] & NW_R_CHAIN)) { $r_no++; // skip RewriteCond } if (!($rules[$r_no][3] & NW_R_COND)) { do { $r_no++; // skip RewriteRules in chain } while (($rules[$r_no-1][3] & NW_R_CHAIN) && !($rules[$r_no][3] & NW_R_COND)); } $r_no--; // correcting, loop also counts up this var } } if ($this->last) break; }#--foreach(rule) } function new_parts() { global $http_uri; // canonicialize $http_uri $http_uri = preg_replace('#[^/]+/[.][.]#', '', $http_uri); $http_uri = preg_replace('#/[.]+/#', '/', $http_uri); $http_uri = preg_replace('#^[.]+/#', '', $http_uri); $http_uri = ltrim($http_uri, "/"); } function main() { global $conf, $http_uri, $docroot; if (!($e = access_query("rewriteengine", 0)) || (strtolower($e) == "off")) { return; } $this->last = false; $this->act = 0; $this->last_rule = $this->last_cond = array(); while (($this->act = strpos($http_uri, "/", $this->act)) !== false) { // split http_uri $act_path = substr($http_uri, 0, ++$this->act); $sub_path = substr($http_uri, $this->act, 255); if (is_dir($docroot . $act_path)) { $this->rewrite($act_path, $sub_path); } else { break; } if ($this->last) break; } return; } } ?>nanoweb_2.2.9/modules/mod_access_rbl.php0000644000000000000000000000272711023557654017075 0ustar rootrootmodtype="core_after_decode"; $this->modname="Deny IP listed in the RBL"; } function main(){ global $conf, $pri_err, $add_errmsg; switch (strtolower($conf["global"]["access_rbl"][0])) { case "web": $host = "www.mail-abuse.org"; $fp = fsockopen($host,80); fputs($fp, "POST /cgi-bin/lookup?".$GLOBALS["remote_ip"]." HTTP/1.1\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "User-Agent: MSIE\n"); fputs($fp, "Connection: close\n\n"); while (!feof($fp)) $buf .= fgets($fp,128); fclose($fp); if (!strstr($buf,"does not appear on the MAPS RBL.")) $rbled=true; break; case "dns": $ip_xp = explode(".",$GLOBALS["remote_ip"]); $rbl_name = $ip_xp[3].".".$ip_xp[2].".".$ip_xp[1].".".$ip_xp[0].".blackholes.mail-abuse.org"; if (gethostbyname($rbl_name)==="127.0.0.2") $rbled=true; break; } if ($rbled) { $pri_err=403; $add_errmsg="Your IP address (".$GLOBALS["remote_ip"].") is listed in the RBL.

    See http://mail-abuse.org/rbl for more informations about why you are banned from this site, and many others.

    "; } } } ?> nanoweb_2.2.9/modules/mod_debug.php0000644000000000000000000000355311023557654016061 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_debug { function mod_debug() { $this->modtype="core_before_response"; $this->modname="nanoweb debugger (mostly a dev tool)"; } function sprint_r($arr, $lvl=0) { $fill=$lvl*4; for ($a=0;$a<$fill;$a++) $filler.=" "; foreach ($arr as $key=>$val) { if ($key==="GLOBALS") { } else if (is_object($val)) { } else if (is_array($val)) { $ret.=$filler."[$key] => Array = { \n\n".$this->sprint_r($val, $lvl+1).$filler."}\n\n"; } else { $ret.=$filler."[$key] => $val\n\n"; } } return($ret); } function main() { global $conf, $rq_err, $mypid; if (in_array($rq_err, access_query("debugerror"))) { $fn=$conf["global"]["tempdirectory"][0]."/nwdebug.".(int)$mypid; $s=date("Ymd-His")." - nanoweb debug session -----------------------\n"; $s.=$this->sprint_r($GLOBALS); $s.=date("Ymd-His")."------------------------------------------------\n\n"; if ($f=@fopen($fn, "a")) { fwrite($f, $s); fclose($f); } else { techo("WARN: mod_debug was unable to open $fn for writing"); } } } } ?> nanoweb_2.2.9/modules/mod_load_limit.php0000644000000000000000000000415511023557654017107 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_load_limit { function mod_load_limit(){ $this->modtype="core_after_decode"; $this->modname="access limit based on server load average"; } function main(){ global $conf, $pri_err, $pri_redir, $add_errmsg, $pri_redir_code; $maxload=(float)access_query("loadlimit", 0); $action=access_query("loadlimitaction", 0) or $action="error"; $pl=@file("/proc/loadavg"); $lg=explode(" ", $pl[0]); $loadavg=(float)$lg[0]; if ($loadavg>$maxload) { switch ($action) { case "redir": $pri_redir=$this->nsv_str_replace(access_query("loadlimitredirect", 0)); $pri_redir_code=307; break; case "error": $err=access_query("loadlimiterror", 0) or $err=503; $pri_err=$err; $msg=access_query("loadlimiterrormessage", 0) or $msg="Server load is too high (%CUR_LOAD/%MAX_LOAD), try again in a few moments."; $msg=str_replace("%CUR_LOAD", sprintf("%.1f", $loadavg), $msg); $msg=str_replace("%MAX_LOAD", sprintf("%.1f", $maxload), $msg); $add_errmsg=$msg."

    "; break; } } } function nsv_str_replace($s) { if (strpos($s, '%')!==false) if ($nsv=nw_server_vars(strpos($s, '%HTTP')!==false)) foreach ($nsv as $key=>$val) $s=str_replace('%'.$key, $val, $s); return($s); } } ?> nanoweb_2.2.9/modules/mod_libphp.php0000644000000000000000000001230711023557654016246 0ustar rootroot (?php echo "something " . (1+2); ?) - scripts which try to define functions which were already defined in nanoweb won't work of course - header() and cookies() and much of the funny stuff is very unsupported; => use nwheader() instead - currently (and in future) GET-requests only; POST ones will be passed to mod_cgi instead - this module will _NEVER_ be able to create a fully PHP compliant environment to run your scripts in */ class mod_libphp { function mod_libphp() { $this->modtype = "parser_LPHP"; $this->modname = "EXPERIMENTAL inline PHP support for nanoweb"; if (!$GLOBALS["TEST_FUNCS"]["socket_create"] || !function_exists("posix_mkfifo")) { $this->modtype = "disabled"; techo("mod_libphp: cannot run under Windows or NT, need Linux/MacOS", NW_EL_ERROR); } } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $conf, $http_action; global $__nw_libphp_script, $__nw_libphp_pipe, $__nw_libphp_headers, $NANOWEB; if (true|| ($http_action != "GET") && ($http_action != "HEAD")) { error_reporting(E_ALL); $this = $GLOBALS["modules"]["parser_CGI"][0]; $this->parser_open($args, $filename, $rq_err, $cgi_headers); return; } // create fifo unlink($this->pipe_file = tempnam($conf["global"]["tmpdir"][0], "nwlibphp")); posix_mkfifo($this->pipe_file, 0700); chmod($this->pipe_file, 0700); // create cgi process $pid = pcntl_fork(); if ($pid < 0) { techo("mod_libphp: error forking CGI subprocess", NW_EL_ERROR); } elseif ($pid) { $this->pipe = fopen($this->pipe_file, NW_BSAFE_READ_OPEN); $headers = unserialize(base64_decode(fgets($this->pipe, 32768))); foreach (explode("\n", implode("\n", $headers)) as $h) { list($hd_key, $hd_val) = explode(":", rtrim($h, "\r"), 2); if (strlen($hd_val)) { $hd_val = ltrim($hd_val); $cgi_headers[$hd_key] = $hd_val; } } } else { // fake PHP4.2 environment $_SERVER = nw_server_vars(); $_SERVER["GATEWAY_VERSION"] = "CGI/1.1"; parse_str($_SERVER["QUERY_STRING"], $_GET); $_POST = $_FILES = $_COOKIE = $_SESSION = array(); $_REQUEST = array_merge($_GET, $_POST, $_COOKIE); foreach($_SERVER as $en => $ev) { putenv("$en=$ev"); $_ENV[$en] = $ev; } foreach(array_keys($GLOBALS) as $varname) { if ($varname[0] != "_") { unset($GLOBALS[$varname]); } } $GLOBALS["PHP_SELF"] = $_SERVER["PHP_SELF"] = $_SERVER["SCRIPT_NAME"]; foreach (ini_get_all as $ini_setting => $ini_value) { ini_set($ini_setting, $ini_value); } // other preparations $out_contenttype = ($uu = get_cfg_var("default_mimetype")) ? $uu : "text/html"; if ($out_contenttype == "text/html") { $add_contenttype .= '; charset="' . (($uu = get_cfg_var("default_charset")) ? $uu : "iso8859-1") . '"'; } $__nw_libphp_headers = array( "Status: 200", "X-Powered-By: nanowebs mod_libphp", "Content-Type: " . $add_contenttype ); $__nw_libphp_script = $filename; $NANOWEB = 1; // output fifo $fp = $__nw_libphp_pipe = fopen($this->pipe_file, NW_BSAFE_WRITE_OPEN); // fifo output handler ob_start("__nw_libphp_ob_pipe"); register_shutdown_function("__nw_libphp_shutdown"); #---------------- into nanoweb core -------------- // if (isset($__nw_libphp_script)) { unset($lf); include($__nw_libphp_script); exit; } #------------------------------------------------- } } function parser_get_output() { if ($this->pipe) { return(fread($this->pipe, 32768)); } } function parser_eof() { return(empty($this->pipe) || @feof($this->pipe)); } function parser_close() { if ($this->pipe) fclose($this->pipe); if ($this->pipe_file) unlink($this->pipe_file); } } #== esoteric helper functions =============================================== function __nw_libphp_ob_pipe($string) { if ($fp = $GLOBALS["__nw_libphp_pipe"]) { if (!nwheaders_sent()) { $h = base64_encode(serialize($GLOBALS["__nw_libphp_headers"])); fputs($fp, ($h."\n")); $GLOBALS["__nw_libphp_headers_sent"] = true; } fputs($fp, $string); } } function __nw_libphp_shutdown() { ob_end_flush(); fclose($GLOBALS["__nw_libphp_pipe"]); } function nwheader($header) { $GLOBALS["__nw_libphp_headers"][] = $header; } function nwheaders_sent() { return(isset($GLOBALS["__nw_libphp_headers_sent"])); } ?>nanoweb_2.2.9/modules/mod_auth_htpasswd.php0000644000000000000000000000322611023557654017646 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_htpasswd AuthRealm = your auth realm name here AuthRequire = HTPASSWD AuthHtpasswdFilename = /var/www/vhosts/www.example.com/admin/.htpasswd */ class mod_auth_htpasswd { function mod_auth_htpasswd() { $this->modtype="auth_htpasswd"; $this->modname="apache compatible .htpasswd authentication"; } function auth($user, $pass, $args) { $authfile=file(access_query("authhtpasswdfilename", 0)); $authcount=count($authfile); for ($a=0;$a<=$authcount;$a++) { $lp=explode(":", trim($authfile[$a])); $authdata["users"][$lp[0]]["login"]=$lp[0]; $authdata["users"][$lp[0]]["des-password"]=$lp[1]; } $hash=$authdata["users"][$user]["des-password"]; $thash=crypt($pass ,substr($hash, 0, 2)); return ($hash===$thash); } } ?> nanoweb_2.2.9/modules/mod_auth_mysql.php0000644000000000000000000000537611023557654017166 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_mysql AuthRealm = your auth realm name here AuthRequire = MYSQL AuthMysqlHost = localhost AuthMysqlUser = db_user AuthMysqlPass = db_pass AuthMysqlDB = db_name AuthMysqlTable = table_name AuthMysqlPassType = plain | crypt | md5 | mysql AuthMysqlLoginColumn = login_field_name AuthMysqlPassColumn = password_field_name Password types are plain : password is plaintext crypt : password is hashed using the system crypt() md5 : password is hashed using the md5 algorithm mysql : password is hashed using the mysql password algorithm */ class mod_auth_mysql { function mod_auth_mysql() { $this->modtype="auth_mysql"; $this->modname="MySQL authentication"; } function auth($user, $pass, $args) { $host=access_query("authmysqlhost", 0); $dbuser=access_query("authmysqluser", 0); $dbpass=access_query("authmysqlpass", 0); $dbname=access_query("authmysqldb", 0); $tbname=access_query("authmysqltable", 0); $lname=access_query("authmysqllogincolumn", 0); $pname=access_query("authmysqlpasscolumn", 0); $ps="'".addslashes($pass)."'"; switch (strtolower(access_query("authmysqlpasstype", 0))) { case "crypt": $pstr="encrypt(".$ps.")"; break; case "md5": $pstr="md5(".$ps.")"; break; case "mysql": $pstr="password(".$ps.")"; break; case "plain": default: $pstr=$ps; } if ($cid=@mysql_pconnect($host, $dbuser, $dbpass)) { mysql_select_db($dbname, $cid); if ($q=@mysql_query("select 1 from ".$tbname." where ".$lname."='".addslashes($user)."' and ".$pname."=".$pstr)) { $r=mysql_num_rows($q); mysql_free_result($q); $auth=($r>0); } else { techo("WARN: mod_auth_mysql could not fetch '$lname' and '$pname' from table '$tbname'", NW_EL_WARNING); } } else { techo("WARN: mod_auth_mysql could not connect to database '$dbname@$host'", NW_EL_WARNING); } return($auth); } } ?> nanoweb_2.2.9/modules/mod_auth_nwauth.php0000644000000000000000000000313311023557654017314 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_nwauth AuthRealm = your auth realm name here AuthRequire = NWAUTH AuthNwauthFilename = /var/www/vhosts/www.example.com/admin/.nwauth */ class mod_auth_nwauth { function mod_auth_nwauth() { $this->modtype="auth_nwauth"; $this->modname="backwards compatible .nwauth authentication"; } function auth($user, $pass, $args) { $authfile=file(access_query("authnwauthfilename", 0)); $authcount=count($authfile); for ($a=1;$a<=$authcount;$a++) { $lp=explode(":", trim($authfile[$a])); $authdata["users"][$lp[0]]["login"]=$lp[0]; $authdata["users"][$lp[0]]["des-password"]=$lp[1]; } $hash=$authdata["users"][$user]["des-password"]; $thash=crypt($pass ,substr($hash, 0, 2)); return ($hash===$thash); } } ?> nanoweb_2.2.9/modules/mod_auth_simple.php0000644000000000000000000000263611023557654017306 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_simple AuthRealm = your auth realm name here AuthRequire = SIMPLE AuthSimpleUserPass = login1 pass1 AuthSimpleUserPass = login2 pass2 ... AuthSimpleUserPass = loginN passN */ class mod_auth_simple { function mod_auth_simple() { $this->modtype="auth_simple"; $this->modname="Simple authentication"; } function auth($user, $pass, $args) { foreach (access_query("authsimpleuserpass") as $asup) { $lp=explode(" ", $asup); if (($lp[0]==$user) && ($lp[1]==$pass)) { $auth=true; break; } } return($auth); } } ?> nanoweb_2.2.9/modules/mod_html_filters.php0000644000000000000000000001034711023557654017466 0ustar rootrootwml conversion if requested by client # Filter = dont/use! garbage # # class mod_html_filters { function mod_html_filters() { $this->modtype = "pfilter_registration"; $this->modname = "HTML Filters"; register_filter("shrink", new filter_shrink(), NW_PFILTER_ALL); register_filter("downcase", new filter_downcase(), NW_PFILTER_ALL); register_filter("wap", new filter_wap(), NW_PFILTER_ALL); register_filter("garbage", new filter_garbage(), NW_PFILTER_ALL); } } class filter_shrink extends pfilter { function filter_func(&$lf, $args) { $lf = preg_replace('/>\s+<', $lf); if (stristr('content_length = strlen($lf); } } class filter_downcase extends pfilter { function filter_func(&$lf, $args) { $lf = preg_replace('/<([-_\/:.\w\d]+)(.*?)>/me', '"<" . strtolower("\\1"). $this->downcase_attrs("\\2") . ">"', $lf); $this->content_length = strlen($lf); } function downcase_attrs($string) { return( preg_replace('/(\s[a-zA-Z]+)(?:(=)([^"\'][^\s]*|"[^">]*?"|\'[^\'>]*?\'))?/me', 'preg_replace("/\s+/m", " ", strtolower("\\1\\2")) . $this->addquotes("\\3")', $string) ); } function addquotes($string) { if (($string[0] != '"') && ($string[0] != "'")) { return('"' . htmlentities($string) . '"'); } else { return($string); } } } class filter_wap extends pfilter { function filter_func(&$wml, $args) { global $out_contenttype, $out_add_headers, $htreq_headers; if (strpos($out_contenttype, 'html') !== false) if ( (strpos($htreq_headers['ACCEPT'], 'application/vnd.wap.wml') !== false) || (strpos($htreq_headers['ACCEPT'], 'text/wml') !== false)) { preg_match('#^(.*)]*>(.*)]*>(.+)<#i', $uu[1], $uu)) { $title = $uu[1]; } else { $title = "untitled document"; } $from_orig = array('br', '/tr', 't[dfh]', '[h]', '/[h]', 'li', '/li', '[fcdgjklmnoqrvwxyz]', '/[fcdgjklmnoqrvwxyz]', '/*t\w+', '/*img', '/*table', '/*[uo]l', '/*input'); $to_wml = array("
    ", " |
    ", " | ", "", "
    ", '* ', '
    ', "", ""); foreach ($from_orig as $value) { $from_html[] = '#<' . $value . '[^>]*>#ims'; } if (preg_match('#]*>(.+)<#i', $wml, $uu)) { $title = $uu[1]; } else { $title = "untitled document"; } $wml = preg_replace('#^.{0,4096}]*?>#is', '', $wml); $wml = preg_replace('#", " |
    ", " | ", "", "
    ", '* ', '
    ', "", ""); foreach ($from_orig as $value) { $from_html[] = '#<' . $value . '[^>]*>#ims'; } $wml = preg_replace($from_html, $to_wml, $wml); $wml = preg_replace( array('/ /', '/ä/', '/ö/', '/ü/', '/Ä/', '/Ö/', '/Ü/', '/ß/', '/­/', '/&[#a-z0-9]+;/'), array(' ', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß', ' ', '?'), $wml); $wml = preg_replace('/(]+>)(.+?)(<\/a>)/imse', '"\\1" . strip_tags("\\2") . "\\3"', $wml); # filter_downcase::filter_func($wml, ""); $wml = '' . '' . ''. '' . '

    ' . "$wml"; '

    '; $out_add_headers["Content-Type"] = "application/vnd.wap.wml"; $this->content_length = strlen($wml); } } } class filter_garbage extends pfilter { function filter_func(&$lf, $args) { $lf = strtr($lf, '<>', '()'); } } ?>nanoweb_2.2.9/modules/mod_img_filters.php0000644000000000000000000000547311023557654017302 0ustar rootroot class mod_img_filters { function mod_img_filters() { $this->modtype = "pfilter_registration"; $this->modname = "Image Filters"; } function init() { if (function_exists("imagecreatefromstring")) { register_filter("copyright", new filter_copyright(), NW_PFILTER_ALL); register_filter("convert", new filter_convert(), NW_PFILTER_ALL); register_filter("wbmp", new filter_wbmp(), NW_PFILTER_ALL); } } } class image_pfilter extends pfilter { function process_image() { } function filter_func(&$lf, $args) { global $out_contenttype, $conf; $mime = $out_contenttype; $this->img_type = strtolower(substr($mime, strpos($mime, "/") + 1)); if ($this->img = imagecreatefromstring($lf)) { if ($this->img_type == "gif") { $this->img_type = "png"; } $this->img_width = imagesx($this->img); $this->img_height = imagesy($this->img); // work on image $this->process_image(); // write new image to file $img_tmpfile = tempnam($conf["global"]["tmpdirectory"], "nwimgfilt"); eval(" image{$this->img_type} ( \$this->img, \$img_tmpfile ); "); imagedestroy($this->img); if ($f = fopen($img_tmpfile, NW_BSAFE_READ_OPEN)) { $lf = fread($f, 1024*1024); fclose($f); $this->content_length = strlen($lf); $out_contenttype = "image/" . $img_type; } unlink($img_tmpfile); } } } class filter_copyright extends image_pfilter { function process_image() { if ($this->img_type == "jpeg") { $str_color = 0xFFFFFF; } else { $str_color = 1; } imagestring($this->img, 1, $this->img_width - 1 - 5 * strlen($this->args), $this->img_height - 8, $this->args, $str_color); } } class filter_convert extends image_pfilter { function process_image() { $this->img_type = $this->args; } } class filter_wbmp extends image_pfilter { function process_image() { global $htreq_headers; if (strpos($htreq_headers["ACCEPT"], "wbmp") !== false) { $this->img_type = "wbmp"; @list($dx, $dy) = explode("x", $this->args); if (($dx > 0) && ($dy > 0)) { $scale = $dx / $this->img_width; $scale2 = $dy / $this->img_height; if ($scale2 < $scale) { $scale = $scale2; } if ($scale < 1.0) { $x = (int) ($this->img_width * $scale); $y = (int) ($this->img_height * $scale); $smallimg = imagecreate($x, $y); imagecopyresized($smallimg, $this->img, 0, 0, 0, 0, $x, $y, $this->img_width, $this->img_height); imagedestroy($img); $img = $smallimg; unset($smallimg); } } } } } ?>nanoweb_2.2.9/modules/mod_pfilters.php0000644000000000000000000001632711023557654016626 0ustar rootroot /// /// /// # .nwaccess: /// /// FilterEnable = 1 /// Filter = */* null /// Filter = */* unchunk 128 /// Filter = text/html pipe /usr/bin/tidy -clean -latin1 -quiet /// Filter = text/xhtml pipe /usr/bin/tidy -xml -q /// Filter = .bak null /// Filter = .html|doc null /// /// Note: "*/*" can now be abbreviated as "*" or left out // ------------------------------------------ std nanoweb module corp --- class mod_pfilters { function mod_pfilters() { $this->modtype="core_before_response"; $this->modname="Filter support"; // this one works with static, parsed and chunked: register_filter("null", new pfilter(false, "filter_null"), NW_PFILTER_ALL|NW_PFILTER_MORE); // any external program with this one: register_filter("pipe", new filter_pipe(false, "piping through arbitrary filter programs"), NW_PFILTER_ALL|NW_PFILTER_MORE); // this one makes many other filters happy: register_filter("unchunk", new filter_unchunk(false, "filter to resemble chunky parser content"), NW_PFILTER_CHUNKY); } function main() { global $pfilters, $lf, $out_contenttype, $chunky, $keepalive, $http_version; $used_filters = array(); $chunky = !isset($lf->content_length) || ($lf->content_length == NW_PLF_MAGIC); $hbn = basename($GLOBALS["http_uri"]); $hbnext = array_flip(explode(".", $hbn)); // assign filters if (access_query("filterenable", 0)) foreach (access_query("filter") as $filter_rule) { // split rule into: [ mime/ext _ filter _ fargs ] list($mimematch, $filter_rule) = explode(" ", ltrim($filter_rule), 2); @list($fname, $fargs) = explode(" ", ltrim($filter_rule), 2); $fargs = trim($fargs); // check for missing mime match if (empty($fname) || empty($pfilters[strtolower($fname)])) { if ((strpos($mimematch, "/")===false) && (strpos($mimematch, "|")===false) && (strpos($mimematch, "*")===false) && (strpos($mimematch, ".")===false)) { $fargs = $fname . " " . $fargs; $fname = $mimematch; $mimematch = "*/*"; } } // is filter available $fname = strtolower($fname); if (empty($pfilters[$fname])) { techo("filter '$fname' not available", NW_EL_ERROR); continue; } // match mime / extension @list($mime, $uu) = explode(";", $out_contenttype, 2); $mime = trim($mime); $no_match = true; foreach (explode("|", $mimematch) as $match) { $ext = ltrim($match, "."); if (($match == $mime) || ($match == "*/*") || ($match == "*") || (strpos($match, '*')!==false) && (strpos($mime, rtrim($match, "*"))!==false) || ($hbn==$match) || isset($hbnext[$ext]) ) { $no_match = false; break; } } if ($no_match) { continue; } // most filters _may_ be used once only if (@$used_filters[$fname]++ && !($pfilters[$fname][1] & NW_PFILTER_MORE)) { continue; } // convert to parser object (this should have been done already in the core) if (! is_object($lf)) { $lf = new static_response($lf); } // real-static or parsed/chunked $fflags = $pfilters[$fname][1]; if ( (NW_PFILTER_IMMEDIATE & $fflags) || (NW_PFILTER_STATIC & $fflags) && is_a($lf, "static_response") ) { // filter content on the fly / immediate $GLOBALS["first_chunk"]=true; $pfilters[$fname][0]->filter_func($lf->str, $fargs); $lf->content_length=strlen($lf->str); techo("filter '$fname' run on static \$lf content", NW_EL_DEBUG); } elseif (($fflags & NW_PFILTER_ALL) >= NW_PFILTER_PARSED) { if ($chunky && !($fflags & NW_PFILTER_CHUNKY)) { continue; } // create wrapper around current $lf $newf = $pfilters[$fname][0]; $newf->pp = $lf; $newf->args = $fargs; $newf->fflags = $fflags; $newf->content_length = $lf->content_length; $lf = $newf; unset($newf); techo("filter object '$fname' wrapped around current \$lf object", NW_EL_DEBUG); } }#foreach(filter_rule) core_modules_hook("after_pfilters"); }#main } // --------------------------------------------- global register func --- define("NW_PFILTER_STATIC", 1); # really static define("NW_PFILTER_PARSED", 2); # simple parsed (read at once) define("NW_PFILTER_CHUNKY", 4); # content is read in multiple steps define("NW_PFILTER_ALL", 7); define("NW_PFILTER_MORE", 8); # filter can be applied more than once define("NW_PFILTER_IMMEDIATE", 16); # applied as 'static'-filter function register_filter($name, $func, $pflags=NW_PFILTER_STATIC) { global $pfilters; if (is_object($func)) { $pfilters[$name] = array($func, $pflags); } else { $pfilters[$name] = array(new pfilter($func, $func), $pflags); } } // ---------------------------------------------- generic filter class --- class pfilter { var $pp; // "parser parent" var $modtype = "pfilter"; function pfilter($func=false, $name=false) { if ($func && function_exists($func)) { $this->real_filter_func = $func; } if (!$name) { $name = get_class($this); } $this->modname = $name; } function filter_func(&$lf, $args) { if ($func = $this->real_filter_func) { $func($lf, $args); } } function parser_open($args, $filename, $rq_err, $cgi_headers) { return($this->pp->parser_open($args, $filename, $rq_err, $cgi_headers)); } function parser_eof() { return($this->pp->parser_eof()); } function parser_close() { unset($this->content_length); return($this->pp->parser_close()); } function parser_get_output() { $this->content_length = $this->pp->content_length; $tmp = $this->pp->parser_get_output(); $this->filter_func($tmp, $this->args); techo("pfilter(" . get_class($this) .")->content_length=" . $this->content_length, NW_EL_DEBUG); return($tmp); } } // ---------------------------------------------------- core filters --- class filter_pipe extends pfilter { function filter_func(&$lf, $f_args) { if ($GLOBALS["chunky"]) { techo("WARN: you must run the 'unchunk' filter before using 'pipe'!", NW_EL_WARNING); return; } list($f_prog, $f_args) = explode(" ", $f_args, 2); if (is_executable($f_prog)) { $lf_tmpfile = tempnam($conf["global"]["tempdirectory"][0], "nweb_filter."); $fp = fopen($lf_tmpfile, NW_BSAFE_WRITE_OPEN); fwrite($fp, $lf); fclose($fp); $f_cmd = $f_prog . " " . $f_args . " < " . $lf_tmpfile; if ($fp = @popen($f_cmd, NW_BSAFE_READ_OPEN)) { $line = 0; while (! feof($fp)) { if (! ($line++)) { $lf = ""; } $lf .= fgets($fp); } pclose($fp); } ## else techo("WARN: cannot open pipe to '".$f_prog."'"); $this->content_length = strlen($lf); unlink($lf_tmpfile); } } } class filter_unchunk extends pfilter { function parser_get_output() { global $chunky, $first_chunk; $tmp = ""; $maxsize = $this->args ? $this->args * 1024 : 131072; while ((strlen($tmp) < $maxsize) && !($eof = $this->pp->parser_eof())) { $tmp .= $this->pp->parser_get_output(); } $this->content_length = $this->pp->content_length; if ($eof && $first_chunk) { $chunky = false; $this->content_length = strlen($tmp); } return($tmp); } } ?>nanoweb_2.2.9/modules/mod_proxy.php0000644000000000000000000002713711023557654016160 0ustar rootrootmodtype="core_after_decode"; $this->modname="Nanoweb mod_proxy"; } function main(){ global $http_action, $http_uri, $add_errmsg, $pri_redir, $conf, $pri_err, $lf, $http_action, $query_string, $htreq_headers; global $out_contenttype; if (substr($GLOBALS["real_uri"], 0, 7)=="http://") { if (strpos($GLOBALS["remote_ip"], $conf["global"]["proxyallowip"][0])===0) { // A setter en fait en fonction de la réponse du serveur distant (200 le + souvent) $pri_err=200; if($conf["global"]["proxyanonyme"][0]==1){ if(isset($conf["global"]["proxyuseragent"][0])) $this->user_agent = $conf["global"]["proxyuseragent"][0]; else $this->user_agent = "aEGiS nanoweb mod_proxy"; if(isset($conf["global"]["proxyreferer"][0])) $this->referer = $conf["global"]["proxyreferer"][0]; else $this->referer = "http://dtc.fr.st/"; if(isset($conf["global"]["proxyip"][0])) $this->forward = $conf["global"]["proxyip"][0]; else $this->forward = "192.168.100.1"; }else{ $this->user_agent = $htreq_headers["USER-AGENT"]; $this->referer = $htreq_headers["REFERER"]; } $this->url = $http_uri; $this->cache_d = strtolower($conf["global"]["proxycachedir"][0]); $deny_access = $this->_deny_access(); if ($deny_access == false){ $this->url_parse = parse_url($this->url); $this->encoded_path = urlencode($this->url_parse['path']); $this->ask_path = str_replace(" ", "%20", $this->url_parse['path']); $this->cache_exist = false; $this->not_create_cache = false; $this->_check_cache(); if (! $this->cache_exist){ $this->_read_page(); // séparer dans le buffer (ou stocker séparément?) les headers du contenu, mettre les headers // dans $out_add_headers (et $out_contenttype pour le cas spécial du header content-type. // le contenu lui va dans $lf $this->_get_header($this->bufcach); if ($this->not_create_cache == false){ $this->_create_cache(); } } $this->_write_cache_log($this->url); $lf_str = $this->_remove_header($this->bufcach); if ($out_contenttype == "text/plain" || $out_contenttype == "text/html") $lf_str = $this->_deny_pub($lf_str); if (version_compare(VERSION, "1.9")<0) { // nanoweb 1.8.x and < $lf = $lf_str; } else { // nanoweb 1.9.x and > $lf = new static_response($lf_str); } }else{ $pri_err = 500; $add_errmsg = "the remote page could not be processed.
    You are not allowed to see this bad sites
    "; } }else{ $pri_err = 500; $add_errmsg = "you are not allowed to use this proxy"; } } } function _open_page(){ global $add_errmsg, $pri_err; if(!$this->url_parse['port']) $this->url_parse['port'] = 80; $fp = fsockopen ($this->url_parse['host'], $this->url_parse['port'], $errno, $errstr, 10); if (!$fp){ $add_errmsg = "the remote page could not be processed
    reason : $errno ($errstr).
    "; $pri_err = 500; } return $fp; } function _read_page(){ global $htreq_content, $http_action, $query_string, $htreq_headers, $sck_connected, $dp, $pn, $htreq_headers; global $mime, $rq_file, $mimetype, $conf, $out_contenttype, $pri_err; if ($mimetype=$mime[strtolower($rq_file["extension"])]) $out_contenttype=$mimetype; else $out_contenttype=$conf["global"]["defaultcontenttype"][0]; if ($query_string) $query="?$query_string"; if ($http_action == "POST" || $http_action == "PUT"){ $command = $http_action." ".$this->ask_path.$query.$this->url_parse['fragment']." HTTP/1.0\r\n"; $command .= "Host: ".$this->url_parse['host']."\r\n"; $command .= "User-agent: ".$this->user_agent."\r\n"; $command .= "Cookie: ".$htreq_headers['COOKIE']."\r\n"; $command .= "Content-type: application/x-www-form-urlencoded\r\n"; $command .= "Referer: ".$this->referer."\r\n"; $command .= "Via: aEGiS nanoweb mod_proxy\r\n"; $command .= "X-Forwarded-For: ".$this->forward."\r\n"; $command .= "Content-Length: ".strlen($htreq_content)."\r\n\r\n"; $command .= $htreq_content."\r\n"; }else{ $command = $http_action." ".$this->ask_path.$query." HTTP/1.0\r\nHost: ".$this->url_parse['host']."\r\n"; $command .= "Content-type: ".$out_contenttype."\r\n"; $command .= "Cookie: ".$htreq_headers['COOKIE']."\r\n"; $command .= "Referer: ".$this->referer."\r\n"; $command .= "User-agent: ".$this->user_agent."\r\n"; $command .= "Via: aEGiS nanoweb mod_proxy\r\n"; $command .= "X-Forwarded-For: ".$this->forward."\r\n\r\n"; } $no_dns = false; @exec("nslookup -sil ".$this->url_parse['host'], $output ); $tmp = join(" ",$output); if (strstr("not found",$tmp)) $no_dns = true; if (!$no_dns){ $fp = $this->_open_page(); if ($fp){ fputs ($fp, $command); unset ($this->bufcach); while(! feof($fp)){ $tmp = fread($fp, 4096); $this->bufcach .= $tmp; } } }else{ $add_errmsg = "the remote page could not be processed."; $pri_err = 500; } $this->_close_page($fp); } function _close_page($fp){ fclose($fp); } function _get_header($file){ global $out_contenttype, $http_action, $out_add_headers, $pri_err; $headerend = strpos($file,"\r\n\r\n"); $headers = substr($file,0,$headerend); $this->not_create_cache = $this->check_pub = false; $tmp = explode("\r\n",$headers); for ($i=0;$i $this->cache_date) $last_modif = true; else $this->cache_exist = false; } else if (preg_match("/set-cookie/i",$tmp[$i])){ $out_add_headers["cookies"][] = eregi_replace("set-cookie: ","",$tmp[$i]); } else if (preg_match("/WWW-Authenticate/i",$tmp[$i])){ $realm = explode("\"",$tmp[$i]); } else if (preg_match("/^location/i",$tmp[$i])){ $location = eregi_replace("location: ","",$tmp[$i]); $http_action = "GET"; $pri_err = 302; if (substr($location, 0, 7)=="http://") { $url_parse = parse_url($location); $out_add_headers["Location"] = $location; }elseif (substr($location,0,1)=="/"){ $out_add_headers["Location"] = $location; }else{ $out_add_headers["Location"] = "/".$location; } } else if (preg_match("/X-Cache/i",$tmp[$i])){ $this->not_create_cache = true; } else if (preg_match("/cache-control/i",$tmp[$i])){ if (strstr($tmp[$i],"no-cache") || strstr($tmp[$i],"no-store") || strstr($tmp[$i],"private")){ $this->not_create_cache = true; } } } } function _remove_header($file){ $headerend = strpos($file,"\r\n\r\n"); if (is_bool($headerend)){ $result = $file; }else{ $result = substr($file,$headerend+4,strlen($file) - ($headerend+4)); } return $result; } function _check_cache(){ global $query_string; if (is_dir($this->cache_d."/".$this->url_parse['host'])){ if ($query_string) $query = urlencode("?".$query_string); if (file_exists($this->cache_d."/".$this->url_parse['host']."/".$this->encoded_path.$query)){ $stat_f = stat($this->cache_d."/".$this->url_parse['host']."/".$this->encoded_path); $this->cache_date = $stat_f[8]; $fp = $this->_open_page(); fputs ($fp,"GET ".$this->url_parse['path']." HTTP/1.0\r\nHost: ".$this->url_parse['host']."\r\nUser-agent: ".$this->user_agent."\r\nIf-Modified-Since: ".$this->cache_date."\r\nConnection: close\r\n\r\n"); while (!feof($fp)){ $tmp = fgets($fp,128); if (preg_match("/^last-modified/i",$tmp)){ $xp_date = explode(":",$tmp); $timestamp = strtotime($xp_date[1]); if ($timestamp > $this->cache_date) $last_modif = true; } $header .= $tmp; } $this->_close_page($fp); if ($last_modif){ $this->cache_exist = false; }else{ $time = time(); if ($time > $this->cache_date + $conf["global"]["proxycachemaxage"][0] ){ $this->cache_exist = false; }else{ $cache = fopen($this->cache_d."/".$this->url_parse['host']."/".$this->encoded_path.$query,"rb"); while (!feof($cache)) { $this->bufcach .= fread($cache, 4096); } fclose ($cache); $this->cache_exist = true; $this->_get_header($this->bufcach); } } } } } function _create_cache(){ global $query_string; if ($query_string) $query = urlencode("?".$query_string); mkdir($this->cache_d."/".$this->url_parse['host'], 0755); $cache = fopen($this->cache_d."/".$this->url_parse['host']."/".$this->encoded_path.$query,"wb"); fwrite($cache, $this->bufcach); fclose($cache); } function _write_cache_log($file){ $str = date("m/d H:i")." ".$file." ".$GLOBALS["remote_ip"]."\n"; $log = fopen(strtolower($conf["global"]["proxyaccesslog"][0])); fputs($log,$str); fclose($log); } function _deny_pub($str){ global $conf; $tmp = explode("\n",$str); $find = false; unset ($str); for ($i=0;$iurl,$buf)){ $block = true; break; } } fclose ($fp); } return $block; } } ?> nanoweb_2.2.9/modules/mod_static.php0000644000000000000000000001305111023557654016254 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_static { function mod_static() { $this->modtype="parser_static"; $this->modname="Static content support"; } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $conf, $htreq_headers; unset($this->fp); // Generate ETag value for resource $fmt=filemtime($filename); $fs=filesize($filename); $etag="\"".dechex(fileinode($filename)).":6r0x:".dechex($fmt).":".dechex($fs)."\""; $rq_ifm=$rq_ifnm=$rq_ims=$rq_ius=true; // Test If-Match request header (cache helper) if ($hdr_inm=$htreq_headers["IF-MATCH"]) { $rq_ifm=false; $inms=explode(",", trim($hdr_inm)); foreach ($inms as $inm_tag) { $inm_tag=trim($inm_tag); if ($inm_tag==$etag || $inm_tag=="*") { $rq_err=304; $cgi_headers["ETag"]=$etag; $rq_ifm=true; } } } // Test If-None-Match request header (cache helper) if ($hdr_inm=$htreq_headers["IF-NONE-MATCH"]) { $inms=explode(",", trim($hdr_inm)); foreach ($inms as $inm_tag) { $inm_tag=trim($inm_tag); if ($inm_tag==$etag || $inm_tag=="*") { $rq_err=304; $cgi_headers["ETag"]=$etag; $rq_ifnm=false; } } } // Test If-Unmodified-Since request header (cache helper) if ($lmdate=$htreq_headers["IF-UNMODIFIED-SINCE"]) { $lmdate=(float)strtotime($lmdate); if ($fmt>$lmdate) { $rq_err=304; $cgi_headers["Last-Modified"]=gmdate("D, d M Y H:i:s T", $fmt); $rq_ims=false; } } // Test If-Modified-Since request header (cache helper) if ($lmdate=$htreq_headers["IF-MODIFIED-SINCE"]) { $lmdate=(float)strtotime($lmdate); if ($fmt<=$lmdate) { $rq_err=304; $cgi_headers["Last-Modified"]=gmdate("D, d M Y H:i:s T", $fmt); $rq_ius=false; } } if (!($rq_ifm && $rq_ifnm && $rq_ims && $rq_ius)) { $this->peof=true; return(false); } // Cache helpers end $this->rng_from=0; $this->content_length=$this->rng_to=$fs; $cgi_headers["Last-Modified"]=gmdate("D, d M Y H:i:s T", $fmt); $cgi_headers["ETag"]=$etag; $cgi_headers["Accept-Ranges"]="bytes"; if ($rngt=trim($htreq_headers["IF-RANGE"])) { $process_range=($rngt==$etag); } else $process_range=true; if (($process_range) && ($rhdr=$htreq_headers["RANGE"])) { // Client asked HTTP Resume if (!access_query("staticdisablepartial", 0)) { $tmparr=explode("=", $rhdr); if (strtolower(trim($tmparr[0]))=="bytes") { $rngarr=explode("-", $tmparr[1]); if ($rngarr[0]==="") { // Range: bytes=-### if ($rngarr[1]>$fs) { $rng_from="*"; } else { $rng_from=$fs-$rngarr[1]; $rng_to=$fs-1; } } else if ($rngarr[1]=="") { // Range: bytes=###- if ($rngarr[0]>$fs) { $rng_from="*"; } else { $rng_from=$rngarr[0]; $rng_to=$fs-1; } } else { // Range: bytes=###-### if (($rngarr[0]>$fs) || ($rngarr[1]>$fs) || ($rngarr[0]>$rngarr[1])) { $rng_from="*"; } else { $rng_from=$rngarr[0]; $rng_to=$rngarr[1]; } } } else { // Ranges unit not supported $rng_from="*"; } if ($rng_from==="*") { // Send all content with 416 $rq_err=416; $cgi_headers["Content-Range"]="*"; } else { // Send partial content $rq_err=206; $this->rng_from=$rng_from; $this->rng_to=$rng_to; $this->content_length=($rng_to-$rng_from)+1; $cgi_headers["Content-Range"]="bytes ".$rng_from."-".$rng_to."/".$fs; } } else { // Partial content has been disabled in conf $rq_err=416; $cgi_headers["Content-Range"]="*"; } } if ($this->fp=@fopen($filename, NW_BSAFE_READ_OPEN)) { if ($this->rng_from) { fseek($this->fp, $rng_from); $this->cur_ptr=$rng_from; } else { $this->cur_ptr=0; } $this->peof=false; // Return a static_response if possible if ($this->content_length<=$conf["global"]["staticbuffersize"][0]) { $content=fread($this->fp, $this->content_length); $this->parser_close(); return(new static_response($content)); } } else { $rq_err=404; $this->peof=true; } } function parser_get_output() { if ($this->fp) { $sbf=$GLOBALS["conf"]["global"]["staticbuffersize"][0]; if ($this->cur_ptr+$sbf<=$this->rng_to) $read_len=$sbf; else $read_len=$this->rng_to-$this->cur_ptr+1; $content=fread($this->fp, $read_len); $this->cur_ptr+=$read_len; $this->peof=$this->cur_ptr>=$this->rng_to; return($content); } } function parser_eof() { return($this->fp && $this->peof); } function parser_close() { if ($this->fp) fclose($this->fp); unset($this->content_length); } } ?> nanoweb_2.2.9/modules/mod_misc_filters.php0000644000000000000000000000611711023557654017455 0ustar rootroot class mod_misc_filters { function mod_misc_filters() { $this->modtype = "pfilter_registration"; $this->modname = "Miscellaneous/Control Filters"; } function init() { register_filter("error", new filter_control_error(), NW_PFILTER_IMMEDIATE | NW_PFILTER_MORE); register_filter("addheader", new filter_control_addheader(), NW_PFILTER_IMMEDIATE | NW_PFILTER_MORE); register_filter("nocache", new filter_control_nocache(), NW_PFILTER_IMMEDIATE); register_filter("addservervar", new filter_control_addservervar(), NW_PFILTER_IMMEDIATE | NW_PFILTER_MORE); register_filter("handler", new filter_handler(), NW_PFILTER_ALL); } } class filter_control_error extends pfilter { function filter_func(&$lf, $args) { if (($rq_err = (int) trim($args)) <= 0) { $rq_err = 500; } $GLOBALS["rq_err"] = $rq_err; $GLOBALS["lf"] = $GLOBALS["null_response"]; } } class filter_control_addheader extends pfilter { function filter_func(&$lf, $args) { list($hd_key, $hd_val) = explode(":", trim($args)); if ($hd_key && $hd_val) { $GLOBALS["out_add_headers"][$hd_key] = ltrim($hd_val); } } } class filter_control_nocache extends filter_control_addheader { function filter_func(&$lf, $args) { global $out_add_headers; $out_add_headers["Cache-Control"] = $out_add_headers["Pragma"] = "no-cache"; } } class filter_control_addservervar extends pfilter { function filter_func(&$lf, $args) { $del = strpos($args, "="); $del2 = strpos($args, " "); if ($del2<$del) {$del=$del2;} $GLOBALS["add_nsv"][ substr($args,0,$del) ] = substr($args,$del+1); } } //-- a "pipe" variant class filter_handler extends pfilter { function parser_get_output() { global $docroot, $http_uri, $path_info, $rq_err, $out_add_headers, $pri_parser, $add_nsv, $lf; // mk absolute paths if (!($dest_handler = realpath($this->args)) && !($dest_handler = realpath($docroot . $this->args))) { return; } $rq_dest = pathinfo($dest_handler); $path_info = "/" . $http_uri; $http_uri = $this->args; unset($add_nsv); $add_nsv["SCRIPT_FILENAME"] = $add_nsv["PATH_TRANSLATED"] = $dest_handler; $add_nsv["REDIRECT_STATUS"] = "200"; $add_nsv["SCRIPT_NAME"] = $this->args; $add_nsv["REDIRECT_URL"] = $path_info; $add_nsv["REQUEST_URI"] = $path_info; #print_r($add_nsv); // clean parent parser, as it will be removed if (is_object($this->pp)) { $this->pp->parser_close(); $this->pp->peof = true; } #print_r($this); // replace $this with CGI module $lf = loadfile($dest_handler, $rq_dest["extension"], $rq_err, $out_add_headers, $pri_parser); #print_r($ps); return($lf->parser_get_output()); } } ?>nanoweb_2.2.9/modules/mod_ac.php0000644000000000000000000001456111023557654015357 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage (works in a vhost section or access file) simple mode : ACDenyHost = *.aol.com ACBlockMessage = Go to hell or ACPolicy = deny ACAllowIP = 10.0.0.* ACAllowIP = 192.168.* ACAllowHost = *.localdomain or more advanced ACClassHost = LAME *.aol.com ACClassHost = LAME *.riaa.org ACClassHost = PHEAR *.gov ACDenyClass = * ACBlockMessageClass = LAME Go to hell ACBlockErrorClass = PHEAR 404 ACBlockMessageClass = PHEAR There is nothing here, really ... ACIPBlockClass = PHEAR perm ACIPBlockClass = LAME 3600 to only reject your favorite browser ACClassHeader = IE User-Agent Mozilla/4.0 (compatible; MSIE* ACClassHeader = IE User-Agent Mozilla/3.0 (compatible; MSIE* ACClassHeader = LYNX User-Agent Lynx/* ACDenyClass = IE ACPolicy : default access control policy (if not specified = allow) ACDenyIP : deny access to specified ip (wildcards allowed) ACAllowIP : allow access to specified ip (wildcards allowed) ACDenyHost : deny access to specified host (wildcards allowed) ACAllowHost : allow access to specified host (wildcards allowed) ACDenyHeader : deny access based on request header (wildcards allowed) ACAllowHeader : allow access based on request header (wildcards allowed) ACBlockError : error code thrown to denied clients (default is 403) ACIPBlock : duration in sec (or "perm") of the IP address ban ACBlockMessage : additionnal error message to send to the client ACClassIP/Host/... : put the request in the specified class ACBlockErrorClass : block with error number for specified class ACBlockMessageClass : block with error message for specified class ACIPBlockClass : duration in sec (or "perm") of the IP address ban */ class mod_ac { var $modtype="core_after_decode"; var $modname="access control lists"; var $ac_filters=array(); function init() { if ($mtds=get_class_methods($this)) foreach ($mtds as $mname) if (strpos($mname, "acfilter_")===0) if ($fname=substr($mname, strpos($mname, "_")+1)) $this->ac_filters[$fname]=$mname; } // Adding a filter is easy, just define a new function here with the name // acfilter_yourfilter, and this will automagically make mod_ac handle new // ACAllow/Deny/Class[YourFilter] directives function acfilter_ip($filter) { global $remote_ip; if ($filter==$remote_ip) return(true); if ($filter==(substr($remote_ip, 0, strlen($filter)-1)."*")) return(true); return(false); } function acfilter_host($filter) { global $remote_host; $filter=strtolower($filter); $host=strtolower($remote_host); if ($filter==$host) return(true); if ($filter==("*".substr($host, (-(strlen($filter)-1))))) return(true); return(false); } function acfilter_header($ftok) { global $htreq_headers; $hdname=strtoupper(strtok($ftok, " ")); $filter=strtolower(strtok("")); $th=strtolower($htreq_headers[$hdname]); if ($filter==$th) return(true); if ($filter==(substr($th, 0, strlen($filter)-1)."*")) return(true); return(false); } function classfilter($classname, $currentclass) { if (!$currentclass) return(false); $filter=strtolower($classname); $cc=strtolower($currentclass); if ($filter==$cc) return(true); if ($filter==(substr($cc, 0, strlen($filter)-1)."*")) return(true); } function fmatch($mtype) { $a=false; foreach ($this->ac_filters as $key=>$mtd) { if ($acf_arr=access_query("ac".$mtype.$key)) foreach ($acf_arr as $acf) if ($this->$mtd($acf)) { $a=true; break; } if ($acc_arr=access_query("acclass".$key)) foreach ($acc_arr as $acc) { $tcl=strtok($acc, " "); $tcf=strtok(""); if ($this->$mtd($tcf)) { $ac_class=$tcl; break; } } } return(array($a, $ac_class)); } function main() { global $add_errmsg, $pri_err, $remote_ip, $remote_host, $lf; switch (access_query("acpolicy", 0)) { case "deny": $ad=$this->fmatch("allow"); $ad[0]=!$ad[0]; if ($dca=access_query("acallowclass")) foreach ($dca as $dc) if ($this->classfilter($dc, $ad[1])) { $ad[0]=false; break; } break; case "allow": default: $ad=$this->fmatch("deny"); if ($dca=access_query("acdenyclass")) foreach ($dca as $dc) if ($this->classfilter($dc, $ad[1])) { $ad[0]=true; break; } break; } if ($ad[0]) { if ($ac_class=$ad[1]) { if ($bea=access_query("acblockerrorclass")) foreach ($bea as $be) if (strtok($be, " ")==$ac_class) { $cl_err=strtok(""); break; } if ($bma=access_query("acblockmessageclass")) foreach ($bma as $bm) if (strtok($bm, " ")==$ac_class) { $cl_msg=strtok(""); break; } if ($iba=access_query("acipblockclass")) foreach ($iba as $ib) if (strtok($ib, " ")==$ac_class) { $cl_ibt=strtok(""); break; } } $pri_err=$cl_err or $pri_err=(int)access_query("acblockerror", 0) or $pri_err=403; $amsg=$cl_msg or $amsg=access_query("acblockmessage", 0); $ibt=$cl_ibt or $ibt=access_query("acipblock", 0); if ($ibt) { if ($ac_class) $ibs=".".$ac_class; else $ibs=""; if (strtolower($ibt)=="perm") { nw_block_ip_address($GLOBALS["remote_ip"], "PERM", "mod_ac".$ibs); } else { nw_block_ip_address($GLOBALS["remote_ip"], "TEMP", "mod_ac".$ibs, time()+$ibt); } } if ($amsg) $add_errmsg.=$amsg."

    "; } } } ?> nanoweb_2.2.9/modules/mod_asis.php0000644000000000000000000000233711023557654015731 0ustar rootrootmodtype = "parser_asis"; $this->modname = "message/http (.asis files) support"; } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $conf, $htreq_headers; parent::parser_open($args, $filename, $rq_err, $cgi_headers); if ($this->fp) { // open secondary (non-bsafe) file pointer $this->fp_C = @fopen($filename, "r"); // read .asis http headers from start of file fseek($this->fp_C, 0); while ($hline = trim(fgets($this->fp_C))) { list($h, $v) = explode(":", $hline, 2); $cgi_headers[$h] = ltrim($v); } // current position == start of content; $this->begin = ftell($this->fp_C); // close C-safe file pointer fclose($this->fp_C); // adjust some values if (($this->rng_to += $this->begin) > $this->content_length) { $this->rng_to = $this->content_length; } $this->content_length -= $this->begin; $this->rng_from += $this->begin; //echo "begin=".$this->begin."\ncontent_length=".$this->content_length."\nrng_from=".$this->rng_from."\n"; // go to real content start in fp fseek($this->fp, $this->rng_from); $this->cur_ptr=$this->rng_from; } } } ?> nanoweb_2.2.9/modules/mod_auth_ldap.php0000644000000000000000000000567311023557654016741 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_nwauth AuthRealm = your auth realm name here AuthRequire = LDAP AuthLDAPServer = ldap.example.com AuthLDAPBindDN = cn=%AUTH_USER%,ou=people,dc=example,dc=com AuthLDAPMatchFilter = (&(attrfilter=val)(httpaccess=on)) In AuthLDAPBindDN, %AUTH_USER% is replaced with the actual login provided by the HTTP client. You may also use %AUTH_USER_U% and %AUTH_USER_D% if you want to allow user@domain type logins. */ class mod_auth_ldap { var $modtype="auth_ldap"; var $modname="LDAP authentication"; function init() { if (!is_callable("ldap_connect")) { techo("WARN: mod_auth_ldap needs a php binary compiled with LDAP support", NW_EL_WARNING); $this->ldapless_php=true; } } function auth($user, $pass, $args) { if ($this->ldapless_php) { return(false); } else if ($ldsrvs=access_query("authldapserver")) { foreach ($ldsrvs as $ld_srv) if ($ld_cid=ldap_connect($ld_srv)) break; if (!$ld_cid) { techo("WARN: mod_auth_ldap: unable to connect to server(s)", NW_EL_WARNING); return(false); } } else { techo("WARN: mod_auth_ldap: no AuthLDAPServer specified", NW_EL_WARNING); ldap_close($ld_cid); return(false); } $ld_dn=access_query("authldapbinddn", 0); $eu=explode("@", $user); $ld_dn=str_replace("%AUTH_USER%", $user, $ld_dn); $ld_dn=str_replace("%AUTH_USER_U%", $eu[0], $ld_dn); $ld_dn=str_replace("%AUTH_USER_D%", $eu[1], $ld_dn); if ($ld_bind=ldap_bind($ld_cid, $ld_dn, $pass)) { if ($ld_filter=access_query("authldapmatchfilter", 0)) { if ($ld_q=ldap_search($ld_cid, $ld_dn, $ld_filter)) { if ($a=ldap_count_entries($ld_cid, $ld_q)) { ldap_close($ld_cid); return(true); } else { ldap_close($ld_cid); return(false); } } else { ldap_close($ld_cid); return(false); } } else { ldap_close($ld_cid); return(true); } } else { ldap_close($ld_cid); return(false); } } } ?> nanoweb_2.2.9/modules/mod_dosevasive.php0000644000000000000000000000402711023557654017140 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_dosevasive { function mod_dosevasive() { $this->modtype="core_after_decode"; $this->modname="DoS evasive maneuvers"; } function main() { global $real_uri, $vhost, $add_errmsg, $pri_err, $query_string; static $detable, $detimer; $t=time(); $tmax=access_query("dosevasivetimer", 0) or $tmax=10; $dmax=access_query("dosevasivemaxreqs", 0) or $dmax=5; if ($t>($detimer+$tmax)) { // Clean table on timer $detable=array(); $detimer=$t; } if ($detable[$vhost.$real_uri.$query_string]>=$dmax) { // Discard request with DosEvasiveError if requested more than DosEvasiveMaxReqs in DocEvasiveTimer seconds $e=access_query("dosevasiveerror", 0) or $e=403; $pri_err=$e; $add_errmsg="You are not allowed to request a resource more than ".(int)$dmax." times in ".(int)$tmax." seconds.

    "; if ($bt=access_query("dosevasiveblocktime", 0)) { if (strtolower($bt)=="perm") { nw_block_ip_address($GLOBALS["remote_ip"], "PERM", "mod_dosevasive"); } else { nw_block_ip_address($GLOBALS["remote_ip"], "TEMP", "mod_dosevasive", time()+$bt); } } } // Update url table $detable[$vhost.$real_uri.$query_string]++; } } ?> nanoweb_2.2.9/modules/mod_meta.php0000644000000000000000000000620111023557654015712 0ustar rootroot data # # MetaFetch = Fast # [ Fast | Regex | no | 0 ] # class mod_meta { var $modtype = "core_after_decode"; # ???unsure??? var $modname = "hypertext meta information support"; var $maxhtmlhead = 16384; function init() { $GLOBALS['mime']["meta"] = "message/http"; # or "httpd/header" } function main() { global $docroot, $http_uri, $out_contenttype, $rq_err, $http_resp, $out_add_headers; if ($method = access_query("metafetch", 0)) { $meta = $this->fetch($docroot.$http_uri, $method); if (file_exists($fmeta = $docroot.$http_uri.'.meta')) { foreach (file($fmeta) as $line) { $p = strpos($line, ':'); if ($h = substr($line, 0, $p)) { $meta['HTTP-EQUIV'][$h] = trim(substr($line, $p+1)); } } } $out_add_headers = array_merge( $out_add_headers, $meta['HTTP-EQUIV'] ); } } function fetch($file, $procedure = "fast") { if (file_exists($file) && ((strpos($file, '.ht')!==false) || (strpos($file, '.xht')!==false))) { return($this->extract($file, $procedure)); } } function extract($file, $procedure = "fast") { $r = array(); if ($f = fopen($file, "r")) { //-- no bin-safe! $orig = $html = ""; $head_end = false; while (!feof($f) && (!$end) && (strlen($html) < $this->maxhtmlhead)) { $in = fread($f, 1024); $orig .= $in; $html .= strtoupper($in); $head_end = strpos($html, ''); } if ($head_end) { switch(strtolower($procedure)) { case "regex": preg_match_all('/]+)(HTTP-EQUIV|NAME)=(?:"([^"]+)"|\'([^\']+)\'|([^\s]+))([^>]*)>/ims',$orig,$uu); foreach ($uu[1] as $i=>$a) { $group = strtoupper($uu[2][$i]); if ($group == "NAME") { $group = "META"; } $name = $uu[3][$i] . $uu[4][$i] . $uu[5][$i]; $rest = $uu[1][$i] . $uu[6][$i]; preg_match('/\bCONTENT=(?:"([^"]+)"|\'([^\']+)\'|([^\s]+))/ims',$rest,$cc); $value = $cc[1] . $cc[2] . $cc[3]; $r[$group][$name] = $value; } break; default: case 1: case "fast": $pos = $m = 0; while (($m = strpos($html, '', $m) + 1; $ev = substr($orig, $m, $pos - $m); $meta_class = strtok($ev, '"'); if (strpos(strtoupper($meta_class), 'HTTP-EQUIV=')!==false) { $name = strtok('"'); while ($attr = strtok('"')) { if (strpos(strtoupper($attr), 'CONTENT=')!==false) { $content = strtok('"'); $r['HTTP-EQUIV'][$name] = $content; } } } } break; case "no": } } } return($r); } } ?>nanoweb_2.2.9/modules/mod_method_PUT.php0000644000000000000000000000413611023557654017001 0ustar rootrootmethods:array()); } function parser_open($uu_args, &$real_uri, &$rq_err, &$out_add_headers, &$out_contenttype) { global $lf, $htreq_headers, $htreq_content, $add_errmsg, $docroot; // guess final error code if (!file_exists($docroot.$real_uri)) { $rq_err = NW_METHOD_PUT_CREATED; $add_errmsg = "Resource created.

    "; } else { $rq_err = NW_METHOD_PUT_OVERWRITTEN; $add_errmsg = "Resource overwritten.

    "; } // unsupported stuff if (! empty($htreq_headers["CONTENT-RANGE"])) { $rq_err = 501; $add_errmsg = "Partially overwriting resources is not implemented. "; } // supported stuff else { // authentication is handled by httpd kernel if (!access_query("writeaccess", 0)) { $rq_err = 403; $add_errmsg = "Only wizards can do that. "; } else { // backup code goes here #... // try to open the file $put_there = fopen($docroot.$real_uri, NW_BSAFE_WRITE_OPEN); // if open failed if (! $put_there) { // may be we'll try ftp-method instead? #... (!is_writeable($docroot.$real_uri) && !trim($logged_user)) $rq_err = 403; $add_errmsg = "Could not open URI for write access. "; } else { fwrite($put_there, $htreq_content); fclose($put_there); } } } // replacing ourselfes with a standard error response $lf = new static_response(nw_error_page($rq_err, $add_errmsg)); } function parser_eof() { $GLOBALS["lf"] = $GLOBALS["null_response"]; return($GLOBALS["rq_err"]=500); } } ?>nanoweb_2.2.9/modules/mod_method_handler.php0000644000000000000000000000375211023557654017751 0ustar rootroot$http_action = $http_action; $this->$handler = ''; if (($http_action != "GET") && ($http_action != "POST") && ($http_action != "HEAD")) foreach (access_query("methodhandler") as $m_h) { list($method, $handler) = explode(" ", $m_h); if ($method == $http_action) { $this->handler = $handler; $http_action = "*"; // we'll get called later again } } } function options() { $methods = array(); foreach (access_query("methodhandler") as $m_h) { $methods[] = strtok($method, " "); } return($methods); } function parser_open($pri_parser_args, &$real_uri, &$rq_err, &$out_add_headers, &$out_contenttype) { global $lf, $http_action, $htreq_content; global $docroot, $http_uri, $path_info, $pri_parser, $add_nsv; // remove "*" again $http_action = $this->http_action; // handler cgi needs absolute path if (!($handler = realpath($docroot . $this->handler))) { $lf = new static_response(nw_error_page($rq_err=500)); } $rq_dest = pathinfo($handler); $path_info = "/" . $http_uri; $http_uri = $this->handler; #-- $add_nsv["SCRIPT_FILENAME"] = $add_nsv["PATH_TRANSLATED"] = $handler; $add_nsv["REDIRECT_STATUS"] = "200"; $add_nsv["SCRIPT_NAME"] = $path_info; $add_nsv["REDIRECT_URL"] = $path_info; $add_nsv["REQUEST_URI"] = $path_info; // replace $this with CGI module return($ps = loadfile($handler, $rq_dest["extension"], $rq_err, $out_add_headers, $pri_parser)); } function parser_eof() { die("something went really wrong"); } } ?>nanoweb_2.2.9/modules/mod_auth_pgsql.php0000644000000000000000000000517511023557654017144 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_pgsql AuthRealm = your auth realm name here AuthRequire = PGSQL AuthPgsqlHost = localhost AuthPgsqlUser = db_user AuthPgsqlPass = db_pass AuthPgsqlDB = db_name AuthPgsqlTable = table_name AuthPgsqlPassType = plain | md5 AuthPgsqlLoginColumn = login_field_name AuthPgsqlPassColumn = password_field_name Password types are plain : password is plaintext md5 : password is hashed using the md5 algorithm */ class mod_auth_pgsql { function mod_auth_pgsql() { $this->modtype="auth_pgsql"; $this->modname="PostgreSQL authentication"; } function auth($user, $pass, $args) { $host=access_query("authpgsqlhost", 0); $dbuser=access_query("authpgsqluser", 0); $dbpass=access_query("authpgsqlpass", 0); $dbname=access_query("authpgsqldb", 0); $tbname=access_query("authpgsqltable", 0); $lname=access_query("authpgsqllogincolumn", 0); $pname=access_query("authpgsqlpasscolumn", 0); $ps=trim($pass); switch (strtolower(access_query("authpgsqlpasstype", 0))) { case "md5": $pstr=md5($ps); break; case "plain": default: $pstr=$ps; } if (is_callable("pg_connect")) { if ($cid=@pg_connect("host=$host user=$dbuser password=$dbpass dbname=$dbname")) { if ($q=@pg_query($cid, "SELECT * FROM $tbname WHERE $lname = '$user' AND $pname = '$pstr'")) { $r=pg_num_rows($q); pg_free_result($q); $auth=($r>0); } else { techo("WARN: mod_auth_pgsql could not fetch '$lname' and '$pname' from table '$tbname'", NW_EL_WARNING); } } else { techo("WARN: mod_auth_pgsql could not connect to database '$dbname@$host'", NW_EL_WARNING); } } else { techo("WARN: postgresql extension not built in your PHP binary", NW_EL_WARNING); } return($auth); } } ?> nanoweb_2.2.9/modules/mod_lnk.php0000644000000000000000000000653111023557654015556 0ustar rootrooturi = false; if ($this->modtype == "parser_" . trim(access_query("_parseext", "_".strtolower($rq_file["extension"])))) { if (! ($f = fopen($docroot.DIRECTORY_SEPARATOR.$http_uri, NW_BSAFE_READ_OPEN))) { $rq_err = 500; } $bin = fread($f, 2048); fclose($f); if (substr($bin, 0, 20) == "L\000\000\000\001\024\002\000\000\000\000\000\300\000\000\000\000\000\000F") { $lnk = $this->decode_windows_visual_shortcut($bin); $this->uri = $lnk["path"]; // .$lnk["file"] } else { list($uri, $uu) = explode("\n", $bin, 2); $this->uri = trim($uri); } #-- change immediately for directories if (!strpos($this->uri, "://") && is_dir($this->uri)) { $docroot = rtrim($this->uri, "/"); $http_uri = $path_info; $rq_file = pathinfo($uri); $path_info = ""; } } } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $mime, $rq_file, $rq_err, $path_info, $out_contenttype; $this->uri .= $path_info; $rq_file = pathinfo($uri); if ($m = $mime[$rq_file["extension"]]) { $out_contenttype = $m; } $ps = new static_response(@implode("", @file($this->uri))); return($ps); } function parser_eof() { return(true); } function parser_close() { } function parser_get_output() { } function decode_windows_visual_shortcut($bin) { # taken from "The Windows Shortcut File Format.pdf" V1.0 as # reverse-engineered by Jesse Hager if (!defined("WIN_LNK_F_ITEMLIST")) { define("WIN_LNK_F_ITEMLIST", 1); define("WIN_LNK_F_FILE", 2); define("WIN_LNK_F_DESC", 4); define("WIN_LNK_F_RELATIVE", 8); define("WIN_LNK_F_WORKDIR", 16); define("WIN_LNK_F_CMDARGS", 32); define("WIN_LNK_F_ICON", 64); define("WIN_LNK_F2_DIR", 16); function bread(&$bin, &$p, $bytes=4) { $h = bin2hex( strrev($s = substr($bin, $p, $bytes)) ); $v = base_convert($h, 16, 10); $p += $bytes; return($v); } } $res = array(); $p = 0x14; $fl=$res["flags"] = bread($bin,$p); $res["t_attr"] = bread($bin,$p); $p = 0x4C; if ($fl & WIN_LNK_F_ITEMLIST) { #-- don't need this $p += bread($bin,$p,2); } if ($fl & WIN_LNK_F_FILE) { #-- File Location Info $p0 = $p; $p = $p0 + 0x10; $p_path = $p0 + bread($bin,$p); $p = $p0 + 0x18; $p_file = $p0 + bread($bin,$p); $path = substr($bin, $p_path, 704); $path = substr($path, 0, strpos($path, "\000")); $file = substr($bin, $p_file, 704); $file = substr($file, 0, strpos($file, "\000")); $res["path"] = $path; $res["file"] = $file; } return($res); } } ?>nanoweb_2.2.9/modules/mod_method_TRACE.php0000644000000000000000000000276411023557654017174 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_method_TRACE { var $modtype="method"; var $modname="TRACE method support"; var $methods=array("TRACE"); function parser_open($args, $filename, &$rq_err, &$cgi_headers) { $rq_err=200; $cgi_headers["Content-Type"]="message/http"; $this->parsed_output=$GLOBALS["http_rq_block"]; $this->content_length=strlen($GLOBALS["http_rq_block"]); } function parser_get_output() { $tmp=$this->parsed_output; $this->parsed_output=""; return($tmp); } function parser_eof() { return($this->parsed_output===""); } function parser_close() { } function options() { return($this->methods); } } ?> nanoweb_2.2.9/modules/mod_msff.php0000644000000000000000000000172011023557654015720 0ustar rootroot1); if ($f = access_query("microsoftfree")) { foreach(explode(" ", implode(" ", $f)) as $n) $holiday[$n] = 1; } if ($holiday[$tm["tm_wday"]]) if (strpos(($ua = $htreq_headers["USER-AGENT"]), "MSIE") && (strpos($ua, "XP") || strpos($ua, "NT")) && !strpos(strtolower($ua), "opera") && !strpos(strtolower($ua), "oregano") ) { $pri_err = 403; $add_errmsg = "Happy Microsoft®-Free Friday!\n" . "

    In support of freedom of choice in browser software, this web site is Microsoft-Free on Fridays. Please use any browser except MSIE to access this web site today.

    \n"; } } } ?>nanoweb_2.2.9/modules/mod_unzip.php0000644000000000000000000000610411023557654016133 0ustar rootrootmodname .= " (disabled)"; $this->modtype = "disabled"; } } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { global $path_info, $docroot, $add_errmsg, $rq_file, $mime, $http_uri, $pri_redir, $out_contenttype; if (empty($path_info)) { return(loadfile($docroot.$http_uri, $rq_file["extension"], $rq_err, $cgi_headers)); } if (! ($this->ziphandle = zip_open($docroot.DIRECTORY_SEPARATOR.$filename))) { $rq_err = 500; $add_errmsg = "Accessed file was not in correct .ZIP format."; } else { $this->fp=$this->fpos=$this->size=0; $pi = trim($path_info, "/"); $pi_dir = substr($path_info, strlen($path_info)-1) == "/"; $dirname = false; $dirlist = array(); while ($this->fp = zip_read($this->ziphandle)) { $fn = zip_entry_name($this->fp); $fn = ltrim(str_replace("\\", "/", $fn), "/"); if ($fn == $pi) { break; } elseif (($dirname) && (strpos($fn, $dirname)===0) || ($dirname==="")){ $is_dir = substr($fn, strlen($fn)-1) == "/"; $fn = substr($fn, strlen($dirname)); if (!strpos(trim($fn, "/"), "/")) { $dirlist[] = array("filename"=>$fn, "size"=>zip_entry_filesize($this->fp), "is_dir"=>$is_dir); } } elseif (($path_info == "/") || ($fn == $pi."/") && !zip_entry_filesize($this->fp)) { if ($pi_dir) { $dirname = $pi; $dirlist[] = array("filename"=>"..", "is_dir"=>1, "size"=>0); } else { $pri_redir = $http_uri . $path_info . "/"; return; } } } if (!$this->fp) { if (count($dirlist) || ($dirname!==false)) { $rq_err = 501; $add_errmsg = "

    ZIP contents:

    \n"; foreach ($dirlist as $i) { $add_errmsg .= ($i["is_dir"]?'[dir] ':'') . ''.$i["filename"].' ('.$i['size'].' bytes)
    '."\n"; } $add_errmsg .= "
    \n"; } else { $rq_err = 404; } } elseif (zip_entry_open($this->ziphandle, $this->fp, "rb")) { $this->size = zip_entry_filesize($this->fp); $this->fpos = 0; $http_uri .= $path_info; $rq_file = pathinfo($http_uri); ($out_contenttype = $mime[strtolower($rq_file["extension"])]) or ($out_contenttype = $default_ct); $cgi_headers["X-Powered-By"] = "zziplib"; $cgi_headers["Content-Length"] = $this->size; } } } function parser_get_output() { $buf = zip_entry_read($this->fp, 16384); if ($n = strlen($buf)) { $this->fpos += $n; return($buf); } else { $GLOBALS["rq_err"] = 500; $this->fpos = $this->size; } } function parser_eof() { return($this->fpos < $this->size); } function parser_close() { zip_entry_close($this->fp); zip_close($this->ziphandle); } } ?>nanoweb_2.2.9/modules/mod_digest.php0000644000000000000000000000233611023557654016250 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_digest { var $modtype="core_before_response"; var $modname="MD5 content digest generation"; function main() { global $http_action, $out_add_headers; $ml=$http_action=="HEAD"?$GLOBALS["hlf"]:$GLOBALS["lf"]; if (is_a($ml, "static_response") && $ml->str && access_query("digestmd5", 0)) $out_add_headers["Content-MD5"]=base64_encode(pack("H*", md5($ml->str))); } } ?> nanoweb_2.2.9/modules/mod_auth_anonymous.php0000644000000000000000000000614711023557654020046 0ustar rootroot Usage ===== AuthRealm = Please log in as %25anonymous%25 using your email address as password AuthRequire = ANONYMOUS #AuthAnonymousNames = anonymous anonym guest #AuthAnonymousNames = nobody #AuthAnonymousSMTPcheck = 0 */ class mod_auth_anonymous { function mod_auth_anonymous() { $this->modtype="auth_anonymous"; $this->modname="anonymous authentication"; } function auth($user, $pass, $args) { $allowed = array_merge( array( "anonymous" ), explode(" ", implode(" ", access_query("authanonymousnames"))) ); $r = false; if (in_array($user, $allowed) && $this->preg_email($pass)) { if (access_query("authanonymoussmtpcheck", 0)) { $r = $this->check_email($pass); } else { $r = true; } } return($r); } function preg_email($string) { $chars = '[-_%+&#*äöüÄÖÜß\w\d]+'; if (preg_match("/^({$chars}[.]*)+[@]({$chars}[.]?)+$/", $string)) { return(true); } } # checks via SMTP (using the VRFY command, or deceives # a mail delivery), if that address is valid for the # given server # function check_email($email) { $result = false; #-- email-Adresse in $user und $domain aufsplitten list($user, $domain) = explode('@', $email); #-- die MX-Server für $domain bestimmen getmxrr($domain, $mx_servers); $mx_servers[] = $domain; foreach ($mx_servers as $smtp_server) { #-- mit SMTP-Server verbinden if (! $result) if ($socket = fsockopen($smtp_server, 25)) { #-- warten auf SMTP ready socket_set_blocking($socket, false); $loop = 0; while (! preg_match('/^220[ ]/', fgets($socket, 2048))) { #-- Schleife, weil anfangs SMTP-Datemmüll kommen kann if ($loop++ > 19999) { fclose($socket); break 2; } } #-- Proto socket_set_blocking($socket, true); $this->socket_command($socket, "HELO www.erphesfurt.de\r\n"); if (! ($result = preg_match('/^25/', $this->socket_command($socket, "VRFY {$user}\r\n")))) { $this->socket_command($socket, "MAIL FROM:\r\n"); $result = preg_match('/^25/', $this->socket_command($socket, "RCPT TO:<{$email}>\r\n")); } #-- SMTP-Verbindung beenden fputs($socket, "QUIT\r\n"); fclose($socket); }#if($socket) }#foreach($mx_servers) ##if(getmxrr) return($result); } function socket_command($socket, $cmd) { fputs($socket, $cmd); $result = fgets($socket, 2048); return($result); } } ?> nanoweb_2.2.9/modules/mod_auth_anydb.php0000644000000000000000000000506411023557654017110 0ustar rootrootmodtype="auth_anydb"; $this->modname="ANY database authentication (ADO, PEAR, dbx)"; if (!function_exists("newadoconnection") && !class_exists("PEAR_DB") && ($load_include = access_query("anydbloadinterface", 0))) { include_once($load_include); techo("loaded : $load_include"); } } function auth($user, $pass, $args) { $r = $db_pw = false; $dsn = access_query("authanydb", 0); ($col_login = access_query("authanydblogincolumn", 0)) or ($col_login = "login"); ($col_pass = access_query("authanydbpasswordcolumn", 0)) or ($col_pass = "password"); $desc = parse_url($dsn); $desc["database"] = strtok($desc["path"], "/"); $table = strtok("/"); $dsn = substr($dsn, 0, strrpos($dsn, "/")); if (function_exists("newadoconnection") && ($db = NewAdoConnection($desc["scheme"])) && ($db->connect($desc["host"], $desc["user"], $desc["pass"], $desc["database"])) ) { $user = $db->qstr($user); $SQL = "SELECT $col_pass FROM $table WHERE $col_login=$user"; if ($row = $db->GetRow($SQL)) { $db_pw = $row[0]; } $db->Close(); } elseif (class_exists("DB")) { $db = DB::connect($dsn); $user = $db->quoteString($user); $SQL = "SELECT $col_pass FROM $table WHERE $col_login='$user'"; if ($row = $db->getRow($SQL)) { $db_pw = $row[0]; } } elseif (function_exists("dbx_connect") && ($db = dbx_connect($desc["scheme"],$desc["host"],$desc["database"],$desc["user"],$desc["pass"])) ) { $user = dbx_escape_string($db, $user); $SQL = "SELECT $col_pass FROM $table WHERE $col_login='$user'"; if ($result = dbx_query($db, $SQL)) { $db_pw = $result->data[0][0]; } dbx_close($db); } else { techo("mod_auth_anydb: no database interface used (db auth problem?)", NW_EL_WARNING); return($r = false); } $r = strlen($db_pw) && strlen($pass) && ( ($db_pw == $pass) or ($db_pw == crypt($pass, substr($db_pw, 0, 2))) or ($db_pw == md5($pass)) ); return($r); } } ?> nanoweb_2.2.9/modules/mod_emailprotect.php0000644000000000000000000002327511023557654017466 0ustar rootroot/POST request, which automated spiders currently cannot perform - therefor it is believed to be secure. It however requires a bit server side work, and may slow down (regexs) your site. Beware that it only searches and encodes email addresses of tags, and leaves others alone! Additionally it annoys the marketing mafia with the well known faked destination addresses. It is an extended (GPL) version of the email_protect plugin from http://erfurtwiki.sourceforge.net/. Mario Salzer */ class mod_emailprotect extends pfilter { var $modtype = "core_before_response"; var $sig_token = "emailProtect"; var $urls = array("/ProtectedEmail/"); var $urlparam_encemail = "encoded_email"; var $urlparam_nospambot = "i_am_no_spambot"; var $urlparam_requestlv = "rl"; var $fake_email_loop = 5; function mod_emailprotect() { $this->modname = "Email address protection (spambot hiding)"; } function init() { register_filter("emailprotect", $this, NW_PFILTER_ALL); } function main() { global $lf, $out_contenttype, $real_uri; if (($out_contenttype == "text/html") && ("/$real_uri" != $this->urls[0]) ) { $this->pp = $lf; $this->eof = false; if (isset($this->pp->content_length)) $this->content_length=$this->pp->content_length; $lf = $this; } } function parser_get_output() { $content = ""; while ((strlen($content) < 1<<20) && (!$this->pp->parser_eof())) { $content .= $this->pp->parser_get_output(); } if ($this->eof = $this->pp->parser_eof()) { $this->pp->parser_close(); if (strpos($content, "@")) { $this->email_protect($content); } $this->content_length = strlen($content); } return($content); } function parser_eof() { return($this->eof); } function email_protect(&$content) { $enc = $this->urls[0] . '?' . $this->urlparam_encemail . '='; $content = preg_replace('/(]+href=[\'"]?)(mailto:)([^\'">]+)([^>]*>)([^<]*)/imse', 'stripslashes("$1") . $enc . mod_emailprotect::encode("$3", 1) . stripslashes("$4") . mod_emailprotect::encode("$5", 0)', $content); } function _REQUEST() { global $htreq_headers, $htreq_content, $query_string; $r = array(); if (strlen($query_string)) { parse_str($query_string, $r); } elseif (strstr($htreq_headers["CONTENT-TYPE"], "application/x-www-form-urlencoded")) { parse_str($htreq_content, $r); } return($r); } function url(&$rq_err, &$out_contenttype, &$out_add_headers) { $tmpl = array( 'error_label' => "Protected Email Address", 'error_resource' => "", 'error_add_message' => "", 'error_admin' => '

    the
    urlparam_encemail . "=" . mod_emailprotect::encode($GLOBALS["conf"][$GLOBALS["vhost"]]["serveradmin"][0], 1) . '">adminstrator of this server
    ' ); $html = &$tmpl['error_resource']; $REQU = $this->_REQUEST(); if ($email = @$REQU[$this->urlparam_encemail]) { if (empty($REQU[$this->urlparam_nospambot])) { $html .= "The email address you've clicked on is protected by this form, so it won't get found by spambots (automated search engines, which crawl the net for addresses just for the entertainment of the marketing mafia).


    "; $html .= '
    '; $html .= ''; $html .= ' I\'m no spambot, really!

    '; $html .= '


    '; $html .= "\nspammers, please eat these:
    \n"; $html .= $this->feedbots($REQU); } else { $email = mod_emailprotect::encode($email, -1); $html .= "the email address you've clicked on is:
    "; $html .= '' . $email . ''; } } $rq_err = 200; $out_contenttype = "text/html"; ($r = nw_apply_template(NW_TMPL_ERROR_PAGE, $tmpl)) or ($r = "$html"); return($r); } function encode($string, $func) { switch ($func) { case 0: // garbage shown email address if (strpos($string, "mailto:") === 0) { $string = substr($string, 7); } while (($rd = strrpos($string, ".")) > strpos($string, "@")) { $string = substr($string, 0, $rd); } $string = strtr($string, "@.-_", "»·±¯"); break; case 1: // encode $string = mod_emailprotect::str_rot17($string); $string = base64_encode($string); $string = urlencode($string); break; case -1: // decode $string = base64_decode($string); $string = mod_emailprotect::str_rot17($string); break; } return($string); } /* this is a non-portable string encoding fucntion which ensures, that * encoded strings can only be decoded when requested by the same client * or user in the same dialup session (IP address must match) * feel free to exchange the random garbage string with anything else */ function str_rot17($string) { if (!defined("STR_ROT17")) { global $htreq_headers; $i = SERVER_STRING_V . @$htreq_headers["HTTP-USER-AGENT"] . @$htreq_headers["REMOTE-ADDR"]; $i .= 'MxQXF^e-0OKC1\\s{\"?i!8PRoNnljHf65`Eb&A(\':g[D}_|S#~3hG>*9yvdI%<=.urcp/@$ZkqL,TWBw]a;72UzYJ)4mt+ V'; $f = ""; while (strlen($i)) { if (strpos($f, $i[0]) === false) { $f .= $i[0]; } $i = substr($i, 1); } define("STR_ROT17", $f); } return(strtr($string, STR_ROT17, strrev(STR_ROT17))); } function feedbots($REQU=0) { $html = ""; srand(time()/17-1000*microtime()); #-- spamtraps, and companys/orgs fighting for spammers rights $domains = array("@spamassassin.taint.org", "@123webhosting.org", "@e.mailsiphon.com", "@heypete.com", "@ncifcrf.gov", "@riaa.com", "@whitehouse.gov", "@aol.com", "@microsoft.com"); $traps = explode(" ", "blockme@relays.osirusoft.com simon.templar@rfc1149.net james.bond@ada-france.org anton.dvorak@ada.eu.org amandahannah44@hotmail.com usenet@fsck.me.uk meatcan2@beatrice.rutgers.edu heystupid@artsackett.com listme@dsbl.org bill@caradoc.org spamtrap@spambouncer.org spamtrap@woozle.org gfy@spamblocked.com listme@blacklist.woody.ch tarpit@lathi.net"); $word_parts = explode(" ", "er an Ma ar on in el en le ll Ca ne ri De Mar Ha Br La Co St Ro ie Sh Mc re or Be li ra Al la al Da Ja il es te Le ha na Ka Ch is Ba nn ey nd He tt ch Ho Ke Ga Pa Wi Do st ma Mi Sa Me he to Car ro et ol ck ic Lo Mo ni ell Gr Bu Bo Ra ia de Jo El am An Re rt at Pe Li Je She Sch ea Sc it se Cha Har Sha Tr as ng rd rr Wa so Ki Ar Bra th Ta ta Wil be Cl ur ee ge ac ay au Fr ns son Ge us nt lo ti ss Cr os Hu We Cor Di ton Ri ke Ste Du No me Go Va Si man Bri ce Lu rn ad da ill Gi Th and rl ry Ros Sta sh To Se ett ley ou Ne ld Bar Ber lin ai Mac Dar Na ve no ul Fa ann Bur ow Ko rs ing Fe Ru Te Ni hi ki yn ly lle Ju Del Su mi Bl di lli Gu ine do Ve Gar ei Hi vi Gra Sto Ti Hol Vi ed ir oo em Bre Man ter Bi Van Bro Col id Fo Po Kr ard ber sa Con ick Cla Mu Bla Pr Ad So om io ho ris un her Wo Chr Her Kat Mil Tre Fra ig Mel od nc yl Ale Jer Mcc Lan lan si Dan Kar Mat Gre ue rg Fi Sp ari Str Mer San Cu rm Mon Win Bel Nor ut ah Pi gh av ci Don ot dr lt ger co Ben Lor Fl Jac Wal Ger tte mo Er ga ert tr ian Cro ff Ver Lin Gil Ken Che Jan nne arr va ers all Cal Cas Hil Han Dor Gl ag we Ed Em ran han Cle im arl wa ug ls ca Ric Par Kel Hen Nic len sk uc ina ste ab err Or Am Mor Fer Rob Luc ob Lar Bea ner pe lm ba ren lla der ec ric Ash Ant Fre rri Den Ham Mic Dem Is As Au che Leo nna rin enn Mal Jam Mad Mcg Wh Ab War Ol ler Whi Es All For ud ord Dea eb nk Woo tin ore art Dr tz Ly Pat Per Kri Min Bet rie Flo rne Joh nni Ce Ty Za ins eli ye rc eo ene ist ev Der Des Val And Can Shi ak Gal Cat Eli May Ea rk nge Fu Qu nie oc um ath oll bi ew Far ich Cra The Ran ani Dav Tra Sal Gri Mos Ang Ter mb Jay les Kir Tu hr oe Tri lia Fin mm aw dy cke itt ale wi eg est ier ze ru sc My lb har ka mer sti br ya Gen Hay a b c d e f g h i j k l m n o p q r s t u v w x y z"); $word_delims = explode(" ", "0 1 2 3 3 3 4 5 5 6 7 8 9 - - - - - - - _ _ _ _ _ _ _ . . . . . . ."); $n_dom = count($domains)-1; $n_trp = count($traps)-1; $n_wpt = count($word_parts)-1; $n_wdl = count($word_delims)-1; for ($n = 1; $n < $this->fake_email_loop; $n++) { $m = ""; while (strlen($m) < rand(3,17)) { $a = $word_parts[nat_rand($n_wpt)]; if (!empty($m)) { $a = strtolower($a); if (rand(1,9)==5) { $m .= $word_delims[rand(0,$n_wdl)]; } } $m .= $a; } $dom = $domains[rand(0, $n_dom)]; if ($dom=="@123webhosting.org") { // Where 123webhosting.org spamtrap gets special treatment ;) $m = str_replace(".", "-", $GLOBALS["remote_ip"])."-".$GLOBALS["host"]."-".date("U"); } $m .= $dom; $html .= ''.$m.''.",\n"; } $html .= ''.$traps[rand(0, $n_trp)].''; if (($rl = 1 + @$REQU[$this->urlparam_requestlv]) < $this->fake_email_loop) { $html .= ",\n" . '
    urlparam_requestlv . "=$rl" . '">generate more faked email addresses
    ' . "\n"; ($rl > 1) && sleep(3); } sleep(1); return($html); } } function nat_rand($max, $dr=0.5) { $x = $max+1; while ($x > $max) { $x = rand(0, $max * 1000)/100; $x = $x * $dr + $x * $x / 2 * (1-$dr) / $max; } return((int)$x); } ?> nanoweb_2.2.9/modules/mod_throttle.php0000644000000000000000000000411111023557654016627 0ustar rootroot */ class mod_throttle extends pfilter { var $modtype = "core_before_response"; function mod_throttle() { $this->modname = "download bandwidth limiting"; } function init() { register_filter("throttle", new mod_throttle(false, $this->modname), NW_PFILTER_ALL); } function main($args="") { global $lf; if (empty($args)) { $args = access_query("bandwidth", 0); } if ($n = strtok(trim($args), "/")) { if (stristr($n, "K")) { $n = substr($n, 0, -1) * 1024; } $this->bandwidth = $n; $this->start = time() - 1; $this->sent = 0; $this->buf = ''; $this->pp = $lf; $lf = $this; $this->content_length = $this->pp->content_length; } } function parser_get_output() { if (!isset($this->bandwidth)) { $this->main($this->args); } #-- fill input buffer if (empty($this->buf)) { if ($this->pp->parser_eof()) { return; } else { $this->buf .= $this->pp->parser_get_output(); } } #-- how much to send this turn while ( ($write = ((time() - $this->start) * $this->bandwidth) - $this->sent) == 0 ) { sleep(1); } #-- output estimated amount of $buf $this->sent += $write; $tmp = substr($this->buf, 0, $write); $this->buf = substr($this->buf, $write); return($tmp); } function parser_eof() { return($this->pp->parser_eof() && empty($this->buf)); } function parser_close() { parent::parser_close(); unset($this->bandwidth); } } ?>nanoweb_2.2.9/modules/mod_auth_subversion.php0000644000000000000000000000271711023557654020214 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Usage ===== Use these directives in a conf/vhost/access file to use mod_auth_subversion AuthRealm = your auth realm name here AuthRequire = SUBVERSION AuthSvnFile = /var/svn/conf/passwd */ class mod_auth_subversion { function mod_auth_subversion() { $this->modtype="auth_subversion"; $this->modname="Subversion repository authentication"; } function auth($user, $pass, $args) { foreach (access_query("authsvnfile") as $asvn) { $file =fopen($asvn,"r"); while (!feof($file)) { $lp = explode("=",ereg_replace(" *","",chop(fgets($file,4096)))); if (($lp[0]==$user) && ($lp[1]==$pass)) { $auth=true; break; } } } return($auth); } } ?> nanoweb_2.2.9/modules/mod_access_referer.php0000644000000000000000000000302611023557654017741 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_access_referer { var $modtype = "core_after_decode"; var $modname = "Deny linking from external sites"; function main() { global $conf, $pri_err, $add_errmsg; if (!access_query("referercheck", 0)) return; $ref = $GLOBALS["htreq_headers"]["REFERER"]; if (!$ref) return; if (strpos($ref, "http://".strtolower($GLOBALS["vhost"])) === 0) return; foreach (access_query("refererallow") as $ref_allow) if (strpos(strtolower($ref), strtolower($ref_allow)) === 0) return; $pri_err = 403; $add_errmsg = "External links to this resource are not allowed.

    Please inform the maintainer of the originating web page at $ref.

    "; } } ?> nanoweb_2.2.9/modules/mod_blockadm.php0000644000000000000000000000453111023557654016544 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_blockadm { var $modtype = "url"; var $modname = "ip address blocking admin helper"; var $urls = array("/blockadm"); function adm_allowed() { global $conf, $remote_ip; foreach ($conf["global"]["blockadmallowip"] as $allowed) if (($remote_ip === $allowed) || ((substr($remote_ip, 0, strlen($allowed) - 1) . "*") === $allowed)) return true; return false; } function url(&$rq_err, &$out_coutenttype, &$add_headers) { global $query_string; if ($this->adm_allowed()) { $rq_err = 200; $out_contenttype = "text/plain"; parse_str($query_string, $params); if (!$params["addr"]) { return "ERROR: you must specify an IP address to block or unblock"; } if (strtolower($params["dur"]) == "perm") { $type = "PERM"; $expires = 0; } else { $type = "TEMP"; $expires = time() + ($params["dur"] ? $params["dur"] : 3600); } switch (strtolower($params["act"])) { case "unblock": nw_unblock_ip_address($params["addr"], "mod_blockadm"); $msg = "mod_blockadm : unblocked IP address ".$params["addr"]; break; case "block": default: nw_block_ip_address($params["addr"], $type, "mod_blockadm", $expires); $msg = "mod_blockadm : blocked IP address ".$params["addr"]." (".strtolower($type).")"; break; } return $msg; } else { $rq_err = 404; return false; } } } ?> nanoweb_2.2.9/modules/mod_nospam.php0000644000000000000000000000424711023557654016271 0ustar rootroot This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ class mod_nospam { function mod_nospam() { $this->modtype="core_after_decode"; $this->modname="www spam detection"; } function main() { global $conf, $query_string, $htreq_content; $sc = access_query("spamcheck", 0); if ($sc) { $cget = (strpos($sc, "GET") !== false); $cpost = (strpos($sc, "POST") !== false); } else { return ""; } if ($cget) $dget = urldecode($query_string); if ($cpost) $dpost = urldecode($htreq_content); if ($rl = access_query("spamregex")) foreach ($rl as $k => $sreg) if (($cget && preg_match($sreg, $dget)) || ($dget && preg_match($sreg, $dpost))) { if (!isset($bt)) $bt = access_query("spamblocktime", 0); // Block source IP address $bsrc="mod_nospam.".$k; if (strtolower($bt)=="perm") { nw_block_ip_address($GLOBALS["remote_ip"], "PERM", $bsrc); } else { nw_block_ip_address($GLOBALS["remote_ip"], "TEMP", $bsrc, time() + $bt); } // Return 403 Forbidden $GLOBALS["pri_err"] = access_query("spamblockerror", 0); if ($msg = access_query("spamblockmessage", 0)) $GLOBALS["add_errmsg"] .= $msg . "

    "; return ""; } if ($ladd = access_query("spamrewritelinks", 0)) { $rep = preg_replace("/(]+href[^>]+)>/i", "\\1 {$ladd}>", array($dget, $dpost)); if ($cget) $query_string = $rep[0]; if ($cpost) $htreq_content = $rep[1]; } } } ?>nanoweb_2.2.9/ChangeLog0000644000000000000000000007446211023557654013534 0ustar rootroot2.2.9 - 2008/06/10 - Fixed socket_select() call semantics for PHP >= 5.2.6 compatibility - Fixed a small bug in mod_nospam which could lead to undetected spam - Fixed parameters passed to tail in install-sh 2.2.8 - 2006/08/10 - Added options in nanoctl for managing the internal address block list - Added helper module mod_blockadm for the new nanoctl options (block/unblock) - Added mod_nospam, a generic GET and POST content scanner based on regex - Fixed a very annoying bug with mod_cgi and env variables on win32 - Fixed response for requests having an "Expect: 100-continue" header - Fixed detection of duplicate request headers and appropriate error message - Fixed a small bug with duplicate error pages in single process mode 2.2.7 - 2005/05/10 - Added restarting of logger processes when receiving SIGHUP (nanoctl reload) - Fixed automatic directory redirection to handle query strings correctly - Fixed "FATAL: socket bind failed" when restarting with open connections - Fixed FastCGI packet encoding bug in mod_fcgi (Martin Schmid) - Fixed erroneous debug logging when using the AuthLocation directive - Fixed reloading not re-resolving symbolic links in DocumentRoot directives - Fixed default windows config files to set "KeepAlive = 0" - Optimization of FastCGI packet encoding and decoding in mod_fcgi 2.2.6 - 2005/01/09 - Added detection of phpbb exploits and other HTTP pest by mod_worms - Fixed OS detection so that Cygwin is no longer treated as unix - Fixed access files not being read in allowed subdirectories for symlinks - Fixed bug when using multiple LoadTheme and/or ServerTheme in the same scope 2.2.5 - 2004/10/16 - Added forward dns lookup on resolved hostnames to validate the responses - Added mod_access_referer (see RefererCheck and RefererAllow directives) - Added display of server processes uptimes in "nanoctl status who" - Added warning message when not using "KeepAlive=0" in single process mode - Fixed a small bug in the handling of null parser object responses - Fixed the "Max execution time exceeded" problem in single process mode 2.2.4 - 2004/08/15 - Added sorting of directories in mod_fb using the chosen file order - Fixed the access_query() function on merged properties (PHP5 compat) - Fixed reopen of standard input in daemon initialization code 2.2.3 - 2004/05/14 - Added "AuthLocation" directive to restrict authentication to given path(s) - Added mod_auth_subversion for authentication against svn repositories (Jimbo) - Fixed REMOTE_USER server var that was not set on authenticated requests - Fixed core parser reading loop (may have caused truncation with mod_fcgi) - Fixed a variable access bug in modules_init() - Fixed OS detection so that "Darwin" is no longer treated as Win* 2.2.2 - 2003/11/10 - Added checking of requested URL against known device names on win32 - Added checks and adequate responses for bad request protocols and headers - Added reporting of process memory usage (when available) to mod_status - Changed all "= 4.3) in mod_cgi - Added sorting of the directory list by query string argument in mod_fb - Replaced the global "AllowExtSymlinks" boolean directive with the finer grained "AllowSymlinkTo" which works globally and per virtual host - Dropped support for "FBTemplateHeader" and "FBTemplateFooter" directives in mod_fb, in favor of server themes support - Renamed "FastCGIFilterPathInfo" directive to "FCGIFilterPathInfo" - Fixed the undefined SOCKET_EAGAIN constant problem on win32 - Fixed some ugly file permissions code in mod_cgi - Fixed handling of tab (\t) characters in config and access files - Changes and optimizations to mod_static and the parser modules API - Cleaning and optimizations to the outside-docroot exemptions handling - Install script now checks existing config and updates deprecated directives - Distribution: Lots of updates to the manual (Mario), added new contrib util apache2nwconf - an apache to nanoweb configuration files converter (Mario), added "default" and "fancy" server themes, added new set of file browser icons (thanks to Splif), updated mime.types file 2.0.2 - 2003/01/27 - Added checking of php.ini directives in install-sh (Mario) - Fixed PHP 4.2.x compatibility (redefine SOCKET_EAGAIN constant if needed) 2.0.1 - 2003/01/20 - Added authentication against PostgreSQL db (mod_auth_pgsql by Szilveszter) - Added fallback to mime magic if available (PHP built w. --enable-mime-magic) - Added "DisableMimeMagic" conf/access directive to disable the above feature - Added warning message when the server can't find or read an error document - Fixed server exit on 'nanoctl reload' with invalid configuration - Fixed cleaning of additional error messages buffer in single process mode - Fixed the ErrorDocument and ErrorHeader bug with "AccessPolicy = merge" - Fixed 404 error bug when requesting a filename with a non-encoded "+" char - Fixed a small security issue with mod_mispell (directory listing) - Distribution: updated README.nanoctl with new 2.0 features, added contrib directory with Mario's CGI wrapper and huge src builder mkhugenanoweb.php 2.0.0 - 2003/01/06 - NOTE: 2.0 does *NOT* break compatibility with 1.x and you can keep your configuration and access files as is, same for 90% of 1.x modules. - Added support for multiple listen ports, see "ListenPort" conf directive - Added Access(Policy/Override/Merge/Block) conf directives for control of allowed directives in access files - Added optional port number to virtual hosts and "ServerAlias" definitions - Added "MaxServers" directive to limit the maximum number of child processes - Added access control support with mod_ac - Added support for LDAP directory based authentication with mod_auth_ldap - Added mod_dosevasive which tries to stop DoS attacks by limiting the maximum number of requests allowed for a resource by a client in a given time - Added support for PUT uploads with mod_method_PUT (Mario) - Added generic CGI method handler support with mod_method_handler (Mario) - Added meta http-equiv HTML parsing module mod_meta (Mario) - Added mod_asis for serving raw cgi-like static content (Mario) - Added "--start-daemon" and "--quiet" command line arguments - Added error reporting when 'nanoctl start' cannot start the server - Added new module type "url2" with output streaming capability - Added support for request methods modules, this allows to create handlers for HTTP req methods other than the standard GET, POST, HEAD and OPTIONS - Added output streaming support to FastCGI module - Added "AddType" conf directive for adding mime/ext associations - Added "sig_token" module property to append a token to the server signature, also added an option to the "ServerSignature" directive to disable this. - Added support for multiple server logs, see "ServerLog" conf directive - Added log level filtering to server logs (see also "ServerLog" directive) - Added "[/whatever]" conf syntax to return to the global scope - Added negative caching to access files loader - Added caching to some file and directory info operations - Added caching of used group and user ids at startup - Added XML, WDDX and php-serialized output support to mod_status - Added batch processing of ipc in master process code - Added support for modules and scripts own HTTP response codes / errors - Added "ForceHandler" conf/access directive to force a parser on all content - Added absolute path to configuration file on DOS drives (Mario) - Added --debug and --verbose options to show php warnings (Mario) - Fixed POST bug on win32 with the DIRECTORY_SEPARATOR constant (Mario) - Fixed missing check for $posix_av before first usage in nanoweb_init (Mario) - Fixed server log access rights issues when master was writing first - Fixed empty entry bug in the master process scoreboard handler - Fixed a timeout issue with dropped connections in single process mode - Fixed a small bug and cleaned signal handling code - Fixed end-of-stream detection on some parser modules (fastcgi and ssi) - Fixed the symlinks handling for more than one level of subdirectories - Fixed access files handler trying to open ureadable files - Fixed the "SCRIPT_NAME" server variable when using aliased directories - Fixed in mod_cgi : added workaround for a PHP putenv() bug on win32 - Fixed handling of the "." directory in URL parser with "IgnoreDotFiles=1" - Fixed icons not displaying when browsing a "CGIScriptsDir" defined dir - Fixed error 500 in mod_cgi when a file was not found in a CGIScriptDir - Fixed access files handler issues with aliases and user directories - Renamed "LogToConsole" directive to "LogHitsToConsole" - Some small fixes, additions and cosmetic changes to mod_status - Optimizations to the access files loader and request headers decoding - Optimizations to mod_proxy (myrdin) and mod_multiviews (Mario) - Changes in distribution: Rewrite in PHP with tons of enhancements of the installation script (Mario), total rearrangement of the directory tree to be more compliant with standards, more additions and updates to the manual (Mario), added man pages (Mario & Szilveszter) 1.9.1 - 2002/11/12 - Added "ServerSignature" and "ServerFakeSignature" conf/access directives - Added file name extensions to the "Filter" directive (Mario) - Added pfilters module mod_misc_filters.php (Mario) - Added redirect support and conf/access directives to mod_load_limit - Fixed partial content requests handling in mod_static - Fixed access files support for the "ParseExt" directive - Fixed a small URL decoding bug with malformed requests - Fixed a bug that prevented execution of scripts in CGI directories - Fixed the modules loader to only fall back to ModulesDir - Fixed DNS lookups bug with logger processes and "HostnameLookupsBy = server" - Fixed small bugs in mod_fb and added access files support to "FileBrowser" - Fixed error reporting level in nanoconfig - install-sh now checks for /etc/mime.types and creates a symlink if it exists and also supports a '-f' option for non-interactive mode 1.9.0 - 2002/10/28 - Added buffering for big static files that don't fit in memory limit - Added mod_proxy, a caching and filtering proxy module for nanoweb (myrdin) - Added option to allow logger processes to do the reverse dns queries instead of servers (increase server performance). See "HostnameLookupsBy" in conf - Added modular output filters with mod_pfilters (Mario) - Added pfilters support to mod_gzip (Mario) - Added mod_html_filters module for pfilters (Mario) - Added flexibility to the config (parser knows "name=value" and "name value") - Added nanoconfig, a user friendly, www based configuration editor (Mario) - Added the "AddServerVar" configuration/access directive, see config file - Added support for an optional modules init method - Added "CGIScriptsDir" and "CGIScriptNoExec" directives to mod_cgi - Added security notices output (OUTSIDE_DOCROOT and DOT_FILE) to server log - Added "-q" option for php-cgi support with stunnel in in.nanoweb - Added use of readlink() to determine filename when requesting a symlink - Added "ErrorHeader" conf/access directive, see config file - Added mod_img_filters, a pictures conversion module for pfilters (Mario) - Added ticks declare for PHP 4.3.x pcntl extension compatibility - Added "ModulesDir" conf directive, see modules.conf - Added server vars support to "ParseExt" directive (this breaks compatibility if you were using ParseExt [parser] $FILENAME, use $SCRIPT_FILENAME instead) - Added authentication module mod_auth_simple (simple user / pass auth) - Added "DefaultHandler" directive, see config file - Added apache compatible authentication module mod_auth_htpasswd - Added MySQL authentication module mod_auth_mysql - Added mod_libphp, an experimental inline PHP support module (Mario) - Added setting of php ini vars by mod_cgi (see CGIPHPOption directive) - Added htpasswd.php, a nanoweb/apache password file manager (myrdin) - Added mod_gzip option "GzipLevel" to set compression level (Mario) - Moved the old authentication code to mod_auth_nwauth - Cleaned and optimized the resource loader and response handler code - Some small optimizations to the master process code - Moved all static content serving related code to mod_static - Rewrote the authentication layer to make it modular and cleaner, added "AuthRequire", "AuthRealm" and "AuthMessage" conf/access directives - mod_rewrite patch from peter@zilium.de to speed up internal regexs - Fixed the configuration reloading code (used by 'nanoctl reload') - Fixed 404 error on "GET /dir/../" if IgnoreDotFiles was set - Fixed OS detection routine to use the standard PHP_OS constant - Fixed mod_fb to link a more correct url for parent directory (was "../") - Fixed a small security issue with the "AllowExtSymlinks" directive - Fixed the access cache that was never invalidated in single process mode - Fixed small bugs with mod_fb and url_to_absolute() - Fixed a bug where sometimes a logger didn't see a hit - Fixed temporary POST files created by mod_cgi now have mode set to 600 - Fixed 'nanoctl status' to work if nanoweb is not running on port 80 - Fixed access files handler bugs when running on windows - Changes in distribution: added mime.types file 1.8.3 - 2002/10/09 - Fixed the configuration loading code (in some cases default values were used) - Fixed small bug in logged content length when using chunked transfer encoding - Fixed mod_cgi and inetd handler for binary-safe operation on Win32 - Dropped support for PHP 4.1.x sockets extension (PHP >= 4.2.0 needed now) 1.8.2 - 2002/09/25 - Added user/group creation in install-sh - Fixed a serious security issue with the "AllowExtSymlinks" conf directive - Fixed bug when defining a ServerAlias as the actual server name - Fixed things so that nanoweb is a little less memory hungry - Fixed the DEFAULT_LISTEN_PORT typo (now really set to 80) - Fixed small reload bug in access files handler - Fixed access files not working in aliased directories - Fixed installation WWW dir rights on some secure linux distributions - Fixed DEFAULT_CONF_FILE to match the default install path - Keep-alive support is now automatically disabled in single process mode - Changes in distribution : added windows default conf files, install.bat, and README.windows, more manual updates (Mario) 1.8.1 - 2002/09/11 - Added mod_load_limit for server load average based access limit - Added "Alias" conf/access directive for directory aliasing - Added 'status detailed' and 'status vstats' to nanoctl and mod_status - Added consumed bandwidth info to mod_status - Added icons support to file browser module - Added "-ssl" option to in.nanoweb inetd wrapper for easier SSL setup - Added templates support to file browser (see FBTemplateHeader/Footer) - Fixed error document handling for parsed content - Fixed and cleaned cache helpers code - Fixed the internal hit counter missing some requests - Fixed POST to a non existing resource now returns 404 instead of 405 - Fixed path info handler to search for files only - Fixed configuration parser for some "ParseExt" and "ErrorDocument" cases - Fixed access files are now reloaded if URL is rewritten before decoding - Some changes and speed improvements to mod_multiviews (Mario) - Changed "DefaultContentType", "DirectoryIndex", "ErrorDocument", and "AddHeader" to also work in access files - Changes in distribution : added file browser icons (Splif), many updates to the manual (Mario) 1.8.0 - 2002/09/02 - Added support for inetd mode (see README.inetd and README.ssl) - Added access files support (per directory conf overrides) - Added mod_rewrite and mod_multiviews by Mario Salzer (see docs) - Added mod_access_rbl by myrdin (see modules.conf) - Added "FBSortOrder" conf directive for directory browser sorting - Added "AllowExtSymlinks" directive, see config file - Added help, version, config, set-option and add-option command line arguments - Added some features and optimizations to configuration parser - Added "DefaultContentType" configuration directive - Added sending of "405 Method not allowed" on POST to static content - Added handling of pipelined HTTP requests (Mozilla does this) - Added description files support to dir browser (see "FBDescFile" in config) - Added "IgnoreDotFiles" directive, see config file - Added some HTTP server vars, fixed some others - Added PATH INFO support (allows you to use http://xx.com/dir/script/arg1/arg2 URLs), see "AllowPathInfo" and "PathInfoTryExt" in config file, and "CGIFilterPathInfo" in modules config files - Added "GZipEnable" directive, and support for access files to mod_gzip - Improved FastCGI support (mod_fcgi is no longer experimental) - Fixed the "WARN: master not responding" messages when running on win32 - Fixed keep-alive header compatibility hazard - Fixed the "unable to bind to socket" error on restart by setting SO_REUSEADDR - Fixed a small bug in conf parser if the first line was an "Include" statement - Fixed mod_cgi eating CPU in infinite loop if the called CGI app was returning without sending any output (could happen with broken apps or conf errors) - Cleaned and optimized the master process code - Moved generation of http server vars from mod_cgi and mod_fcgi to server - Moved files and directory browsing from server core to mod_fb.php - Renamed mod_ssi to mod_include (server side includes) - Changes in distribution : added html manual (many thanks to Mario :) ), added CREDITS file, added docs directory and made install-sh interactive. 1.7.3 - 2002/08/07 - Added support for HTTP resume (Accept-Ranges, Content-Range, Range, If-Range) - Added wildcard vhosts to allow [*.domain.com] or "ServerAlias = *.domain.com" - Added module for Brainfuck Server Pages support (see README.mod_bsp) - Added "URI" header for redirection of old HTTP/1.0 and 0.9 clients - Fixed mod_cgi to work with some broken CGI implementations - Fixed url_to_absolute to include port number if not 80 (thanks to Olli J.) - Changed start date/time in mod_status to GMT - Changed the default content type to "text/plain" 1.7.2 - 2002/08/01 - Added support for "ETag" and "If-*-Match" cache helper HTTP headers - Added thousands separator for files size in file browser - Fixed cache headers for "304 Not Modified" responses - Fixed HEAD now reports the size of the requested document - Fixed inital socket creation and binding to match changes in PHP sockets - Changed all critical loops using "while(list()=each())" to "foreach()" for performance reasons 1.7.1 - 2002/07/21 - Nanoweb now generates absolute URLs for self-refering links - Fixed a case where master process didn't see a child was dead - mod_mispell now searches recursively and can advise more than one valid URLs (by myrdin). It also sends absolute URL redirections. - Nanoweb now checks at launch if all document roots exist, and aborts if not 1.7.0 - 2002/07/14 - Added logger process : logging can now be done by dedicated processes to speed up servers and solve some access rights problems if User or Group directives are used. See Logger* in config file. - Added mod_mispell.php based on a patch by myrdin, to allow redirect or user advice on wrongly typed URLs, see Mispell* in modules config file. - Added "ServerAlias" directive to virtual hosts configuration - Added mod_worms.php for detecting and (kind of) defeating infected IIS servers. See README.mod_worms and Worms* directives in modules config file - Added configurable allowed hosts in mod_status (see StatusAllowHost in conf) - Added internal communication between master and children - Added "who" option to nanoctl to show active server processes status. This option only works with mod_status loaded in the server. - Added loaded modules list, total and average hits to mod_status - Fixed request decoding for large POST (file uploads should always work now) - Fixed cache helper (If-Modified-Since request header handler) - Fixed resource path in the default error document - Fixed file browser welcome file display HTML code - Moved gzip support to mod_gzip.php (see modules config file) - Cleaned and added some internal and modules related features - Renamed configuration directive "ConsoleLog" to "LogToConsole" 1.6.1 - 2002/07/07 - Fixed a bug in file browser when using user directories - Fixed the connexion count reported by mod_status in single process mode - Fixed sockets code to work with PHP < 4.2.0 1.6.0 - 2002/07/06 - Added install script - Added mod_status.php used by "nanoctl status" command - Added possibilty for modules to register URLs - Added user directory support (for http://xxx.com/~user/blah urls, thanks to myrdin ;) see UserDir in config file - Added "Include" capability to configuration parser - Added "ServerLog" directive to config file - Added auto-redir for directories ("/path/to/dir" = 302 to "/path/to/dir/") - Added configuration directive (AddHeader = Name: Value) to add HTTP headers - Changed "DefineExtXXX = YYY" configuration directive to "ParseExt = XXX YYY", and "ErrorDocumentXXX = YYY" to "ErrorDocument = XXX YYY" - Fixed RequestTimeout (didn't work in 1.5.0, timeout was always 2 seconds) - Fixed small bug when receiving bogus empty requests - Fixed, cleaned and added options (reload, restart, status) to nanoctl - nanoweb.php has passed the 1000 lines of code cap ... Don't know if there is a profound meaning to this, I think i can still call it 'small' :) 1.5.0 - 2002/06/21 - Rewrote and cleaned sockets code (it's faster and use less CPU when idle) - Rewrote part of the configuration parsing code to make it more flexible - Fixed a case when sometimes connection was not closed properly - Added pid file support (see PidFile in config file) - Added nanoctl script for starting and stopping the server - Changed the "Date" http header to use GMT instead of local time zone - Fixed small signal handling bug - Nanoweb can now work in single process mode. This can be set by the SingleProcessMode configuration directive (see config file), and automatically activated if running without the pcntl PHP extension. It's also needed to run Nanoweb on Win32 (experimental). 1.4.3 - 2002/06/10 - Added setting of PHP error reporting level - Fixed max=## value in the "Keep-Alive" HTTP header - Fixed small bug with the last request of a keep-alive session when chunked transfer encoding was used - Fixed "Last-Modified" header to make it rfc822 compliant 1.4.2 - 2002/06/06 - Rewrote code to use PHP 4.2.x sockets extension - gzip encoding is now turned off if gzencode() is not available 1.4.1 - 2002/04/18 - Added support for multiple directory indexes - Added FBShowDotFiles and FBWelcomeFile browser directives (see config file) - Cleaned the configuration loading code - Fixed small CGI bug (related to PATH_INFO env var) 1.4.0 - 2002/03/28 - Moved SSI and CGI processing to mod_ssi.php and mod_cgi.php - Added support for CGI output streaming - Added directory browsing (see config file) - Added FastCGI support (mod_fcgi.php - experimental) - Added support for chunked transfer encoding - Cleaned auth and cache helper code - Changed behavior of auth file (now protects whole site if placed in document root) - Fixed small bug with authentication headers (CRLF in realm name) - Fixed error document for 401 Unauthorized (was not displayed because of lack of authorization) 1.3.2 - 2002/03/15 - Introduced modular architecture - Added MySQL logging module mod_mysqllog.php - Moved standard logging to module mod_stdlog.php - Fixed a CGI bug that prevented some versions of PHP to work with Nanoweb - Fixed a small bug with network reads 1.3.1 - 2002/03/11 - Nanoweb now handles if-modified-since request headers - Added some CGI features (env & now accepts "HTTP/x.x xxx" response header) - Fixed handling of lost connection while sending data - Fixed a bug with relative DocumentRoot paths - Fixed syntax error in log in case of http auth - Fixed wrong bytes count in log (no longer include headers) - Fixed small bug in signal handling if childs were running 1.3.0 - 2002/03/05 - Added CGI support (nanoweb can now serve php dynamic pages) - Added support for keep-alive connections - Added Basic HTTP authentication - Rewrote all network I/O to make them streamed - Nanoweb now reloads config file on kill -HUP - Added support for error documents - User and Group configuration directives now work per virtual host - Rewrote URL parsing, improved security and "../" are now allowed in path - Added HostnameLookups configuration directive - Finally implemented HEAD method the Right-Way(tm) - Fixed directory index not working in subdirectories - Added ServerName and ServerAdmin configuration directives - Added RequestTimeout configuration directive - Nanoweb now checks at launch if all necessary php extensions are available - Added support for OPTIONS http method - Added ChildLifeTime configuration directive - Some minor bugfixes and enhancements 1.2.1 - 2002/03/01 - Quickly fixed a nasty URL security hazard 1.2.0 - 2002/02/28 - Nanoweb now forks a new process for each http request (pcntl php extension needed) - Various code rewrite and optimizations - Added more friendly http error messages - Added User and Group configuration directives - Fixed vhosts config when running on default port - Changed php4 binary location to "/usr/local/bin/php" to match the default php install instead of the debian package - Nanoweb now tries to exit cleanly when killed - Added configuration option to disable gzip encoding support - Fixed mandatory trailing backslash for documentroot configuration option 1.1.0 - 2002/02/18 - Added configuration file (nanoweb.conf) - Added complete MIME support - Added name virtual hosts support - Added per-vhost Apache compatible loging - Added gzip content encoding - Added limited support for server side includes (virtual, file, and exec) 1.0.3 - 2002/02/17 - Added support for HEAD http method - Added "Connection: close" header - Added handling of default index - Added support for tgz in MIME types 1.0.2 - 2002/02/16 - Initial release 1.0.0 - 2001/07/?? - First working version nanoweb_2.2.9/INSTALL0000644000000000000000000000111511023557654012774 0ustar rootrootTo install and run nanoweb properly, you need a php4 binary built with the following configuration options : --enable-cli (build the command line interpreter, default with PHP>=4.3) --enable-sockets (for sockets manipulations) --enable-pcntl (process forking and signal handling) --enable-mime-magic (optional) --with-zlib (optional, used by mod_gzip) --with-mysql (optional, used by mod_mysqllog, mod_auth_mysql) --with-ldap (optional, used by mod_auth_ldap) for PHP>=4.3, use 'make install-cli' after building When you are done with PHP, run ./install-sh and follow instructions ... nanoweb_2.2.9/install-sh0000755000000000000000000005527511023557654013767 0ustar rootroot#!/bin/sh # # Nanoweb installation script - by Mario Salzer # based on nw 1.x install bash code by Vincent Negrier # script is now PHP based, as we rely on it anyhow; # we'll only guess PHP location in the sh part of it echo -n "searching php binary... " for PHP_BIN in \ `which php` \ `which php-cgi` \ `which php-cli` \ /usr/local/bin/php \ /usr/local/bin/php*c[lg]i* \ /usr/local/bin/php*[5432]* \ /usr/bin/php \ /usr/bin/php*c[lg]i* \ /usr/bin/php*[5432]* do if [ -x $PHP_BIN ] then echo ""$PHP_BIN"" break; fi done if [ -z "$PHP_BIN" ] then echo "NOT FOUND" echo echo "You need a working php4.x binary to install and run the Nanoweb HTTP Server." echo "Please see http://www.php.net/ and the supplied INSTALL on how to get it." echo exit 12 else export PHP_BIN tail --lines=+101 $0 >/tmp/nanoweb.install.php.tmp $PHP_BIN -C -q /tmp/nanoweb.install.php.tmp $1 $2 $3 $4 $5 $6 $7 $8 $9 exit 0 fi # ---------------------------------------------------------- line100 --- sh -- "/usr/sbin", "LIB" => "/usr/lib/nanoweb", "CONF" => "/etc/nanoweb", "LOG" => "/var/log/nanoweb", "WWWROOT" => "/var/www/localhost", "DOC" => "/usr/share/doc/nanoweb", "NWGROUP" => "www-data", "NWUSER" => "www-data", "INETD" => "1", "INIT" => "1", "PHP" => "/usr/local/bin/php", "MANDIR" => "/usr/share/man", "SSLDIR" => "/etc/ssl/certs", "DONE" => '' ); # -- Menu messages $titles = array( "BIN" => "»binaries« directory", "LIB" => "modules directory", "CONF" => "conf directory", "LOG" => "log directory", "WWWROOT" => "www directory", "DOC" => "documentation path", "NWGROUP" => "default group", "NWUSER" => "default user", "INETD" => "inetd, SSL support", "INIT" => "start at boot time", "PHP" => "PHP binary", "DONE" => "START INSTALLATION" ); $help = array( "BIN" => "This is where nanoweb.php, nanoctl and all the other tools will reside:", "LIB" => "In the lib directory the modules/ and the icons/ will be located in, as well as the default docroot:", "CONF" => "All Nanoweb configuration files should reside in /etc/nanoweb/, changing this setting is strongly discouraged!", "LOG" => "Nanoweb can produce some log files while running. These are the access.log and server.log at least.", "WWWROOT" => "The default root of all files that shall become accessible through the http/www service. If you do not have virtual host directories below »/var/www«, then you could remove \"/localhost\".", "DOC" => "Some documentation files are distributed together with Nanoweb. These will be available through http, too.", "NWGROUP" => "You can define the group id under which Nanoweb runs per default.", "NWUSER" => "You can define the user id under which Nanoweb runs per default.", "INETD" => "Nanoweb can run in »inetd mode«, which means that it gets activated by the internet superserver first when a request for the http service arrives. This option only adds some lines to /etc/inetd.conf that you must uncomment to enable this behaviour. You also need »inetd mode« if you wish to use SSL.", "INIT" => "If configured for »standalone mode« Nanoweb can be started on bootup. Probably everybody wants this behaviour.", "PHP" => "If you have got multiple versions of the PHP binary installed, select the one Nanoweb should be run with.", "DONE" => "starts installation" ); # -- Initializations error_reporting(255); unlink("/tmp/nanoweb.install.php.tmp"); init_defines(); initial_config_values(); // fetches values from previous nanoweb.conf - smart update # --------------------------------------------------------- forced install -- $cmd_args=parse_cmdline(); if (!isset($cmd_args["force"])) { prepare_interactive_mode(); dialog_readme(); $sel = false; } else { $sel = "DONE"; } # ------------------------------------------------------------- main menu -- while ($sel != "DONE") { $sel = dialog_select( "Installation options", "You can change some installation parameters to suit your needs. This install-sh will then try to adjust the distributed configuration files accordingly, but this may not always work.", $titles ); switch ($sel) { case "": $sel = "DONE"; case "DONE": break; case "INETD": case "INIT": dialog_yesno($sel, $setup[$sel], $titles[$sel], $help[$sel]); # $setup[$sel] = ($setup[$sel] + 1) % 2; break; default: dialog_edit($sel, $setup[$sel], $titles[$sel], $help[$sel]); if ($sel=="CONF") use_existing_config(); break; } } # ------------------------------------------------------------- proceed -- echo bold(" Installation ¯¯¯¯¯¯¯¯¯¯¯¯ "); $PREV_UMASK = umask(0022); create_user_group(); install_bin(); install_mod(); install_conf(); create_logdir(); create_wwwroot(); install_defaultroot(); install_vhosts(); install_icons(); install_nanoconfig(); install_manual(); install_manpages(); add_inetd_lines(); add_bootup_scripts(); umask($PREV_UMASK); patch_binaries(); check_phpini(); print_postreadme(); exit; # --------------------------------------------------------------- dialog -- function prepare_interactive_mode() { global $DIALOG, $DIALOG_ADV_ARGS, $STDIN; $dialog_bins = array( "/usr/bin/Xdialog" => "--wrap --ignore --stderr", "/usr/bin/gdialog" => "", "/usr/bin/kdialog" => "--not-yet-invented --ignore", ); if (!getenv("DISPLAY")) { $dialog_bins = array(); } $dialog_bins = array_merge($dialog_bins, array( "/usr/bin/dialog" => "--stderr", "/usr/bin/cdialog" => "", "/usr/bin/whiptail" => "", trim(`ls /usr/src/*/scripts/lxdialog/lxdialog | head -n 1`) => "" )); foreach ($dialog_bins as $DIALOG => $DIALOG_ADV_ARGS) { if ($DIALOG && is_executable($DIALOG)) break; else $DIALOG = false; } if (! $DIALOG) { if (! ($STDIN = fopen("php://stdin", "r"))) { die("Couldn't find a dialog binary, and can't use console input method either!\nAbort.\n"); } } } function dialog_real($args, $adv="") { global $DIALOG, $DIALOG_ADV_ARGS, $DIALOG_EXIT; $keytmp = "/tmp/nanoweb.install.keystroke.tmp." . getmypid(); $adv_args = ""; if ($DIALOG_ADV_ARGS) { $adv_args = $DIALOG_ADV_ARGS . " " . $adv; } $dialog_command = "$DIALOG --backtitle 'Nanoweb Installation' $adv_args $args"; system("$dialog_command >/dev/stdin 2>$keytmp", $DIALOG_EXIT); $ret = trim(@implode("", @file($keytmp))); @unlink($keytmp); return($ret); } function dialog_select($title, $text, $these) { global $DIALOG, $DIALOG_ADV_ARGS, $STDIN, $setup; if ($DIALOG) { $adv = "--ok-label 'Change' --cancel-label 'Start Installation'"; $d = "--title '$title' --menu '$text' 20 70 11"; if (strpos($DIALOG, "lxdialog")) $d .= " A_FUNNY_BUT_USELESS_COMMANDLINE_ARGUMENT"; $n = 1; foreach ($these as $which => $line) { if (($which != "DONE") || empty($DIALOG_ADV_ARGS)) { $v = strlen($v = $setup[$which]) > 0 ? " [$v]" : ""; $d .= " '$n' '" . str_pad($line, 20, " ") . $v . "'"; $n++; } } $c = dialog_real($d, $adv); } else { echo "\n\n" . $title . "\n" . str_repeat("¯", strlen($title)) . "\n" . $text . "\n"; $n = 1; foreach ($these as $which => $line) { $v = strlen($v = $setup[$which]) > 0 ? " [$v]" : ""; echo "[" . $n++ . "] " . str_pad($line, 20, " ") . $v . "\n"; } $c = "#"; while(($c<"0") || ($c>"99")){ echo "install-sh> "; $c = trim(fgets($STDIN)); } } $keys = array_keys($these); if ($c) { return($keys[($c-1)]); } } function dialog_edit($name, &$var, $title="Change", $help="") { global $DIALOG, $STDIN; if ($DIALOG) { $c = dialog_real("--title '$title' --inputbox '\n$help\n' 13 60 '$var'"); } else { echo "\n\n" . $title . "\n" . str_repeat("¯", strlen($title)) . "\n" . $help ."\n"; echo "$name [" . $var . "] = "; $c = trim(fgets($STDIN)); } if ($c) { $var = $c; } } function dialog_yesno($name, &$var, $title="Change", $help="") { global $DIALOG, $STDIN, $DIALOG_EXIT; if ($DIALOG) { dialog_real("--title '$title' --yesno '$help' 15 60"); $c = $DIALOG_EXIT; if (($c==0)||($c==1)) { $var = 1 - $c; //0=Yes, 1=No } } else { echo "\n\n" . $title . "\n" . str_repeat("¯", strlen($title)) . "\n" . $help ."\n"; $var = ($var + 1) % 2; } } function dialog_readme() { global $DIALOG, $DIALOG_ADV_ARGS; if ($DIALOG && $DIALOG_ADV_ARGS && file_exists("README")) { dialog_real("--title 'Welcome to Nanoweb - the aEGiS PHP webserver' --no-cancel --textbox 'README' 18 72"); } } function bold($string) { return("" . $string . ""); } # --------------------------------------------------------------- setup -- function initial_config_values() { global $setup; if ($binary = getenv("PHP_BIN")) { $setup["PHP"] = $binary; } if ($uu = dirname(`which nanoweb.php`)) { $setup["BIN"] = $uu; } use_existing_config(); } function use_existing_config() { global $setup; if (file_exists($conffile = ($setup["CONF"] . "/nanoweb.conf"))) { $c = implode("", file($conffile)) . "\n\n"; $c .= implode("", file($setup["CONF"] . "/modules.conf")); if (preg_match('#\n\s*Log\s*=\s*([^\s]+)/[^/]+\s+#i', $c, $uu)) { $setup["LOG"] = $uu[1]; } if (preg_match('#\n\s*DocumentRoot\s*=\s*([^\s]+)\s+#i', $c, $uu)) { $setup["WWWROOT"] = $uu[1]; } if (preg_match('#\n\s*ModulesDir\s*=\s*([^\s]+)/modules/?\s+#i', $c, $uu)) { $setup["LIB"] = $uu[1]; } if (preg_match('#\n\s*Group\s*=\s*([^\s]+)\s+#i', $c, $uu)) { $setup["NWGROUP"] = $uu[1]; } if (preg_match('#\n\s*User\s*=\s*([^\s]+)\s+#i', $c, $uu)) { $setup["NWUSER"] = $uu[1]; } } } function parse_cmdline() { $ret=array(); foreach($_SERVER["argv"] as $arg) switch (strtolower($arg)) { case "-f": case "--force": $ret["force"]=true; break; case "-v": case "--verbose": $ret["verbose"]=true; break; } return($ret); } function init_defines() { define('HAVE_PCNTL', is_callable("pcntl_fork")); } function make_symlink($source, $dest) { if (!is_link($dest)) { $ret=`ln -v -s $source $dest`; if (isset($GLOBALS["cmd_args"]["verbose"])) echo $ret; } } function install_files($source, $dest, $mode="644", $add_opt="-D") { $ret=`install -v $add_opt -m$mode $source $dest`; if (isset($GLOBALS["cmd_args"]["verbose"])) echo $ret; } function install_mkdir($dest) { execute("mkdir -v -p " . $dest); } function execute($cmd) { $ret=`$cmd`; if (isset($GLOBALS["cmd_args"]["verbose"])) echo $ret; } # --------------------------------------------------------------- install -- function create_user_group() { extract($GLOBALS["setup"]); if (eregi('uid=', `id $NWUSER 2>/dev/null`)) { return(false); } echo bold("Creating group $NWGROUP\n"); execute("groupadd -g 33 $NWGROUP"); execute("groupadd $NWGROUP"); echo bold("Creating user $NWUSER\n"); execute("useradd -d $WWWROOT -u 33 -g $NWGROUP $NWUSER"); execute("useradd -d $WWWROOT -g $NWGROUP $NWUSER"); } function install_bin() { extract($GLOBALS["setup"]); echo bold("Installing program files in $BIN\n"); install_files("src/nanoweb.php", "$BIN/nanoweb.php", "755"); install_files("src/nanoctl", "$BIN/nanoctl", "755"); if ($INETD) install_files("src/in.nanoweb", "$BIN/in.nanoweb", "755"); install_files("src/htpasswd.php", "$BIN/htpasswd.php", "755"); } function install_mod() { extract($GLOBALS["setup"]); echo bold("Installing modules files in $LIB/modules\n"); install_mkdir("$LIB/modules"); execute("chmod 755 $LIB/modules"); install_files("modules/*", "$LIB/modules"); } function install_conf() { extract($GLOBALS["setup"]); if (file_exists($CONF . "/nanoweb.conf")) { echo bold("Updating configuration in $CONF\n"); update_config_files_new_version(); echo "You may want to check the manual to see if your configuration files need\nto be tweaked due to changed directive names. Usually changes are\nhowever not that extensive that anything will stop to work!\n"; } else { echo bold("Installing configuration files in $CONF\n"); install_files("conf/nanoweb.conf", "$CONF/nanoweb.conf"); install_files("conf/modules.conf", "$CONF/modules.conf"); install_files("conf/vhosts.conf", "$CONF/vhosts.conf"); if (file_exists("/etc/mime.types")) { make_symlink("/etc/mime.types", "$CONF/mime.types"); } else { install_files("conf/mime.types", "$CONF/mime.types"); } #-- update config files with install-sh settings patch_configs(); } #-- install theme files $theme_files = array( "default.theme", "nanoweb.theme", "fancy.theme", ); foreach ($theme_files as $tf) { if (!file_exists($tf)) { install_files("conf/$tf", "$CONF/$tf"); } } } function update_config_files_new_version() { extract($GLOBALS["setup"]); $trans = array( /* 2.0.0 */ 'LogToConsole' => "LogHitsToConsole", /* 2.1.0 */ '^\s*AllowExtSymlinks\s*=?\s*[1*].*$' => "AllowSymlinkTo = /", '^\s*FastCGI' => "FCGI", '^\s*FBTemplate.+' => '', /* 2.1.1 */ '^\s*TempDirectory\s*=' => 'TempDir =', ); $add = array( "nanoweb.conf" => array( /* 1.9.1 */ 'ServerSignature' => "ServerSignature = full \n", /* 2.1.0 */ 'ConfigDir' => "ConfigDir = $CONF \n", 'LoadTheme' => "LoadTheme = default.theme \n", 'ServerTheme' => "ServerTheme = default \n", 'DisableMimeMagic' => "DisableMimeMagic = 0 \n", /* 2.1.1 */ 'LogDir' => "LogDir = /var/log/nanoweb/ \n", ), "modules.conf" => array( /* 1.9.0 */ 'ModulesDir' => "ModulesDir = $LIB/modules/ \n", ) ); foreach ( array("nanoweb.conf", "modules.conf") as $cfn ) { if ($lines = file($CONF . '/' . $cfn)) { foreach ($lines as $i=>$l) { foreach ($trans as $regex=>$dest) if (preg_match("/$regex/i", $l)) { echo "changing " . $cfn . " (" . $dest . ")\n"; $l = preg_replace("/$regex/i", $dest, $l); $lines[$i] = "## " . $lines[$i] . $l; } foreach (@$add[$cfn] as $regex=>$new) if (preg_match("/$regex/i", $l)) { unset($add[$cfn][$regex]); } } if ($add[$cfn]) { $lines[] = "\n\n# added by install-sh:\n"; echo "adding newly introduced core directives to $cfn\n"; foreach ($add[$cfn] as $l) $lines[] = $l; } $fp = fopen($CONF . "/" . $cfn, "w"); fputs($fp, implode("", $lines)); fclose($fp); } } } function create_logdir() { extract($GLOBALS["setup"]); if (! file_exists($LOG)) { echo bold("Creating log directory $LOG\n"); install_mkdir("$LOG"); execute("chown $NWUSER $LOG"); execute("chgrp $NWGROUP $LOG"); } } function create_wwwroot() { extract($GLOBALS["setup"]); if (! file_exists($WWWROOT)) { echo bold("Creating WWW root directory\n"); install_mkdir($WWWROOT); execute("chmod 755 $WWWROOT"); } } function install_defaultroot() { extract($GLOBALS["setup"]); $VARWWW = preg_replace("/\b(localhost|nanoweb)\b/", "", $WWWROOT); echo bold("Copying default site files to $LIB/defaultroot\n"); install_mkdir("$LIB/defaultroot/"); install_files("www/default/*", "$LIB/defaultroot/"); install_files("ChangeLog", "$LIB/defaultroot/ChangeLog"); install_files("README", "$LIB/defaultroot/README"); make_symlink(".", "$LIB/defaultroot/nanoweb"); #-- 4 more helper symlinks foreach (array($WWWROOT, $VARWWW) as $WWWROOT) { if (!file_exists("$WWWROOT/index.html")) { make_symlink("$LIB/defaultroot/index.html", "$WWWROOT/index.html"); } make_symlink("$LIB/defaultroot", "$WWWROOT/nanoweb"); } } function install_manpages() { extract($GLOBALS["setup"]); echo bold("Copying man pages to $MANDIR\n"); if (file_exists($MANDIR."/man1")) install_files("docs/man/man1/*.gz", "$MANDIR/man1/", "644", ""); if (file_exists($MANDIR."/man5")) install_files("docs/man/man5/*.gz", "$MANDIR/man5/", "644", ""); if (file_exists($MANDIR."/man8")) install_files("docs/man/man8/*.gz", "$MANDIR/man8/", "644", ""); } function install_manual() { extract($GLOBALS["setup"]); echo bold("Copying manual files to $DOC\n"); install_mkdir("$DOC/html/"); install_files("docs/manual/*", "$DOC/html/"); install_files("docs/*.*", "$DOC/"); install_files("ChangeLog", "$DOC/ChangeLog"); install_files("README", "$DOC/README"); install_files("CREDITS", "$DOC/CREDITS"); install_files("INSTALL", "$DOC/INSTALL"); install_files("LICENSE", "$DOC/LICENSE"); make_symlink("$DOC/.", "$DOC/nanoweb"); } function install_nanoconfig() { extract($GLOBALS["setup"]); echo bold("Copying nanoconfig files to $LIB/nanoconfig\n"); install_mkdir("$LIB/nanoconfig/"); install_files("www/nanoconfig/*", "$LIB/nanoconfig/"); install_files("www/nanoconfig/.nwaccess", "$LIB/nanoconfig/.nwaccess"); make_symlink("$LIB/nanoconfig", "$LIB/defaultroot/nanoconfig"); } function install_icons() { extract($GLOBALS["setup"]); echo bold("Copying icon files to $LIB/icons\n"); install_mkdir("$LIB/icons/"); install_files("www/icons/*", "$LIB/icons"); } function install_vhosts() { extract($GLOBALS["setup"]); install_files("www/vhosts/www.cgidemo.com/index.php", "$LIB/vhosts/www.cgidemo.com/index.php"); install_files("www/vhosts/www.cgidemo.com/poweredbynanoweb-black.gif", "$LIB/vhosts/www.cgidemo.com/poweredbynanoweb-black.gif"); ## execute("chown -R $NWUSER $LIB/vhosts"); ## execute("chgrp -R $NWGROUP $LIB/vhosts"); } function create_nanoweb_pem() { extract($GLOBALS["setup"]); if (!file_exists("$SSLDIR/nanoweb.pem")) { echo bold("Creating nanoweb SSL certificate\n"); install_mkdir("$SSLDIR"); system("openssl req -new -x509 -nodes -out $SSLDIR/nanoweb.pem -keyout $SSLDIR/nanoweb.pem -days 9999"); system("ln -s $SSLDIR/nanoweb.pem $SSLDIR/`openssl x509 -noout -hash < $SSLDIR/nanoweb.pem`.0"); } } function add_inetd_lines () { extract($GLOBALS["setup"]); if (strpos(implode("",file('/etc/inetd.conf')), "nanoweb")!==false) { return(false); } echo bold("Adding comments to /etc/inetd.conf\n"); if ($inetd_conf = fopen("/etc/inetd.conf", "a")) { fwrite($inetd_conf, "\n# nanoweb inetd support\n"); fwrite($inetd_conf, "#www stream tcp nowait root $BIN/in.nanoweb nanoweb\n"); fwrite($inetd_conf, "#https stream tcp nowait root $BIN/in.nanoweb nanoweb -ssl\n"); fclose($inetd_conf); } else { echo "ERROR: could not apply changes to /etc/inetd.conf\n"; } // This one is for SSL usage, but depends on inetd: create_nanoweb_pem(); } function add_bootup_scripts() { extract($GLOBALS["setup"]); if ($INIT && file_exists('/etc/rc2.d') && file_exists('/etc/init.d/rc')) { echo bold("Registering for automatic start on bootup\n"); if (!file_exists('/etc/init.d/nanoweb')) { make_symlink("$BIN/nanoctl", "/etc/init.d/nanoweb"); } foreach (array(2,3,4,5) as $RUNLEVEL) { if (! (`ls /etc/rc{$RUNLEVEL}.d/S*nanoweb 2>/dev/null`)) { make_symlink("/etc/init.d/nanoweb", "/etc/rc{$RUNLEVEL}.d/S99nanoweb"); } } } } function patch_configs() { extract($GLOBALS["setup"]); echo bold("Adjusting configuration files with your settings\n"); foreach (array("nanoweb.conf", "modules.conf", "vhosts.conf") as $cf) { echo "patching $cf"; if ($conf = implode("", file($CONF . "/" . $cf))) { $conf = preg_replace('# /usr/lib/nanoweb#m', " $LIB", $conf); $conf = preg_replace('# /etc/nanoweb#m', " $CONF", $conf); $conf = preg_replace('# /var/www/localhost#m', " $WWWROOT", $conf); $conf = preg_replace('#(\nGroup\s+=\s*)www-data#m', "$1" . $NWGROUP, $conf); $conf = preg_replace('#(\nUser\s+=\s*)www-data#m', "$1" . $NWUSER, $conf); $conf = preg_replace('# /usr/(local/)?bin/php(-cgi)?#m', " $PHP", $conf); if ($f = fopen($CONF . "/" . $cf, "w")) { fwrite($f, $conf); fclose($f); } else { echo " could not open for writing!!"; } } echo "\n"; } } function patch_binaries() { extract($GLOBALS["setup"]); foreach (array("/nanoweb.php", "/nanoctl", "/in.nanoweb", "/htpasswd.php") as $bf) { if ($bin = @implode("", @file($BIN . $bf))) { $bin = preg_replace('|^#!/usr/local/bin/php|', "#!" . $PHP, $bin); $bin = preg_replace('|/usr/sbin/nanoweb.php|', $BIN . "/nanoweb.php", $bin); if ($f = @fopen($BIN . $bf, "w")) { fwrite($f, $bin); fclose($f); } } } } function check_phpini() { $good_values = array( "short_open_tag" => "1", "cgi.force_redirect" => "0", "cgi.fix_pathinfo" => "0", "cgi.rfc2616_headers" => "1", "register_argc_argv" => "1" ); foreach ($good_values as $setting => $recommended) { $value = strtolower(get_cfg_var($setting)); if ($value=="on") $value="1"; if ($value=="off") $value="0"; if ($value !== $recommended) { echo "php.ini warning: we recommend to set " . $setting . " = " . $recommended . "\n"; } } } function print_postreadme() { # echo bold("\nDone.\n"); echo "\n"; echo "*******************************************************************************\n"; echo "* Things you should do now : *\n"; echo "*******************************************************************************\n"; echo "* *\n"; echo "* FOR A NEW INSTALL : *\n"; echo "* *\n"; echo "* - Read INSTALL if not already done *\n"; echo "* - Edit configuration file /etc/nanoweb/nanoweb.conf *\n"; echo "* - Type 'nanoctl start' to start the server *\n"; echo "* - Browse to http://localhost/ *\n"; echo "* *\n"; echo "* FOR AN UPGRADE : *\n"; echo "* *\n"; echo "* - Read the ChangeLog *\n"; echo "* - Type 'nanoctl restart' to restart the server *\n"; if (!HAVE_PCNTL) { echo "* *\n"; echo "* WARNING : Your PHP binary does not have process control support. Nanoweb *\n"; echo "* makes heavy use of it and server performance will be greatly degraded *\n"; echo "* without it. If the server seems slow, consider rebuilding your PHP binary *\n"; echo "* using the \"".bold("--enable-pcntl")."\" configure directive. *\n"; } echo "* *\n"; echo "*******************************************************************************\n\n"; } ?> nanoweb_2.2.9/LICENSE0000644000000000000000000003560511023557654012763 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS nanoweb_2.2.9/src/0000755000000000000000000000000011023557654012534 5ustar rootrootnanoweb_2.2.9/src/in.nanoweb0000644000000000000000000000113511023557654014515 0ustar rootroot#!/bin/sh # Nanoweb inetd wrapper script (c) 2002 by Vincent Negrier PEERNAME=`getpeername -n` export INETD_REMOTE_IP=`echo $PEERNAME |cut -d' ' -f1` export INETD_REMOTE_PORT=`echo $PEERNAME |cut -d' ' -f2` case "$1" in -ssl) # SSL inetd operation (with stunnel) /usr/sbin/stunnel -p/etc/ssl/certs/nanoweb.pem -l/usr/local/bin/php -- -q -f /usr/sbin/nanoweb.php --config="/etc/nanoweb/nanoweb.conf" --set-option="servermode=inetd" ;; *) # Normal inetd operation /usr/sbin/nanoweb.php --config="/etc/nanoweb/nanoweb.conf" --set-option="servermode=inetd" ;; esac nanoweb_2.2.9/src/nanoctl0000644000000000000000000000604411023557654014121 0ustar rootroot#!/bin/sh # # Nanoweb start/stop script - by Vincent Negrier # SERV='/usr/sbin/nanoweb.php' CONF='/etc/nanoweb/nanoweb.conf' SRVBN=$(basename $SERV) PIDFILE=`grep -i pidfile $CONF |cut -d= -f2 |cut -c2-` SRVPORT=`grep -i listenport $CONF |head -1 |cut -d= -f2 |cut -c2-` BROWSER='lynx' is_running () { if [ -f "$PIDFILE" ]; then return 0; else return 1; fi } nw_start () { echo -n "Starting nanoweb http server: " if is_running; then echo "already running, use restart option instead"; else $SERV --config=$CONF --start-daemon --quiet if [ $? == 0 ]; then echo "$SRVBN" fi fi } nw_stop () { echo -n "Stopping nanoweb http server: " if is_running; then kill `cat $PIDFILE` >/dev/null 2>/dev/null sleep 1 rm -f $PIDFILE echo "$SRVBN" else echo "not running"; fi } nw_reload () { echo -n "Reloading nanoweb http server: " if is_running; then kill -HUP `cat $PIDFILE` >/dev/null 2>/dev/null echo "$SRVBN"; else echo "not running, use start option instead"; fi } nw_configtest () { $SERV --config=$CONF --config-test } nw_status () { if is_running; then $BROWSER -dump http://localhost:$SRVPORT/server-status?$QSTRING else echo "Server is not running" fi } nw_blockadm () { if is_running; then $BROWSER -dump http://localhost:$SRVPORT/blockadm?$QSTRING else echo "Server is not running" fi } case "$1" in start) nw_start; ;; stop) nw_stop; ;; reload) nw_reload; ;; restart) nw_stop; sleep 1 nw_start; ;; configtest) nw_configtest; ;; status) QSTRING="$2" nw_status; ;; block) QSTRING="act=block&addr=$2&dur=$3" nw_blockadm; ;; unblock) QSTRING="act=unblock&addr=$2&dur=$3" nw_blockadm; ;; *) echo "Usage: nanoctl [ options ]" echo "" echo "available options" echo "" echo "start : start the server" echo "stop : stop the server" echo "restart : stop and start the server" echo "reload : reload server configuration" echo "configtest : test configuration and exit" echo "" echo "status options (available only if mod_status is loaded into the server)" echo "" echo "status : show server status summary" echo "status who : show active server processes status" echo "status detailed : show detailed server status" echo "status vstats : show vhosts quick stats" echo "status xml : output xml document" echo "status wddx : output wddx encoded packet" echo "status php-serialize : output php serialize()d string" echo "" echo "detailed, vstats, xml, wddx, php-serialize can be mixed using the - separator" echo "" echo "address blocking options (available only if mod_blockadm is loaded)" echo "" echo "block [|PERM] : block for seconds" echo "unblock : unblock " echo "" echo "notes : must be supplied as a numeric IP address" echo " list of blocked addresses is available with 'nanoctl status detailed'" echo "" ;; esac nanoweb_2.2.9/src/nanoweb.php0000644000000000000000000020626011023557654014704 0ustar rootroot#!/usr/local/bin/php -q This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ error_reporting(E_PARSE | E_ERROR); if (strpos($opts='^'.implode('_', $_SERVER["argv"]).'$', "--debug") + strpos($opts, "--verbose")) { error_reporting(E_ALL); } define("VERSION", "2.2.9"); // Hard configuration and defaults define("DEFAULT_CONFIG_FILE", (((strpos(strtoupper(PHP_OS), "WIN")===0) || (strpos(strtoupper(PHP_OS), "CYGWIN")===0))?"C:\\nanoweb\\":"/etc/nanoweb/")."nanoweb.conf"); define("DEFAULT_LISTEN_ADDR", "0.0.0.0"); define("DEFAULT_LISTEN_PORT", 80); define("DEFAULT_LISTEN_QUEUE", 20); define("DEFAULT_MIMETYPES", "/etc/mime.types"); define("DEFAULT_CONTENT_TYPE", "text/plain"); define("DEFAULT_REQUEST_TIMEOUT", 15); define("DEFAULT_ACCESS_FILE", ".nwaccess"); define("DEFAULT_DOCROOT", "./"); define("DEFAULT_LOGFILE", "./access.log"); define("DEFAULT_LOGTYPE", "combined"); define("DEFAULT_FBWELCOMEFILE", ".welcome"); define("DEFAULT_STATIC_BUFFER_SIZE", 1048576); define("DEFAULT_CONTENT_HANDLER", "static"); define("DEFAULT_MAX_SERVERS", 25); define("DEFAULT_ACCESS_POLICY", "override"); define("DEFAULT_SERVER_THEME", "default"); define("DEFAULT_SERVER_LANG", "en-us"); define("SCK_WRITE_PACKET_SIZE", 8192); define("SCK_READ_PACKET_SIZE", 4096); define("SCK_READ_SELECT_TIMEOUT", 2); define("SCK_MAX_STALL_TIME", 60); define("SPM_CACHES_LIFETIME", 15); define("HTTP_VERSION", "HTTP/1.1"); define("SERVER_STRING", "aEGiS_nanoweb"); define("SERVER_STRING_V", SERVER_STRING."/".VERSION); define("INT_MSGSIZE", 4096); define("NM_HIT", " HIT"); define("NM_RESTART_LOGGERS", "LGRST"); define("NM_SERVER_STATE", "SRVST"); define("NM_RELOAD_THEME", "RLTHM"); define("NM_BLOCK_IP", "BANIP"); define("NM_UNBLOCK_IP", "DBNIP"); define("NW_BAD_OUTSIDE_DOCROOT", 1); define("NW_BAD_DOT_FILE", 2); define("NW_BAD_WIN_DEVICE", 3); define("NW_SB_STATUS", 0); define("NW_SB_PEERHOST", 1); define("NW_SB_FORKTIME", 2); define("NW_EL_DEBUG", 1); define("NW_EL_HIT", 2); define("NW_EL_NOTICE", 4); define("NW_EL_BLOCKING", 8); define("NW_EL_WARNING", 16); define("NW_EL_ERROR", 32); define("NW_EL_ALL", 255); define("NW_EL_DEFAULT", NW_EL_NOTICE | NW_EL_BLOCKING | NW_EL_WARNING | NW_EL_ERROR); define("NW_TMPL_SIGNATURE", "server_signature"); define("NW_TMPL_ERROR_PAGE", "error_page"); define("NW_TMPL_ERROR_RESOURCE", "error_resource"); define("NW_TMPL_ERROR_ADMIN", "error_admin"); define("REQUIRED_PHP_VERSION", "4.2.0"); // Internally used global vars $HTTP_HEADERS=array(100 => "100 Continue", 200 => "200 OK", 201 => "201 Created", 204 => "204 No Content", 206 => "206 Partial Content", 300 => "300 Multiple Choices", 301 => "301 Moved Permanently", 302 => "302 Found", 303 => "303 See Other", 304 => "304 Not Modified", 307 => "307 Temporary Redirect", 400 => "400 Bad Request", 401 => "401 Unauthorized", 403 => "403 Forbidden", 404 => "404 Not Found", 405 => "405 Method Not Allowed", 406 => "406 Not Acceptable", 408 => "408 Request Timeout", 410 => "410 Gone", 413 => "413 Request Entity Too Large", 414 => "414 Request URI Too Long", 415 => "415 Unsupported Media Type", 416 => "416 Requested Range Not Satisfiable", 417 => "417 Expectation Failed", 500 => "500 Internal Server Error", 501 => "501 Method Not Implemented", 503 => "503 Service Unavailable", 506 => "506 Variant Also Negotiates"); $TEST_FUNCS=array( "pcntl_fork" => false, "socket_create" => true, "posix_setuid" => false, "gzencode" => false); $conf_defaults=array( "listeninterface" => DEFAULT_LISTEN_ADDR, "listenport" => DEFAULT_LISTEN_PORT, "listenqueue" => DEFAULT_LISTEN_QUEUE, "mimetypes" => DEFAULT_MIMETYPES, "requesttimeout" => DEFAULT_REQUEST_TIMEOUT, "accessfile" => DEFAULT_ACCESS_FILE, "documentroot" => DEFAULT_DOCROOT, "log" => DEFAULT_LOGFILE, "logtype" => DEFAULT_LOGTYPE, "fbwelcomefile" => DEFAULT_FBWELCOMEFILE, "defaultcontenttype" => DEFAULT_CONTENT_TYPE, "staticbuffersize" => DEFAULT_STATIC_BUFFER_SIZE, "defaulthandler" => DEFAULT_CONTENT_HANDLER, "maxservers" => DEFAULT_MAX_SERVERS, "accesspolicy" => DEFAULT_ACCESS_POLICY, "servertheme" => DEFAULT_SERVER_THEME); $conf_vhosts_propagate=array( "documentroot", "directoryindex", "serveradmin", "user", "group", "logdir", "log", "logtype", "filebrowser", "fbshowdotfiles", "fbwelcomefile", "userdir", "ignoredotfiles", "allowsymlinkto", "maxrequestbodylength", "maxrequesturilength"); // Needed as long as PHP filetype() is broken on win32 $win_devices=array("nul", "con", "aux", "prn", "clock$", "com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8", "lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8"); // Command line help page $cmdline_help=<<str=$str; $this->content_length=strlen($str); } function parser_open($args, $filename, &$rq_err, &$cgi_headers) { } function parser_get_output() { $s=$this->str; $this->str=""; return($s); } function parser_eof() { return($this->str === ""); } function parser_close() { } } $null_response =& new static_response(""); $lf=$null_response; // Functions function _parseconfig_close_part(&$conf, $cpart, $nodefaults=false) { if (!$conf[$cpart]["_nw_pcp"]) { if (!$nodefaults) { if ($cpart=="global") { // Use default values for the global config scope foreach ($GLOBALS["conf_defaults"] as $key=>$dval) if (!isset($conf[$cpart][$key])) $conf[$cpart][$key][0]=$dval; } else { // Propagate appropriate directives to vhosts foreach ($GLOBALS["conf_vhosts_propagate"] as $key=>$pkey) if (!isset($conf[$cpart][$pkey])) $conf[$cpart][$pkey]=$conf["global"][$pkey]; if (!$conf[$cpart]["servername"]) $conf[$cpart]["servername"][]=$cpart; } } // Transform some directives (Dir = Idx Value) foreach (array("parseext", "errordocument", "errorheader") as $dir) { if ($conf[$cpart][$dir]) { foreach ($conf[$cpart][$dir] as $ps) { $ext=strtolower(strtok($ps, " ")); $dext=trim(strtok("")); $conf[$cpart]["_".$dir]["_".$ext]=$dext; } } } $conf[$cpart]["_nw_pcp"]=true; } } function _parseconfig_parse_line($str) { $cnfl=array(); ereg("([^ =\n\t]+)[ \t]*=?[ \t]*([^\n]+)", $str, $cnfl); return(array(strtolower(trim($cnfl[1])), trim($cnfl[2]))); } function parseconfig($conf_arr, $nodefaults=false) { $cpart="global"; $_pcp=array("global"); $included_confs[$GLOBALS["conffile"]]=true; if ($clen=count($conf_arr)) { // Pass 1 (build the $conf_arr array) $key=-1; while ($key++<=$clen) { $str=$conf_arr[$key]; list($cnfk, $cnfv)=_parseconfig_parse_line($str); if ($cnfk=="configdir") { $confdir=$cnfv; } else if ($cnfk=="include") { $ifn=($confdir?($confdir.DIRECTORY_SEPARATOR):"").$cnfv; if (!@is_readable($ifn)) $ifn=$cnfv; if ($included_confs[$ifn]) { $conf_err="configuration includes loop detected line ".$key." : '".trim($str)."'"; break; } if (!@is_readable($ifn)) { $conf_err="unable to include configuration file line ".$key." : '".$ifn."'"; break; } $subconf_arr=file($ifn); $conf_arr=array_merge(array_slice($conf_arr, 0, $key), $subconf_arr, array_slice($conf_arr, $key+1)); $key=-1; $clen=count($conf_arr); $included_confs[$ifn]=true; } } // Pass 2 (build the $conf array) foreach ($conf_arr as $key=>$str) { switch ($str[0]) { case "#": case ";": case "\n": case "": break; case "[": if ($cpart!="global") $_pcp[]=$cpart; $cpart=substr(trim($str), 1, -1); if ($cpart{0}=="/") $cpart="global"; if ($cpart!="global") unset($conf[$cpart]); break; default: list($cnfk, $cnfv)=_parseconfig_parse_line($str); switch ($cnfk) { case "documentroot": $rp=nw_realpath($cnfv); if (!($rp && @is_dir($rp))) { $conf_err="directory not found at line ".$key." : '".trim($str)."'"; unset($conf[$cpart]); $cpart="_err:".$cpart; } if (substr($rp, -1)!=DIRECTORY_SEPARATOR) $rp.=DIRECTORY_SEPARATOR; $conf[$cpart][$cnfk][]=$rp; break; case "serveralias": if ($cnfv!=$cpart) $conf[$cnfv]=&$conf[$cpart]; break; case "alias": $conf[$cpart][$cnfk][]=$cnfv; $aliases=explode(" ", $cnfv); $conf[$cpart]["_aliases"][$aliases[0]]=$aliases[1]; break; case "serverlog": $lname=strtok($cnfv, " "); if ($lmode=strtok("")) { $lbmode=0; foreach($GLOBALS["srvlog_levels"] as $lvl=>$bin_lvl) if (strpos($lmode, $lvl)!==false) $lbmode|=$bin_lvl; foreach($GLOBALS["srvlog_levels"] as $lvl=>$bin_lvl) if (strpos($lmode, "-".$lvl)!==false) $lbmode&=~$bin_lvl; } else { $lbmode=NW_EL_DEFAULT; } $conf[$cpart]["_serverlog"][$lname]=$lbmode; break; case "loadtheme": $conf[$cpart][$cnfk][]=$cnfv; $conf[$cpart]["servertheme"][]=$cnfv; break; default: $conf[$cpart][$cnfk][]=$cnfv; break; } break; } } } // Pass 3 (close all $conf sections) if ($cpart!="global") $_pcp[]=$cpart; foreach ($_pcp as $clpart) _parseconfig_close_part($conf, $clpart, $nodefaults); return($conf_err?$conf_err:$conf); } function cmdline_conf_upd($conf, $cmdline_conf_overrides, $cmdline_conf_adds) { foreach ($cmdline_conf_overrides as $cs) { $ca=explode("=", $cs); $conf["global"][strtolower($ca[0])]=array($ca[1]); } foreach ($cmdline_conf_adds as $cs) { $ca=explode("=", $cs); $conf["global"][strtolower($ca[0])][]=$ca[1]; } return($conf); } function load_modules($conf) { global $mod_tokens; $mod_tokens=array(); if ($lm_arr=$conf["global"]["loadmodule"]) foreach ($lm_arr as $key=>$modname) { $clsname=basename($modname, ".php"); if (!is_file($modname)) { foreach (access_query("modulesdir") as $md) if (is_file($md.DIRECTORY_SEPARATOR.$modname)) { $moddir=$md; break; } } else $moddir=""; if (!$ld_clss[$clsname]) { $nload=(!class_exists($clsname)); // Try to load with given path @include_once($modname); $modloaded=class_exists($clsname); if (!$modloaded) { // And try with modulesdir if not found @include_once($moddir.$modname); $modloaded=class_exists($clsname); } if ($modloaded) { $ld_clss[$clsname]=true; $tmp=&new $clsname; $modules[$tmp->modtype][]=&$tmp; $tmp_modlist[]=array($clsname, $tmp->modname); if (is_array($tmp->urls)) foreach ($tmp->urls as $url) $modules["url:".$url]=&$tmp; if (is_array($tmp->methods)) foreach ($tmp->methods as $method) $modules["method:".$method]=&$tmp; if (is_string($mt=$tmp->sig_token)) $mod_tokens[$tmp->modname]=$mt; if ($nload) techo("loaded module : ".$tmp->modname); } else { techo("WARN: unable to load module '".$modname."'", NW_EL_WARNING); } } } $GLOBALS["stats_modlist"]=$tmp_modlist; return ($modules); } function load_theme($themefname, $load_notice=false, $reload=false) { $tfn=($GLOBALS["conf"]["global"]["configdir"][0]?($GLOBALS["conf"]["global"]["configdir"][0].DIRECTORY_SEPARATOR):"").$themefname; if (!@is_readable($tfn)) $tfn=$themefname; if ($thmarr=@file($tfn)) { $ts=0; foreach ($thmarr as $thml) { if (strtolower(rtrim($thml))=="[/".$thm_sc."]") { $theme[$thm_sc]=substr($theme[$thm_sc], 0, -1); --$ts; $thm_sc=""; } else if (($thml{0}=="[") && (substr(rtrim($thml), -1)=="]")) { $thm_sc=strtolower(substr(rtrim($thml), 1, -1)); } else if ($thm_sc) { $theme[$thm_sc].=$thml; $ts+=strlen($thml); } } if ($theme["theme_id"]) { if (!$theme["theme_name"]) $theme["theme_name"]=$theme["theme_id"]; $theme["theme_id"]=trim($theme["theme_id"]); $theme["theme_name"]=trim($theme["theme_name"]); $theme["theme_language"]=trim($theme["theme_language"]) or $theme["theme_language"]=DEFAULT_SERVER_LANG; if ($load_notice) techo(($reload?"re":"")."loaded theme : ".$theme["theme_name"]." (".$ts." bytes)"); } else { techo("WARN: invalid theme file '".$tfn."'", NW_EL_WARNING); } clearstatcache(); $theme["_fname"]=$tfn; $theme["_mtime"]=filemtime($tfn); $theme["_pmode"]=$GLOBALS["pmode"]; } else { techo("WARN: unable to load theme file '".$tfn."'", NW_EL_WARNING); } return($theme); } function load_themes($conf) { if (is_array($conf["global"]["loadtheme"])) foreach ($conf["global"]["loadtheme"] as $themefname) { $theme=load_theme($themefname, true); $themes[$theme["theme_id"]]=$theme; $themes[$theme["_fname"]]=$theme; } else { techo("WARN: 'LoadTheme' directive not found in config file", NW_EL_WARNING); } return($themes); } function modules_init($method="init") { global $modules; foreach ($modules as $modclass) if (is_array($modclass)) { for ($a=0;$a$method(); $modinit[$mc]=true; } } } else { if ((method_exists($modclass, $method)) && (!$modinit[$mc=get_class($modclass)])) { $modclass->$method(); $modinit[$mc]=true; } } } function load_access_files($dir, &$access, $rec=0) { global $conf, $access_cache; if (is_array($z=$access_cache[$dir])) { // Access cache hit $access=$z; return; } else { // Access cache miss if (!$rec) $access=array(); $ndir=substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR)); $cont = false; $r_mdir = nw_realpath($ndir.DIRECTORY_SEPARATOR); $cont_dirs = array(nw_realpath($GLOBALS["docroot"])); foreach ($conf[$GLOBALS["vhost"]]["allowsymlinkto"] as $als) $cont_dirs[] = nw_realpath($als); foreach ($cont_dirs as $cdir) if (strpos($r_mdir, $cdir)===0) { load_access_files($ndir, $access, $rec+1); break; } $afn=$dir.DIRECTORY_SEPARATOR.$conf["global"]["accessfile"][0]; if (is_readable($afn) && ($accesstmp=@file($afn)) && ($tmp_access=parseconfig($accesstmp, true))) foreach ($tmp_access as $key=>$val_arr) { foreach ($val_arr as $ckey=>$cval_arr) { $ap=$GLOBALS["access_policy"][$ckey] or $ap=$conf["global"]["accesspolicy"][0]; switch ($ap) { case "override": $access[$key][$ckey]=$cval_arr; break; case "merge": $access[$key][$ckey]=array_merge($access[$key][$ckey], $cval_arr); break; } } if (!$rec) break; } $access_cache[$dir]=$access; } } function access_query($key, $idx=false) { global $access, $conf; $ap=$GLOBALS["access_policy"][$key] or $ap=$conf["global"]["accesspolicy"][0]; switch ($ap) { case "override": $tmp=$access["global"][$key] or $tmp=$conf[$GLOBALS["vhost"]][$key] or $tmp=$conf["global"][$key]; break; case "merge": $tmp=array_merge($conf["global"][$key] ? $conf["global"][$key] : array(), $conf[$GLOBALS["vhost"]][$key] ? $conf[$GLOBALS["vhost"]][$key] : array(), $access["global"][$key] ? $access["global"][$key] : array()); break; } if ($idx===false) { return($tmp); } else { return($tmp[$idx]); } } function core_modules_hook($hname) { if ($mh_arr=&$GLOBALS["modules"]["core_".$hname]) foreach (array_keys($mh_arr) as $a) $mh_arr[$a]->main(); } function log_ids() { global $conf; if ($setgid=@posix_getgrnam($conf["global"]["loggergroup"][0])) $g=$setgid["gid"]; else if ($setgid=@posix_getgrnam($conf["global"]["group"][0])) $g=$setgid["gid"]; if ($setuid=@posix_getpwnam($conf["global"]["loggeruser"][0])) $u=$setuid["uid"]; else if ($setuid=@posix_getpwnam($conf["global"]["user"][0])) $u=$setuid["uid"]; return(array("uid" => $u, "gid" => $g)); } function log_srv($str, $loglevel=NW_EL_NOTICE) { if ($srvlog_arr=$GLOBALS["conf"]["global"]["_serverlog"]) foreach ($srvlog_arr as $s=>$bmode) if ($loglevel & $bmode) { if (($GLOBALS["pmode"]=="master") && (!file_exists($s))) $chown=true; if ($sl=@fopen($s, NW_BSAFE_APP_OPEN)) { fputs($sl, $str); fclose($sl); } if ($chown && $GLOBALS["posix_av"] && ($lids=log_ids())) { chgrp($s, $lids["gid"]); chown($s, $lids["uid"]); } } } function nw_gethostbyaddr($ip) { static $ns_lastreq; if ($ip != $ns_lastreq[0]) { $hostname = @gethostbyaddr($ip); $fwr_ip = @gethostbyname($hostname); if ($ip != $fwr_ip) { // Inconsistent DNS data $hostname = $ip; } $ns_lastreq = array($ip, $hostname); } return($ns_lastreq[1]); } function nw_realpath($dir) { global $rp_cache; if ($rp=$rp_cache[$dir]) { return($rp); } else { return($rp_cache[$dir]=realpath($dir)); } } function nw_server_string() { switch (strtolower(access_query("serversignature", 0))) { case "fake": return(access_query("serverfakesignature", 0)); case "off": return(""); case "prod": return(SERVER_STRING); case "min": return(SERVER_STRING_V); case "os": return(SERVER_STRING_V." (".PHP_OS.")"); case "php": return(SERVER_STRING_V." (".PHP_OS."; PHP/".phpversion().")"); case "full": default: return(SERVER_STRING_V." (".PHP_OS."; PHP/".phpversion().($GLOBALS["mod_tokens"]?"; ":"").implode("; ", $GLOBALS["mod_tokens"]).")"); } } function _genpage_signature() { return(nw_apply_template(NW_TMPL_SIGNATURE, array("server_string" => nw_server_string(), "server_name" => $GLOBALS["conf"][$GLOBALS["vhost"]]["servername"][0]), true)); } function nw_apply_template($template, $args, $no_add=false) { global $themes; $sts = access_query("servertheme"); $lts = access_query("loadtheme"); $thmid=array_pop($sts); $fname=$themes[$thmid]["_fname"]; if ($thmid==$fname) $thmid=$themes[$thmid]["theme_id"]; if ((!is_array($themes[$thmid])) && ($ltid=array_pop($lts))) $fname=$ltid; clearstatcache(); if (($themes[$thmid]["_mtime"]!=filemtime($fname)) && ($tmp_thm=load_theme($fname))) { if ($themes[$thmid]["_pmode"]=="master") int_sendtomaster(NM_RELOAD_THEME, $thmid); $themes[$thmid]=$tmp_thm; $themes[$fname]=$tmp_thm; $themes[$tmp_thm["_fname"]]=$tmp_thm; } $tlang=strtolower($themes[$thmid]["theme_language"]); if (($al=$GLOBALS["htreq_headers"]["ACCEPT-LANGUAGE"]) && ($als=nw_decode_mq_hdr($al))) { foreach (array_keys($als) as $lang) { $lang=strtolower($lang); if (isset($themes[$thmid][$template.":".$lang])) { $tname=$template.":".$lang; break; } else if ($tlang==$lang) { break; } } } if (!$tname) $tname=$template; $tmpl=$themes[$thmid][$tname] or $tmpl=$themes[DEFAULT_SERVER_THEME][$tname]; foreach ($args as $k=>$v) $tr_arr["@$".strtolower($k)."@"]=$v; if (!$no_add) $tr_arr['@$server_signature@']=_genpage_signature(); $trt=strtr($tmpl, $tr_arr); while ((($p=strpos($trt, "@!"))!==false) && (($p2=strpos(substr($trt, $p+2), "@"))!==false)) { $ret=substr($trt, 0, $p); $ret.=access_query(strtolower(substr($trt, $p+2, $p2)), 0); $ret.=substr($trt, $p+$p2+3); $trt=$ret; } return($trt); } function nw_server_vars($include_cgi_vars=false) { global $conf; $filename=$GLOBALS["docroot"].$GLOBALS["http_uri"]; $nsv["SERVER_SOFTWARE"]=nw_server_string(); $nsv["SERVER_NAME"]=$conf[$GLOBALS["vhost"]]["servername"][0]; $nsv["SERVER_PROTOCOL"]=HTTP_VERSION; $nsv["SERVER_PORT"]=$GLOBALS["lport"]; $nsv["SERVER_ADDR"]=$conf["global"]["listeninterface"][0]; $nsv["SERVER_API"]=VERSION; $nsv["SERVER_ADMIN"]=$conf[$GLOBALS["vhost"]]["serveradmin"][0]; $nsv["REQUEST_METHOD"]=$GLOBALS["http_action"]; $nsv["PATH_TRANSLATED"]=$nsv["SCRIPT_FILENAME"]=nw_realpath($filename); $nsv["SCRIPT_NAME"]="/".$GLOBALS["docroot_prefix"].$GLOBALS["http_uri"]; $nsv["QUERY_STRING"]=$GLOBALS["query_string"]; $nsv["REMOTE_HOST"]=$GLOBALS["remote_host"]; $nsv["REMOTE_ADDR"]=$GLOBALS["remote_ip"]; $nsv["REMOTE_PORT"]=$GLOBALS["remote_port"]; $nsv["AUTH_TYPE"]=$GLOBALS["auth_type"]; $nsv["DOCUMENT_ROOT"]=$GLOBALS["docroot"]; $nsv["REQUEST_URI"]="/".$GLOBALS["real_uri"].($nsv["QUERY_STRING"]?("?".$nsv["QUERY_STRING"]):""); $nsv["PATH_INFO"]=$GLOBALS["path_info"]; if (($GLOBALS["logged_user"]) && ($GLOBALS["logged_user"] != " ")) { $nsv["REMOTE_USER"] = $GLOBALS["logged_user"]; } if ($asv=access_query("addservervar")) foreach ($asv as $str) { $k=strtok($str, " "); $v=strtok(""); if ($k) $nsv[$k]=$v; } if ($GLOBALS["add_nsv"]) foreach ($GLOBALS["add_nsv"] as $key=>$val) $nsv[$key]=$val; if ($include_cgi_vars && ($rq_hdrs=$GLOBALS["htreq_headers"])) foreach($rq_hdrs as $key=>$val) $nsv["HTTP_".str_replace("-", "_", $key)]=$val; return $nsv; } function nw_url_addslash($s) { $ret = strtok($s, "?")."/"; if (($q = strtok("")) !== false) $ret .= "?".$q; return $ret; } function techo($s, $level=NW_EL_NOTICE, $flush=false) { global $conf; static $srv_buf; $tl=date("Ymd:His")." $s\n"; if (!$conf["_complete"] && !$flush) { $srv_buf[]=array($tl, $level); } else { if (($conf["global"]["servermode"][0]!="inetd") && !$GLOBALS["quiet"]) { if ($srv_buf) foreach ($srv_buf as $sb_arr) echo $sb_arr[0]; echo $tl; flush(); } if ($srv_buf) { foreach ($srv_buf as $sb_arr) log_srv($sb_arr[0], $sb_arr[1]); $srv_buf=array(); } log_srv($tl, $level); } } function errexit($s, $errno=-1) { global $pidfile, $start_daemon; $estr="FATAL: ".$s; techo($estr, NW_EL_ERROR, true); if ($pidfile) unlink($pidfile); if ($start_daemon && ($stderr=@fopen("php://stderr", "w"))) { fputs($stderr, $estr."\n"); fclose($stderr); } exit($errno); } function url_to_absolute($url) { return("http://".$GLOBALS["conf"][$GLOBALS["vhost"]]["servername"][0].(($GLOBALS["lport"]!=80)?(":".$GLOBALS["lport"]):"").($url!="/"?"/":"").$url); } function loadfile($filename, $extension, &$rq_err, &$cgi_headers, $force_parser=false) { global $conf, $modules, $add_nsv; if (is_link($filename)) $filename=readlink($filename); chdir(dirname(nw_realpath($filename))); $filename=basename($filename); if (($parser=$force_parser) || ($parser=trim(access_query("_parseext", "_".strtolower($extension))))) { // Parsed content if (strpos($parser, " ")!==false) { $ps_type=strtok($parser, " "); $ps_arg=strtok(""); if (strpos($ps_arg, '$')!==false) foreach (nw_server_vars() as $nkey=>$nval) $ps_arg=str_replace('$'.$nkey, $nval, $ps_arg); if (!$force_parser) { $add_nsv["REDIRECT_STATUS"]=$rq_err; $add_nsv["REDIRECT_URL"]="/".$GLOBALS["real_uri"]; } } else $ps_type=$parser; } else { // Static content $ps_type=$conf["global"]["defaulthandler"][0]; } if ($ps=$modules["parser_".$ps_type][0]) { if (is_object($rop=$ps->parser_open($ps_arg, $filename, $rq_err, $cgi_headers))) $ps=$rop; } else { $rq_err=500; $GLOBALS["add_errmsg"]="Unable to find an appropriate parser for this content type.

    "; $ps=$GLOBALS["null_response"]; } return($ps); } function nw_host_to_vhost($host, $lport=80) { global $conf; // Try vhost=host:port if (is_array($conf[$phost=($host.":".$lport)])) return($phost); // Try vhost=host if (is_array($conf[$host])) return($host); // Try wildcards $hlen=strlen($host); for($vhlen=0;$vhlen<=$hlen;$vhlen++) { $whost="*".substr($host, $vhlen); if (is_array($conf[$phost=($whost.":".$lport)])) return($phost); if (is_array($conf[$whost])) return($whost); } // Or set to global return("global"); } function nw_error_page($rq_err) { global $HTTP_HEADERS, $http_resource, $conf, $vhost, $add_errmsg; $err["error_code"]=$rq_err; $err["error_label"]=$HTTP_HEADERS[$rq_err]; $err["error_add_message"]=$add_errmsg; $add_errmsg = ""; $err["error_resource"]=($http_resource?(nw_apply_template(NW_TMPL_ERROR_RESOURCE, array("resource_name" => htmlentities($http_resource)), true)):""); if ($conf[$vhost]["serveradmin"][0]) $err["error_admin"]=nw_apply_template(NW_TMPL_ERROR_ADMIN, array("admin" => $conf[$vhost]["serveradmin"][0]), true); $err_page=nw_apply_template(NW_TMPL_ERROR_PAGE, $err) or $err_page="".$HTTP_HEADERS[$rq_err]."

    ".$HTTP_HEADERS[$rq_err]."

    "; return($err_page); } function nw_use_chunked_encoding() { if (!isset($GLOBALS["lf"]->content_length) && $GLOBALS["keepalive"]) { if ($GLOBALS["http_version"]>="1.1") { return(true); } else { return("CLOSE"); } } else return(false); } function nw_decode_mq_hdr($s) { if ($l=explode(",", $s)) foreach ($l as $e) { list($v, $q)=explode(";", $e); if ($q) list($d, $qn)=explode("=", $q); if (!$qn) $qn=1; if ($v) $r[$v]=$qn; } arsort($r); return($r); } function nw_allow_list($ext) { $tmp_marr=array(); foreach ($GLOBALS["modules"] as $tmpmod) if (method_exists($tmpmod, "options")) if ($mod_methods=$tmpmod->options()) foreach ($mod_methods as $mod_method) if (!isset($tmp_marr[$mod_method])) $tmp_marr[$mod_method]=$mod_method; return ("GET, ".(access_query("_parseext", "_".strtolower($rq_file["extension"]))?"POST, ":"")."HEAD, OPTIONS".(count($tmp_marr)?", ":"").implode(", ", $tmp_marr)); } function build_response_headers() { global $HTTP_HEADERS, $rq_err, $out_contenttype, $out_add_headers, $conf, $lf; if ($out_add_headers) { foreach ($out_add_headers as $key=>$val) switch (strtoupper($key)) { case "CONTENT-TYPE": $out_contenttype=$val; break; case "LOCATION": $rq_err=302; $add_headers.=$key.": ".$val."\r\n"; break; case "COOKIES": foreach ($val as $cval) $add_headers.="Set-Cookie: ".$cval."\r\n"; break; case "STATUS": $st=(int)strtok($val, " "); if ($stx=trim(strtok(""))) { $http_resp=$st." ".$stx; } else if ($stx=$HTTP_HEADERS[$st]) { $http_resp=$stx; } else { $http_resp=$st; } $rq_err=$st; break; default: $add_headers.=$key.": ".$val."\r\n"; } } $clf=($GLOBALS["http_action"]=="HEAD"?$GLOBALS["hlf"]:$lf); $out_headers=HTTP_VERSION." ".($http_resp?trim($http_resp):$HTTP_HEADERS[$rq_err])."\r\n"; $out_headers.="Date: ".gmdate("D, d M Y H:i:s T")."\r\n"; if ($ss=nw_server_string()) $out_headers.="Server: ".$ss."\r\n"; $out_headers.="Content-Type: ".$out_contenttype."\r\n"; if ($ahlist=access_query("addheader")) foreach ($ahlist as $val) $out_headers.=trim($val)."\r\n"; if (($rq_err>=400) && ($eh=access_query("_errorheader", "_".$rq_err))) $out_headers.=$eh."\r\n"; $out_headers.=$add_headers; if ($GLOBALS["keepalive"]) { $out_headers.="Connection: Keep-Alive\r\n"; $out_headers.="Keep-Alive: timeout=".(int)$conf["global"]["requesttimeout"][0].", max=".(int)($conf["global"]["keepalive"][0])."\r\n"; } else { $out_headers.="Connection: close\r\n"; } if ($GLOBALS["chunked"]) { $out_headers.="Transfer-Encoding: chunked\r\n"; } else { if (is_int($clf->content_length)) $out_headers.="Content-Length: ".$clf->content_length."\r\n"; } return($out_headers); } function nanoweb_init($conffile) { global $conf, $themes, $cmdline_conf_overrides, $cmdline_conf_adds, $modules, $posix_av, $pcntl_av, $gz_av, $mime, $access_policy, $sysusr, $sysgrp, $icnt, $banned_ips, $srvlog_levels; $dc=get_defined_constants(); foreach ($dc as $cname=>$cval) if (substr($cname, 0, 6)=="NW_EL_") $srvlog_levels[strtolower(substr($cname, 6))]=$cval; $iconf=parseconfig(file($conffile)); if (is_string($iconf)) { if ($icnt) { techo($iconf, NW_EL_WARNING); return(false); } else { errexit($iconf); } } else if (is_array($iconf)) { $conf=$iconf; } $conf=cmdline_conf_upd($conf, $cmdline_conf_overrides, $cmdline_conf_adds); $modules=load_modules($conf); modules_init(); $themes=load_themes($conf); ++$icnt; $ap_aliases=array( "parseext" => "_parseext", "alias" => "_aliases", "errordocument" => "_errordocument", "errorheader" => "_errorheader" ); $access_policy=array(); foreach ($conf["global"]["accessoverride"] as $ov_dir) if ($ov_dir) $access_policy[strtolower($ov_dir)]="override"; foreach ($conf["global"]["accessmerge"] as $mg_dir) if ($mg_dir) $access_policy[strtolower($mg_dir)]="merge"; foreach ($conf["global"]["accessblock"] as $bl_dir) if ($bl_dir) $access_policy[strtolower($bl_dir)]="block"; foreach ($ap_aliases as $rk=>$ak) if ($access_policy[$rk]) $access_policy[$ak]=$access_policy[$rk]; $posix_av=is_callable("posix_setuid"); $pcntl_av=is_callable("pcntl_fork"); $gz_av=is_callable("gzencode"); if (count($themes)==0) techo("WARN: No theme loaded, server generated content is disabled", NW_EL_WARNING); if ($posix_av) foreach ($conf as $vconf) { if ($u=$vconf["user"][0]) $sysusr[$u]=@posix_getpwnam($u); if ($g=$vconf["group"][0]) $sysgrp[$g]=@posix_getgrnam($g); } if ((!$conf["global"]["singleprocessmode"][0]) && (!$posix_av || !$pcntl_av || ($conf["global"]["servermode"][0]=="inetd"))) { techo("WARN: forcing single process mode", NW_EL_WARNING); $conf["global"]["singleprocessmode"][0]=true; } if ($conf["global"]["servermode"][0]=="inetd") { unset($conf["global"]["logtoconsole"]); unset($conf["global"]["pidfile"]); } if ($conf["global"]["singleprocessmode"][0]) { $conf["global"]["loggerprocess"]=0; if ($conf["global"]["keepalive"][0]) techo("WARN: KeepAlive should be set to 0 in single process mode", NW_EL_WARNING); } if ($pcntl_av) { pcntl_signal(SIGTERM, "nanoweb_shutdown"); pcntl_signal(SIGHUP, "nanoweb_reload"); } $mime=array(); if (!@is_readable($conf["global"]["mimetypes"][0])) { techo("WARN: unable to read mime types file (".$conf["global"]["mimetypes"][0]."), using internals", NW_EL_WARNING); $mime=array( "html" => "text/html", "xml" => "text/xml", "gif" => "image/gif", "jpeg" => "image/jpeg", "png" => "image/png", "tgz" => "application/gtar"); } else if ($mimetypes=@file($conf["global"]["mimetypes"][0])) { foreach ($mimetypes as $s) if (trim($s) && ($s{0}!="#")) if (ereg("([a-zA-Z0-9/.-]+)[ \t]+([a-zA-Z0-9 -]+)", $s, $res)) if ($exts=explode(" ", trim($res[2]))) foreach ($exts as $ext) if (trim($res[1]) && trim($ext)) $mime[$ext]=trim($res[1]); unset($mimetypes); } if ($at=$conf["global"]["addtype"]) foreach ($at as $adt) { $mt=strtok(trim($adt), " "); while ($s=strtok(" ")) $mime[ltrim($s, ".")]=$mt; } $conf["_complete"]=true; $banned_ips=array(); if (is_array($conf["global"]["blockipaddr"])) foreach ($conf["global"]["blockipaddr"] as $ip) nw_block_ip_address($ip, "PERM", "config.BlockIPAddr"); return(true); } function nanoweb_shutdown($sig_no=SIGTERM) { global $lsocks, $pidfile, $loggers_sck, $conf, $pmode; if ($pmode=="master") { modules_init("shutdown"); if ($lsocks) foreach ($lsocks as $sock) socket_close($sock); if ($nb_loggers=$conf["global"]["loggerprocess"][0]) { techo("halting loggers"); for ($a=0;$a<$nb_loggers;$a++) { $pkt="TERM"; socket_write($loggers_sck, $pkt); usleep(100000); } sleep(1); } if ($pidfile) unlink($pidfile); techo("daemon stopped\n"); } exit(0); } function nanoweb_reload($sig_no=SIGHUP) { global $mypid, $conffile, $conf, $loggers_sck, $logger_pids, $killed_loggers, $access_cache, $rp_cache; if (!$mypid) { techo("received SIGHUP, reloading configuration ..."); clearstatcache(); unset($access_cache); unset($rp_cache); if (nanoweb_init($conffile)) { if ($nb_loggers=$conf["global"]["loggerprocess"][0]) { techo("restarting loggers"); foreach ($logger_pids as $lid) { $pkt="TERM"; socket_write($loggers_sck, $pkt); usleep(100000); $killed_loggers[] = $lid; } sleep(1); } techo("configuration reloaded from ".$conffile); } else { techo("configuration was not reloaded", NW_EL_WARNING); } } } function read_request(&$sck_connected, &$dp, &$pn, $maxlen=0) { global $conf; static $rr_buffer; $wstart=time(); if ($rr_buffer!=="") { $buf=$rr_buffer; $tnreq=true; } while (!$rq_finished && $sck_connected) { if (!$tnreq) { $fdset=$GLOBALS["pfdset"]; if ($conf["global"]["servermode"][0]=="inetd") { // Inetd if (feof($GLOBALS["inetd_in"])) { $tmp=false; $sck_connected=false; } else $tmp=fgetc($GLOBALS["inetd_in"]); } else { if ($ns=socket_select($fdset, $write=NULL, $fdset, SCK_READ_SELECT_TIMEOUT)) $tmp=@socket_read($GLOBALS["msgsock"], SCK_READ_PACKET_SIZE); else $tmp=false; } } if ($tmp || $tmp==="0" || $tnreq) { $tnreq=false; $wstart=time(); $buf.=$tmp; $pn=0; if (!$maxlen) { if (!$rnloop) { $buf=ltrim($buf); $rnloop=true; } if (($dp=strpos($buf, "\r\n\r\n"))!==false) $pn=4; else if (($dp=strpos($buf, "\n\n"))!==false) $pn=2; if ($pn) $rq_finished=true; } else { if (strlen($buf)>=$maxlen) $rq_finished=true; } } else if (($ns) || ((!$ns) && ((time()-$wstart)>=$conf["global"]["requesttimeout"][0]))) $sck_connected=false; } if (!$maxlen) { $tbuf=substr($buf, 0, $dp+$pn); $rr_buffer=substr($buf, $dp+$pn); $buf=$tbuf; } else { $tbuf=substr($buf, 0, $maxlen); $rr_buffer=substr($buf, $maxlen); $buf=$tbuf; } return($buf); } function send_response($response, &$sck_connected) { global $msgsock; $resp_len=strlen($response); while($sent_len<$resp_len && $sck_connected) { if ($GLOBALS["conf"]["global"]["servermode"][0]=="inetd") { // Inetd echo $response; $sent_len=strlen($response); } else { $fdset=$GLOBALS["pfdset"]; if (($sent_len+SCK_WRITE_PACKET_SIZE)>$resp_len) $size=$resp_len-$sent_len; else $size=SCK_WRITE_PACKET_SIZE; if (($ret=@socket_write($msgsock, substr($response, $sent_len, $size), $size))>0) $sent_len+=$ret; if ($ret===false) { if (socket_last_error($msgsock)==SOCKET_EWOULDBLOCK) { socket_clear_error($msgsock); if (!socket_select($read=NULL, $fdset, $except=NULL, SCK_MAX_STALL_TIME)) $sck_connected=false; } else { $sck_connected=false; } } } } return($sent_len); } function int_sendtomaster($msg_type, $args=false) { if ((!$GLOBALS["conf"]["global"]["singleprocessmode"][0]) && ($GLOBALS["pmode"]!="master")) { $msg=$msg_type; if ($args!==false) $msg.=serialize($args); $ret=socket_write($GLOBALS["master_sck"], $msg); if ($ret!=strlen($msg)) { techo("WARN: master process is not responding", NW_EL_WARNING); } } } function _server_report_state($s, $remote_host="") { $tmp=array($GLOBALS["mypid"], $s); if ($remote_host) $tmp[]=$remote_host; int_sendtomaster(NM_SERVER_STATE, $tmp); } function nw_block_ip_address($ip_addr, $type, $source, $expires=0) { global $conf, $pmode, $banned_ips; if ((($conf["global"]["singleprocessmode"][0]) || ($pmode=="master")) && (!$banned_ips[$ip_addr])) { $banned_ips[$ip_addr]=array("type" => $type, "source" => $source, "expires" => $expires); techo($source." : blocked IP address ".$ip_addr." (".strtolower($type).")", NW_EL_BLOCKING); } else { int_sendtomaster(NM_BLOCK_IP, array($ip_addr, $type, $source, $expires)); } } function nw_unblock_ip_address($ip_addr, $msg=false) { global $conf, $pmode, $banned_ips; if ((($conf["global"]["singleprocessmode"][0]) || ($pmode=="master")) && ($banned_ips[$ip_addr])) { $source=strtok($banned_ips[$ip_addr]["source"], "."); $rejs=$banned_ips[$ip_addr]["rejects"]; unset($banned_ips[$ip_addr]); techo($source." : unblocked IP address ".$ip_addr." (".(int)$rejs." rejs".($msg===false?"":(", ".$msg)).")", NW_EL_BLOCKING); } else { int_sendtomaster(NM_UNBLOCK_IP, $ip_addr); } } function logger_run($logger_id) { global $conf, $children_logsck, $modules, $plgset, $pmode; $pmode="logger"; pcntl_signal(SIGTERM, SIG_DFL); pcntl_signal(SIGHUP, SIG_IGN); $mypid=posix_getpid(); $lids=log_ids(); posix_setgid($lids["gid"]); posix_setuid($lids["uid"]); techo("logger process #".$logger_id." is running (pid=".$mypid.")"); while (!$logger_exit) { $r=socket_read($children_logsck, INT_MSGSIZE); switch($r) { case "TERM": $logger_exit=true; break; default: $l=unserialize($r); // Reverse DNS query if the server hasn't done it before if (($conf["global"]["hostnamelookups"][0]) && ($conf["global"]["hostnamelookupsby"][0]=="logger") && ($rhost=nw_gethostbyaddr($l[2]))) $l[1]=$rhost; // And call the logging modules if ($nb_log_mods=count($modules["log"])) for ($a=0;$a<$nb_log_mods;$a++) $modules["log"][$a]->log_hit($l[0], $l[1], $l[2], $l[3], $l[4], $l[5], $l[6], $l[7], $l[8]); break; } } techo("logger process #".$logger_id." stopped"); exit(0); } function spawn_loggers($nb_loggers) { global $logger_pids; static $logger_id; for ($a=0;$a<$nb_loggers;++$a) { $pid=pcntl_fork(); ++$logger_id; if ($pid===0) { logger_run($logger_id); } else { $logger_pids[$pid]=$logger_id; if ($nb_loggers>1) usleep(100000); } } } // Begin set_time_limit(0); $pmode="master"; techo("aEGiS nanoweb/".VERSION." (C) 2002-2005 by sIX / aEGiS"); $stats_start=time(); if (version_compare(phpversion(), REQUIRED_PHP_VERSION)<0) errexit("nanoweb needs PHP >= ".REQUIRED_PHP_VERSION." (you are using ".phpversion().")"); if (version_compare(phpversion(), "4.3.0")>=0) $sckv3=true; $os=((strpos(strtolower(PHP_OS), "win")===0) || (strpos(strtolower(PHP_OS), "cygwin")!==false))?"win32":"unix"; switch ($os) { case "win32": define("NW_BSAFE_READ_OPEN", "rb"); define("NW_BSAFE_WRITE_OPEN", "wb"); define("NW_BSAFE_APP_OPEN", "ab"); if (!defined("SOCKET_EWOULDBLOCK")) define("SOCKET_EWOULDBLOCK", 10035); break; default: define("NW_BSAFE_READ_OPEN", "r"); define("NW_BSAFE_WRITE_OPEN", "w"); define("NW_BSAFE_APP_OPEN", "a"); if (!defined("SOCKET_EWOULDBLOCK")) define("SOCKET_EWOULDBLOCK", 11); break; } foreach ($TEST_FUNCS as $f_name=>$f_mandatory) if (!is_callable($f_name)) { if ($f_mandatory) errexit("function '".$f_name."' not available, aborting"); else techo("WARN: function '".$f_name."' not available", NW_EL_WARNING); } // Parse command line if ($_SERVER["argc"]>1) for($a=1;$a<$_SERVER["argc"];$a++) { if (($a==1) && (substr($_SERVER["argv"][$a], 0, 1)!="-")) { $cmdline_cf=$_SERVER["argv"][1]; } else { $ca=explode("=", $_SERVER["argv"][$a]); $ck=array_shift($ca); $cv=implode("=", $ca); switch($ck) { case "-?": case "-h": case "--help": die($cmdline_help); break; case "-v": case "--version": die(VERSION."\n"); break; case "-c": case "--config": $cmdline_cf=$cv; break; case "-o": case "--set-option": $cmdline_conf_overrides[]=$cv; break; case "-a": case "--add-option": $cmdline_conf_adds[]=$cv; break; case "-d": case "--start-daemon": $start_daemon=true; break; case "-q": case "--quiet": $quiet=true; break; case "--debug": $nw_debug=true; case "--verbose": break; case "--config-test": case "-t": $config_test=true; break; default: errexit("unknown argument : ".$_SERVER["argv"][$a].", try --help"); break; } } } if ($cmdline_cf) $conffile=$cmdline_cf; else $conffile=DEFAULT_CONFIG_FILE; if (!is_readable($conffile)) errexit("unable to read configuration (".$conffile."), aborting"); unset($cmdline_help); nanoweb_init($conffile); if ($config_test) { techo("configuration test successful"); exit(0); } if ($conf["global"]["servermode"][0]!="inetd") { // Create socket(s) and start listening if ($sckv3) { $setsockopt="socket_set_option"; $getsockopt="socket_get_option"; } else { $setsockopt="socket_setopt"; $getsockopt="socket_getopt"; } foreach ($conf["global"]["listenport"] as $lport) { $lport=(int)$lport; if (($sock = @socket_create(AF_INET, SOCK_STREAM, 0))<0) errexit("socket create failed : ".socket_strerror(socket_last_error())); if (is_callable($setsockopt) && is_callable($getsockopt)) { $setsockopt($sock, SOL_SOCKET, SO_REUSEADDR, 1); $sbuf=$getsockopt($sock, SOL_SOCKET, SO_SNDBUF); $rbuf=$getsockopt($sock, SOL_SOCKET, SO_RCVBUF); if ($sbuf<(SCK_WRITE_PACKET_SIZE*32)) $setsockopt($sock, SOL_SOCKET, SO_SNDBUF, SCK_WRITE_PACKET_SIZE*32); if ($rbuf<(SCK_READ_PACKET_SIZE*32)) $setsockopt($sock, SOL_SOCKET, SO_RCVBUF, SCK_READ_PACKET_SIZE*32); } if (!@socket_bind($sock, $conf["global"]["listeninterface"][0], $lport)) errexit("socket bind failed on port ".$lport." : ".socket_strerror(socket_last_error($sock))); if (!@socket_listen($sock, $conf["global"]["listenqueue"][0])) errexit("socket listen failed on port ".$lport." : ".socket_strerror(socket_last_error($sock))); socket_set_nonblock($sock); $lsocks[$lport]=$sock; $lports[$sock]=$lport; } } if ($pcntl_av) { $sck_pair=array(); socket_create_pair(AF_UNIX, SOCK_DGRAM, 0, $sck_pair); $children_sck=&$sck_pair[0]; $master_sck=&$sck_pair[1]; socket_set_nonblock($children_sck); socket_set_nonblock($master_sck); } $plnset=array($children_sck); foreach ($lsocks as $sck) $plnset[]=$sck; if ($conf["global"]["servermode"][0]!="inetd") { techo("listening on port".(count($lports)>1?"s":"")." ".implode(", ", $lports)); $stdfd = fopen("php://stdin", "r"); fclose($stdfd); $stdfd = fopen(($os == "unix") ? "/dev/null" : "NUL", "r"); } else { $inetd_in=fopen("php://stdin", NW_BSAFE_READ_OPEN); set_file_buffer($inetd_in, 0); techo("running in inetd mode"); } $def_cnx=($conf["global"]["servermode"][0]=="inetd"); if ($start_daemon) { if (!$posix_av || !$pcntl_av) errexit("posix and pcntl PHP extensions are needed for --start-daemon"); $npid = pcntl_fork(); if ($npid == -1) { errexit("unable to pcntl_fork()"); } else if ($npid) { exit(0); } posix_setsid(); usleep(100000); $npid = pcntl_fork(); if ($npid == -1) { errexit("unable to pcntl_fork()"); } else if ($npid) { techo("running in background"); exit(0); } } if ($nb_loggers=$conf["global"]["loggerprocess"][0]) { // Prepare and spawn logger processes if specified techo("spawning loggers"); $sck_pair=array(); socket_create_pair(AF_UNIX, SOCK_DGRAM, 0, $sck_pair); $children_logsck=&$sck_pair[0]; $loggers_sck=&$sck_pair[1]; socket_set_nonblock($loggers_sck); spawn_loggers($nb_loggers); } else { // Be sure not to ask anything to loggers $conf["global"]["hostnamelookupsby"][0]="server"; } if ($posix_av && $conf["global"]["pidfile"][0]) { $pidfile=$conf["global"]["pidfile"][0]; if ($f=fopen($pidfile, "w")) { fputs($f, (string)posix_getpid()."\n"); fclose($f); } else { techo("WARN: unable to open pid file '".$pidfile."'", NW_EL_WARNING); unset($pidfile); } } if (empty($nw_debug)) error_reporting(E_PARSE | E_ERROR); if ($conf["global"]["servermode"][0]!="inetd") techo("ready and accepting connections"); while (true) { $cnx=$def_cnx; while (!$cnx) { declare (ticks = 1) { // Allow to catch signals here $lnset=$plnset; } $ns=socket_select($lnset, $write=NULL, $except=NULL, 1); if ($ns) foreach ($lnset as $lnact) { if ($lnact==$children_sck) { while ($msg=socket_read($children_sck, INT_MSGSIZE)) { // Message from a child process $mtype=substr($msg, 0, 5); if (strlen($msg)>5) $mcontent=unserialize(substr($msg, 5)); switch ($mtype) { case NM_HIT: // content : 0 => pid, 1 => request status, 2 => length, 3 => vhost if (is_array($mcontent)) { ++$stats_resperr[$mcontent[1]]; ++$stats_vhosts[$conf[$mcontent[3]]["servername"][0]]; ++$stats_hits; $stats_xfer+=(float)$mcontent[2]; if ($scoreboard[$spid=$mcontent[0]]) { $scoreboard[$spid][NW_SB_STATUS]="(waiting for request)"; } } break; case NM_RESTART_LOGGERS: techo("respawning loggers"); spawn_loggers($conf["global"]["loggerprocess"][0]); break; case NM_RELOAD_THEME: // content : theme id clearstatcache(); if ((is_array($themes[$mcontent])) && ($themes[$mcontent]["_mtime"]!=filemtime($fname=$themes[$mcontent]["_fname"]))) { $tmp_thm=load_theme($fname, true, true); $themes[$mcontent]=$tmp_thm; $themes[$fname]=$tmp_thm; $themes[$tmp_thm["_fname"]]=$tmp_thm; } break; case NM_SERVER_STATE: // content : 0 => pid, 1 => status text, 2 => remote host if ($scoreboard[$spid=$mcontent[0]]) { $scoreboard[$spid][NW_SB_STATUS]=$mcontent[1]; if ($mcontent[2]) $scoreboard[$spid][NW_SB_PEERHOST]=$mcontent[2]; } break; case NM_BLOCK_IP: // content : 0 => ip address, 1 => type (PERM|TEMP), 2 => source, 3 => expiration if (is_array($mcontent)) nw_block_ip_address($mcontent[0], $mcontent[1], $mcontent[2], $mcontent[3]); break; case NM_UNBLOCK_IP: // content : ip address if ($mcontent) nw_unblock_ip_address($mcontent); break; } } } else { $sock=$lnact; $lport=$lports[$sock]; if ((($active_servers<$conf["global"]["maxservers"][0]) || (!$conf["global"]["maxservers"][0])) && (is_resource($msgsock=@socket_accept($sock)))) { // We do have a connection $remote_ip=$remote_port=0; socket_getpeername($msgsock, $remote_ip, $remote_port); if (is_array($banned_ips[$remote_ip])) { // Disconnect if IP address is banned techo("rejected connection #".(++$banned_ips[$remote_ip]["rejects"])." from blocked IP address ".$remote_ip, NW_EL_BLOCKING); socket_close($msgsock); ++$stats_rej; } else if ($remote_ip) { // Or handle the new connection $cnx=true; ++$stats_cnx; } else { // Cannot obtain peer IP address, something is wrong (but not worth throwing a notice) socket_close($msgsock); } } } } if (!$conf["global"]["singleprocessmode"][0]) while (($deadpid=pcntl_waitpid(-1, $cstat, WNOHANG)) && ($deadpid!=-1)) { // Dead child if (($dead_logger=$logger_pids[$deadpid]) && ($conf["global"]["loggerprocess"][0])) { // Dead logger (this is abnormal, we have to restart one) if (in_array($dead_logger, $killed_loggers)) { unset($killed_loggers[array_search($dead_logger, $killed_loggers)]); } else { techo("logger process #".$dead_logger." died (pid=".$deadpid."), respawning", NW_EL_WARNING); } unset($logger_pids[$deadpid]); spawn_loggers(1); } else { // Dead child server, clear servers table unset($scoreboard[$deadpid]); --$active_servers; } } $ct=time(); foreach ($banned_ips as $ip_addr=>$bip) if (($bip["type"]=="TEMP") && ($bip["expires"]<=$ct)) nw_unblock_ip_address($ip_addr, "expired"); } if ($conf["global"]["singleprocessmode"][0]) { $pid=0; // Invalidate access and rp caches every SPM_CACHES_LIFETIME connections if (($stats_cnx%SPM_CACHES_LIFETIME)==0) { clearstatcache(); unset($access_cache); unset($rp_cache); } } else { $pid=pcntl_fork(); if ($pid===0) $pmode="server"; } if ($pid===0) { if ($posix_av) $mypid=posix_getpid(); if (!$conf["global"]["singleprocessmode"][0]) { foreach ($lsocks as $sock) socket_close($sock); set_time_limit($conf["global"]["childlifetime"][0]); } if ($conf["global"]["servermode"][0]!="inetd") { socket_set_nonblock($msgsock); $pfdset=array($msgsock); if (($conf["global"]["hostnamelookups"][0]) && ($conf["global"]["hostnamelookupsby"][0]!="logger") && ($rhost=nw_gethostbyaddr($remote_ip))) { $remote_host=$rhost; _server_report_state("(connected)", $remote_host); } else { $remote_host=$remote_ip; } } else { $remote_ip=getenv("INETD_REMOTE_IP"); $remote_port=getenv("INETD_REMOTE_PORT"); } $rq_count=0; while ($cnx) { $sck_connected=true; $http_continue=false; $http_rq_block=$buf=read_request($sck_connected, $dp, $pn); $pri_redir=$http_uri=$out_headers=""; $pri_err=$pri_redir_code=$rq_err=0; $add_nsv=$htreq_headers=$out_add_headers=array(); if ($sck_connected) { if (strlen($buf)!=$dp+4) $add_req=substr($buf, $dp+4); else $add_req=""; $tmp_arr=explode("\n", substr($buf, 0, $dp)); $l=false; foreach ($tmp_arr as $s) { $s=trim($s); if (!$l) { $http_action=strtok($s, " "); $http_resource=strtok(" "); $http_protocol=strtoupper(strtok("/")); $http_version=strtok(""); $l=true; if ($http_protocol!="HTTP") { // Invalid protocol $pri_err=400; $add_errmsg="Unable to serve requested protocol.

    "; } } else { if (strpos($s, ":")===false) { // Invalid request header $pri_err=400; $add_errmsg="Invalid request header received.

    "; } else { $hd_key=strtoupper(strtok($s, ":")); $hd_val=trim(strtok("")); if (isset($htreq_headers[$hd_key])) { $pri_err=400; $add_errmsg="Duplicate request header '{$hd_key}'

    "; } else { $htreq_headers[$hd_key]=$hd_val; } } } } // Decode Host header $host=strtok(trim(strtolower($htreq_headers["HOST"])), ":"); $vhost=nw_host_to_vhost($host, $lport); if ($auth_hdr=$htreq_headers["AUTHORIZATION"]) { // Decode HTTP Authentication header $dtmp=explode(" ", $auth_hdr); $auth_type=$dtmp[0]; $auth_lp=explode(":", base64_decode($dtmp[1])); $auth_user=$auth_lp[0]; $auth_pass=$auth_lp[1]; } else $auth_type=$auth_user=$auth_pass=""; // Decode Keep-Alive header $keepalive=(strtolower(trim($htreq_headers["CONNECTION"]))=="keep-alive" && (int)$conf["global"]["keepalive"][0]>1); if ($keepalive && (++$rq_count>=(int)$conf["global"]["keepalive"][0])) $keepalive=false; $cnx=$keepalive; // Set Uid and Gid $cfgid=$conf[$vhost]["group"][0]; $cfuid=$conf[$vhost]["user"][0]; if ($posix_av) { $ugtok=$sysusr[$cfuid]["uid"].$sysgrp[$cfgid]["gid"]; if ($uid_set) { if ($uid_set!=$ugtok) { // Keep-alive request for another user/group vhost, this is bad $pri_err=400; } } else { if ($setgid=$sysgrp[$cfgid]["gid"]) posix_setgid($setgid); if ($setuid=$sysusr[$cfuid]["uid"]) posix_setuid($setuid); $uid_set=$ugtok; } } $docroot=$conf[$vhost]["documentroot"][0]; $docroot_prefix=""; if ($exp_hdr=$htreq_headers["EXPECT"]) { // Enforce HTTP Expect header if (trim(strtolower($exp_hdr))=="100-continue") { $http_continue=true; } else { $pri_err=417; } } if ($p1=$http_resource) { $p1=explode("?", $p1); $real_uri=ltrim($http_uri=rawurldecode($p1[0]), "/"); $http_uri=str_replace(chr(0), "", $http_uri); $query_string=$p1[1]; $hu=$docroot.$real_uri; // Load access files if needed unset($access); if (is_dir($hu)) { $uridir=substr($http_uri, 1); } else if (is_dir($docroot.($uridn=dirname($http_uri)))) { $uridir=substr($uridn, 1); } else $uridir=""; if (($accessdir=nw_realpath($docroot.$uridir)) && ($conf["global"]["accessfile"][0])) load_access_files($accessdir, $access); core_modules_hook("before_decode"); foreach (access_query("_aliases") as $key=>$val) if (strpos(rtrim($http_uri, "/"), rtrim($key, "/"))===0) { // Alias $docroot=$val.((substr($val, -1)==DIRECTORY_SEPARATOR)?"":DIRECTORY_SEPARATOR); $docroot_prefix=trim($key, "/")."/"; $http_uri=str_replace($key, "", $http_uri); if ((is_dir($docroot.$http_uri)) && (substr($docroot.$http_uri, -1)!="/")) $pri_redir=nw_url_addslash($http_resource); break; } $http_uri=ltrim($http_uri, "/"); if ($http_uri{0}=="~") { // User directory if (($udadd=$conf[$vhost]["userdir"][0]) && ($posix_av)) { $upos=strpos($http_uri, "/"); $udname=substr($http_uri, 1, (($upos===false)?(strlen($http_uri)):($upos-1))); $udres=(($upos===false)?"":(substr($http_uri, $upos+1))); if ($udinf=@posix_getpwnam($udname)) { $tmpdr=$udinf["dir"].DIRECTORY_SEPARATOR.$udadd.DIRECTORY_SEPARATOR; if (is_dir($tmpdr)) { if ((is_dir($tmpdr.$udres)) && (substr($http_uri, -1)!="/")) { $pri_redir=nw_url_addslash($http_resource); } else { $docroot=$tmpdr; $docroot_prefix="~".$udname."/"; $http_uri=$udres; } } else { // User exists but does not have a public html directory $pri_err=404; } } else { // User does not exists $pri_err=404; } } } if (is_dir($docroot.$http_uri) && !$pri_redir) { if ($http_uri && substr($http_uri, -1)!="/") { $pri_redir=nw_url_addslash($http_resource); } else if ($dilist=access_query("directoryindex", 0)) { $dis=explode(" ", $dilist); foreach ($dis as $diname) { switch ($diname{0}) { case DIRECTORY_SEPARATOR: if (@is_readable($diname)) { $docroot=dirname($diname).DIREECTORY_SEPARATOR; $http_uri=basename($diname); break; } break; default: if (@is_readable($docroot.$http_uri.$diname)) { $http_uri.=$diname; break; } } } } } $path_info=""; if (access_query("allowpathinfo", 0) && !file_exists($docroot.$http_uri)) { // Try path_info $new_uri=$http_uri; while (!@is_file($docroot.$new_uri) && $new_uri) { $new_uri=substr($new_uri, 0, strrpos($new_uri, "/")); if (!@is_file($docroot.$new_uri) && $pie_arr=access_query("pathinfotryext")) foreach ($pie_arr as $pie_ext) if (@is_file($docroot.$new_uri.".".$pie_ext)) { $new_uri.=".".$pie_ext; break; } } if ($new_uri) { // Path_info found $path_info=substr($http_uri, strlen($new_uri)); $http_uri=$new_uri; } } $rq_file=pathinfo($http_uri); } $hbn=basename($http_uri); unset($bad_rq); // File access security tests if (nw_realpath($docroot.$http_uri) && (strpos(nw_realpath($docroot.$http_uri), nw_realpath($docroot))===false)) { $bad_rq=NW_BAD_OUTSIDE_DOCROOT; } if (($conf[$vhost]["ignoredotfiles"][0]) && ($hbn{0}==".") && ($hbn!="..") && ($hbn!=".")) { $bad_rq=NW_BAD_DOT_FILE; } if (($os == "win32") && in_array(strtolower(strtok($hbn, ".")), $win_devices)) { $bad_rq=NW_BAD_WIN_DEVICE; } if (($bad_rq==NW_BAD_OUTSIDE_DOCROOT) && ($als_arr=$conf[$vhost]["allowsymlinkto"])) { // Test for outside-docroot access exemptions (AllowSymlinkTo) $tdir=$http_uri; while ($tdir) { if ((is_link($docroot.$tdir)) && (strpos(nw_realpath(dirname($docroot.$tdir)), nw_realpath($docroot))===0)) foreach ($als_arr as $als) if (strpos(nw_realpath($docroot.$http_uri), nw_realpath($als))===0) { unset($bad_rq); break 2; } $tdir=substr($tdir, 0, strrpos($tdir, "/")); } } if ($bad_rq) switch ($bad_rq) { case NW_BAD_OUTSIDE_DOCROOT: techo("NOTICE: discarded request outside of document root (".$docroot.$http_uri.")"); $http_uri=""; $pri_err=404; break; case NW_BAD_DOT_FILE: techo("NOTICE: discarded request for dot file (".$docroot.$http_uri.")"); $http_uri=""; $pri_err=404; break; case NW_BAD_WIN_DEVICE: techo("NOTICE: discarded request for windows device file (".$docroot.$http_uri.")"); $http_uri=""; $pri_err=404; break; } $sst=$http_action." http://".$htreq_headers["HOST"]."/".$real_uri.($query_string?("?".$query_string):""); _server_report_state($sst); if ($hu!=($docroot.$http_uri)) { // Reload access files if needed $hu=$docroot.$http_uri; unset($access); if (is_dir($hu)) { $uridir=$http_uri; } else if (is_dir($docroot.($uridn=dirname($http_uri)))) { $uridir=$uridn; } else $uridir=""; if (($accessdir=nw_realpath($docroot.$uridir)) && ($conf["global"]["accessfile"][0])) { load_access_files($accessdir, $access); } } $out_contenttype=$default_ct=access_query("defaultcontenttype", 0); // AuthLocation handler $bypass_auth = false; if ($authls=access_query("authlocation")) { $bypass_auth = true; foreach ($authls as $authl) if (strpos("/".$real_uri, $authl) === 0) { $bypass_auth = false; break; } } // Auth handler $logged_user=""; if (($rauths=access_query("authrequire")) && (!$bypass_auth)) { foreach ($rauths as $rauth) { if ($spos=strpos($rauth, " ")) { $authtype=strtolower(strtok($rauth, " ")); $authargs=trim(strtok("")); } else { $authtype=strtolower($rauth); $authargs=""; } $authmodn="auth_".strtolower($authtype); if (is_object($modules[$authmodn][0])) { if ($modules[$authmodn][0]->auth($auth_user, $auth_pass, $authargs)) { $logged_user=$auth_user; break; } } else { techo("WARN: authentication module not found for type '".$authtype."'", NW_EL_WARNING); } } if ($logged_user==="") { $logged_user=" "; $pri_err=401; $out_add_headers["WWW-Authenticate"]="Basic realm=\"".access_query("authrealm", 0)."\""; if ($emsg=access_query("authmessage", 0)) $add_errmsg.=$emsg."

    "; } } // Test for maximum URI length if (($conf[$vhost]["maxrequesturilength"][0]) && (strlen($http_resource)>$conf[$vhost]["maxrequesturilength"][0])) { $pri_err=414; } if ($htreq_headers["CONTENT-LENGTH"]) { // Read request content if there is one (POST requests) if (($maxblen=$conf[$vhost]["maxrequestbodylength"][0]) && ((int)$htreq_headers["CONTENT-LENGTH"]>$maxblen)) { // Request content is too large $pri_err=413; } else { if ($http_continue && !$pri_err) send_response(HTTP_VERSION." ".$HTTP_HEADERS[100]."\r\n\r\n", $sck_connected); $buf=$add_req; if (strlen($buf)<$htreq_headers["CONTENT-LENGTH"]) $buf.=read_request($sck_connected, $dp, $pn, $htreq_headers["CONTENT-LENGTH"]-strlen($buf)); $htreq_content=substr($buf, 0, $htreq_headers["CONTENT-LENGTH"]); } } core_modules_hook("after_decode"); if ($sck_connected) { switch ($http_action) { case "POST": if ((!access_query("_parseext", "_".strtolower($rq_file["extension"]))) && (is_file($docroot.$http_uri)) && (!$pri_parser)) { // Disallow POST on static content $pri_err=405; $out_add_headers["Allow"]=nw_allow_list($rq_file["extension"]); } case "GET": case "HEAD": if ($pri_err) { // Internal setting of http error $rq_err=$pri_err; } else if ($pri_redir) { // Internal redirection if ($rq_err<300) { $rq_err=$pri_redir_code or $rq_err=302; } $out_add_headers["Location"]=$pri_redir; if (version_compare($http_version, "1.0")<=0) $out_add_headers["URI"]=$pri_redir; } else if (is_object($umod=&$modules["url:/".$http_uri])) { // Module URL Hook if ($umod->modtype=="url2") { $lf=$umod; $lf->parser_open("", $real_uri, $rq_err, $out_add_headers, $out_contenttype); } else { $lf =& new static_response($umod->url($rq_err, $out_contenttype, $out_add_headers)); } } else if (is_dir($docroot.$http_uri)) { // Directory without index $rq_err=404; core_modules_hook("directory_handler"); } else if (!is_file($docroot.$http_uri)) { // 404 Not Found $rq_err=404; } else if (!is_readable($docroot.$http_uri)) { // 403 Forbidden $rq_err=403; } else { // 200 OK $rq_err=200; if ($pp=access_query("forcehandler", 0)) $pri_parser=$pp; $lf=loadfile($docroot.$http_uri, $rq_file["extension"], $rq_err, $out_add_headers, $pri_parser); /* libphpHACK */ ## if (isset($__nw_libphp_script)) { include($__nw_libphp_script); exit; } if ($mimetype=$mime[strtolower($rq_file["extension"])]) { // Lookup mime type in internal table $out_contenttype=$mimetype; } else if (is_callable("mime_content_type") && (!access_query("disablemimemagic", 0)) && ($mimetype=mime_content_type($docroot.$http_uri))) { // Fallback to mime magic if available $out_contenttype=$mimetype; } else { // Or use default $out_contenttype=$default_ct; } } break; case "OPTIONS": $rq_err=200; $out_add_headers["Allow"]=nw_allow_list($rq_file["extension"]); break; default: if ($mmod=$modules["method:".$http_action]) { $rq_err=200; $lf=$mmod; $lf->parser_open("", $real_uri, $rq_err, $out_add_headers, $out_contenttype); } else if (!$http_action) { $rq_err=400; } else { $rq_err=501; } break; } unset($pri_parser); if ($rq_err!=200 && $rq_err!=416) { // Error messages if ($rq_err>=400) { if (($errordoc=trim(access_query("_errordocument", "_".$rq_err))) && (@is_readable($docroot.$errordoc))) { $add_nsv["REDIRECT_STATUS"]=$rq_err; $add_nsv["REDIRECT_URL"]="/".$GLOBALS["real_uri"]; $http_uri=$errordoc; $errext=substr(strrchr($errordoc, "."), 1); $lf=loadfile($docroot.$errordoc, $errext, $rq_err, $out_add_headers); if ($mimetype=$mime[strtolower($errext)]) $out_contenttype=$mimetype; else $out_contenttype=$default_ct; } else { $out_contenttype="text/html"; $lf =& new static_response(nw_error_page($rq_err)); if ($errordoc) techo("WARN: unable to read error document : [".$rq_err."] ".$errordoc, NW_EL_WARNING); } $cnx=false; } else if ($rq_err>=301) { $lf=$null_response; } } if ($http_action=="HEAD") { $plen=$lf->content_length; $hlf=$lf; $lf=$null_response; $lf->content_length=$plen; } core_modules_hook("before_response"); if (!$rq_err) $rq_err=500; $chunked=nw_use_chunked_encoding(); if ($chunked==="CLOSE") $cnx=$keepalive=$chunked=false; // Send the response headers and content $sent_len=0; $first_chunk=true; while ((($buf = $lf->parser_get_output()) !== "") || $first_chunk) { if ($first_chunk) { $hbuf=build_response_headers()."\r\n"; } if ($chunked) { $chunk_header=dechex(strlen($buf))."\r\n"; $metasize=strlen($chunk_header)+2; $rbytes=send_response($hbuf.($buf!==""?$chunk_header.$buf."\r\n":""), $sck_connected); $sent_len+=($rbytes-$metasize); } else { $sent_len+=send_response($hbuf.$buf, $sck_connected); } if ($first_chunk) { $sent_len-=strlen($hbuf); $hbuf=""; $first_chunk=false; } if ($lf->parser_eof() || !$sck_connected || ($buf === NULL)) break; } $lf->parser_close(); if ($chunked) { $meta_len=0; send_response("0\r\n\r\n", $sck_connected); } if (!$sck_connected) $cnx=false; if (($sent_content_length=$sent_len-$meta_len)<0) $sent_content_length=0; if ($conf["global"]["singleprocessmode"][0]) { // Increment stats ++$stats_resperr[$rq_err]; ++$stats_vhosts[$conf[$vhost]["servername"][0]]; ++$stats_hits; $stats_xfer+=(float)$sent_len; } else { // Report hit to master int_sendtomaster(NM_HIT, array($mypid, $rq_err, $sent_len, $vhost)); } if ($conf["global"]["loggerprocess"][0]) { // Send the logging infos to dedicated processes $log_arr=array($vhost, $remote_host, $remote_ip, $logged_user, trim($tmp_arr[0]), $rq_err, $sent_content_length, $htreq_headers["REFERER"], $htreq_headers["USER-AGENT"]); $logmsg=serialize($log_arr); $msglen=strlen($logmsg); if ($msglen>INT_MSGSIZE) { techo("WARN: internal communication error (packet too long)", NW_EL_WARNING); } else { $r=socket_write($loggers_sck, $logmsg); if ($r!=$msglen) techo("WARN: unable to communicate with logger process", NW_EL_WARNING); } } else { // Or do it ourselves if ($nb_loggers=count($modules["log"])) { for ($a=0;$a<$nb_loggers;$a++) $modules["log"][$a]->log_hit($vhost, $remote_host, $remote_ip, $logged_user, trim($tmp_arr[0]), $rq_err, $sent_content_length, $htreq_headers["REFERER"], $htreq_headers["USER-AGENT"]); } } $hlf=$lf=$null_response; } } else { $cnx=false; } } socket_shutdown($msgsock); socket_close($msgsock); if ((!$conf["global"]["singleprocessmode"][0]) || ($conf["global"]["servermode"][0]=="inetd")) exit(0); } else if ($pid==-1) { // Fork failed techo("WARN: unable to pcntl_fork()", NW_EL_WARNING); } else { // Fork successful $scoreboard[$pid][NW_SB_STATUS]="(connected)"; $scoreboard[$pid][NW_SB_PEERHOST]=$remote_ip; $scoreboard[$pid][NW_SB_FORKTIME]=time(); ++$active_servers; } } ?> nanoweb_2.2.9/src/htpasswd.php0000644000000000000000000001060211023557654015101 0ustar rootroot#!/usr/local/bin/php -q 1) for($a=1;$a<$_SERVER["argc"];$a++) { if (($a==1) && (substr($_SERVER["argv"][$a], 0, 1)!="-")) { $cmdline_cf=$_SERVER["argv"][1]; } else { $ca=explode("=", $_SERVER["argv"][$a]); $ck=array_shift($ca); $cv=implode("=", $ca); switch($ck) { case "-h": case "--help": foreach ($cmdline_help as $cs) echo($cs."\n"); exit; break; case "-v": case "--version": die(VERSION."\n"); break; case "-d": case "--display-result": $display = true; break; case "-f": case "--file": $file = $cv; break; case "-c": case "--create-file": $title=$cv."\n"; create_file($title); break; case "-a": case "--add-user": $params=explode(" ",$cv); $login = $params[0]; $passwd = $params[1]; add_user($login,$passwd); break; case "-m": case "--modify-user": $params=explode(" ",$cv); $login = $params[0]; $passwd = $params[1]; modify_user($login,$passwd); break; default: echo "unknown argument : ".$_SERVER["argv"][$a].", try --help\n"; break; } } } function gen_salt(){ $random = 0; $rand64 = ""; $salt = ""; $random=rand(); $rand64= "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; $salt=substr($rand64,$random % 64,1).substr($rand64,($random/64) % 64,1); $salt=substr($salt,0,2); return $salt; } function crypt_pass($pass,$salt){ return crypt($pass,$salt); } function open_file($file,$arg){ if (!$file){ if (is_file(DEFAULT_AUTH_FILE)) $fp=fopen(DEFAULT_AUTH_FILE,'a'); else $fp=fopen(DEFAULT_AUTH_FILE,'w'); } else $fp=fopen($file,$arg); return $fp; } function create_file($str){ if(!$str){ echo "please, you have to set a realm name !\n"; exit(); } write_file($str,"w"); } function add_user($login,$passwd){ global $display; if(!$passwd){ echo "please, you have to set a password !\n"; exit(); } $check = read_file("check"); if ($check == true){ echo "user already exist, use --modify-user instead\n"; exit(); }else{ $salt = gen_salt(); $crypt_pwd = crypt_pass($passwd, $salt); $str = $login.":".$crypt_pwd."\r\n"; if($display == true) display_result($str); else write_file($str,"a"); } } function write_file($str,$arg){ global $file; $fp = open_file($file,$arg); fputs($fp,$str); close_file($fp); } function close_file($fp){ fclose($fp); } function display_result($str){ echo $str; } function modify_user($login,$passwd){ global $display; if(!$passwd){ echo "please, you have to set a password !\n"; exit(); } $check = read_file("mod"); } function read_file($action){ global $file, $login, $passwd; $found = false; if (!$file) $file = DEFAULT_AUTH_FILE; $fp = fopen($file,"r"); $contents = fread($fp, filesize($file)); $tmp = explode("\n",$contents); for ($i=1;$i nanoweb_2.2.9/README0000644000000000000000000000502711023557654012631 0ustar rootroot the aEGiS PHP nano web server ============================= Copyright (C) 2002-2005 Vincent Negrier aka. sIX This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. What ??! Nanoweb is an HTTP server written in PHP, designed to be small, secure, and extensible. The main features are : - HTTP/1.1 compliance - Powerful and easy configuration - Modular architecture - FastCGI, CGI and Server side includes support - Name and port based virtual hosts - Access control lists - htpasswd, MySQL, PostgreSQL and LDAP authentication support - Themes for server generated content - Apache compatible log format, MySQL logging - Directory browsing - inetd support and SSL via external helpers - Denial of Service protection - Proxy Server extension - Filters and gzip support - RBL support (mail-abuse.org) - Extension Protocols (request methods) support - ... and a lot more Why ? Why did I do it ? I found the idea of using a language mostly aimed at web scripting to write a web server was quite funny. That's all, really ... Why should you use it ? It's light, fast and robust. Also being written in PHP makes it very easily extensible with custom modules, and secure because - running inside the Zend scripting engine - it's immune to a number of common security threats (format strings, buffer overflows, ...) How ? Read INSTALL, and follow the simple installation steps. Interesting readings after install is done : - User Manual (http://localhost/manual or http://nanoweb.si.kz/manual) - The 'docs' directory contains some brief infos about individual parts of the server, modules, and some howtos. - The 'ChangeLog' file contains the list of all added features and this could be useful. - Default configuration files are well commented and reading them should help you getting started too. For any other concerns about nanoweb, please consult the general or support forums at or mail the author. nanoweb_2.2.9/conf/0000755000000000000000000000000011023557654012672 5ustar rootrootnanoweb_2.2.9/conf/modules.conf0000644000000000000000000005437711023557654015231 0ustar rootroot################################################## # # aEGiS nanoweb modules configuration file # # ModulesDir defines the directory where the modules are located ModulesDir = /usr/lib/nanoweb/modules/ # Parser modules ############################################################################## # # Static content support (you probably don't want to change this) # ############################################################################## LoadModule = mod_static.php # Defines the size (in bytes) of the buffer allocated for serving static files #StaticBufferSize = 1048576 # Uncomment the line below if you want to disallow serving partial content. # This feature of HTTP is mostly used for resume and by download accelerators. #StaticDisablePartial = 1 # mod_asis extends mod_static to allow serving of raw content (including HTTP # headers) from text files. #LoadModule = mod_asis.php ############################################################################## # # Server Side Includes (SSI) support # ############################################################################## #LoadModule = mod_include.php ############################################################################## # # Common Gateway Interface (CGI) support # ############################################################################## LoadModule = mod_cgi.php # This option is only here if you plan to use the CGI version of PHP. # There is a bug still unfixed in PHP-CGI that forbids passing the PATH_INFO # server var to the scripts. Disable it if it gets fixed one day. #CGIFilterPathInfo = 1 # Use CGINoHeader to specify a list of HTTP response headers that will be # blocked by the server (not forwarded to the client browser) #CGINoHeader = X-Powered-By # Every file in a directory defined as CGIScriptsDir will be considered as a # CGI script and will be executed by mod_cgi #CGIScriptsDir = /usr/lib/cgi-bin #Alias = /cgi-bin/ /usr/lib/cgi-bin/ # CGIScriptNoExec defines the behavior of mod_cgi if a file in a CGIScriptsDir # does not have the executable bit set. Possibles values are : # "error" : throws an internal server error # "raw" : sends the raw content of the file #CGIScriptNoExec = error ############################################################################## # # FastCGI support # ############################################################################## #LoadModule = mod_fcgi.php # See CGIFilterPathInfo for explanation of this directive. #FCGIFilterPathInfo = 1 # Use FCGINoHeader to specify a list of HTTP response headers that will be # blocked by the server (not forwarded to the client browser) #FCGINoHeader = X-Powered-By ############################################################################## # # BSP (Brainfuck Server Pages) support # ############################################################################## #LoadModule = mod_bsp.php # Allow display of BF source if url is "http://xxx/xxx.bsp?source" ? #BSPAllowSource = 1 ############################################################################## # # Transparent ZIP archive decompression # ############################################################################## #LoadModule = mod_unzip.php ############################################################################## # # Internal lnk files handler # ############################################################################## #LoadModule = mod_lnk.php # Content modules ############################################################################## # # Status report module (needed by 'nanoctl status') # ############################################################################## LoadModule = mod_status.php # Hosts allowed to consult server status through mod_status StatusAllowHost = 127.0.0.1 StatusAllowHost = 10.0.0. ############################################################################## # # Worms detection support (see README.mod_worms before use) # ############################################################################## #LoadModule = mod_worms.php # Text that is sent to the offending IIS server console #WormsWpopText = Your webserver has been infected by an HTTP worm. #WormsWpopText = We strongly suggest you use a recent anti-virus to scan this computer. #WormsWpopText = --- #WormsWpopText = warning sent by nanoweb server at http://$SERVERNAME # What to do if we have a worm ? ($REMOTE_IP and $REMOTE_HOST can be used) #WormsRun = /usr/bin/firewall_add $REMOTE_IP #WormsRun = echo "$REMOTE_HOST" >> /tmp/IIS_rulez # If you want to block IP of worm infected hosts, specify how long (in seconds) # with WormsBlockTime (use 'perm' to place a permanent block) #WormsBlockTime = 7200 # Method handler modules ############################################################################## # # HTTP/1.x PUT method # ############################################################################## #LoadModule = mod_method_PUT.php # Overwrites if permissions are set to ???????rw? #WriteAccess = 1 ############################################################################## # # HTTP/1.x TRACE method # ############################################################################## #LoadModule = mod_method_TRACE.php ############################################################################## # # HTTP actions handled by dedicated cgi's # ############################################################################## #LoadModule = mod_method_handler.php # NOTE: the path name to the handler script given here must be absolute to the # docroot! (not as relaxed as with Filter handlers) #MethodHandler = FOO /cgi-bin/FOO_handler.php # Parser filters support (pfilters) ############################################################################## # # pfilters core, must be loaded before any pfilters module # ############################################################################## LoadModule = mod_pfilters.php # This directive enables the filter infrastructure, which however has # no effect until you activate a `Filter' directive. FilterEnable = 1 ############################################################################## # # Gzip content encoding pfilter # ############################################################################## LoadModule = mod_gzip.php # mod_gzip can be enabled in two different ways. The old method # is to activate it for every served file: #GzipEnable = 1 # Due to its implementation as filter you could however tell it to only # compress text files (as images and other files are often already): #Filter = text/* gzip # Max compression ratio (percentage of original size). If it is higher, the # content is likely to be already compressed and does not need a recompression. GzipMaxRatio = 90 # Level of compression asked to zlib GzipLevel = 5 ############################################################################## # # HTML filters # ############################################################################## #LoadModule = mod_html_filters.php # converts to one-line html file #Filter = text/html shrink # strtolower(tags) #Filter = text/html downcase # html->wml conversion if requested by client #Filter = text/html wap # a useful one :) #Filter = dont/use! garbage ############################################################################## # # Image Filters # ############################################################################## #LoadModule = mod_img_filters.php # libgd doesn't work with .gif images anymore, so these Filter rules # won't do any changes to them #Filter = image/* copyright © 2002 whoever wants to #Filter = image/png convert jpeg #Filter = image/* wbmp 100x60 ############################################################################## # # miscellaneous/control filters # ############################################################################## #LoadModule = mod_misc_filters.php # This filter corresponds to the apache AddHandler/Action directives #Filter = .ext|http/* handler /cgi-bin/handler.php # (http) control "filters" #Filter = text/* nocache #Filter = text/html addheader Content-Feature: tables,frames,javascript #Filter = .so|.dll addservervar LD_PRELOAD=/lib:/usr/lib # Logging modules ############################################################################## # # Standard logging support (console and file logging) # ############################################################################## LoadModule = mod_stdlog.php # Log every hit to standard outpout ? [0/1] #LogHitsToConsole = 1 # Log every hit to the server log(s) ? [0/1] #LogHitsToServerLog = 1 # LogType lets you set the format used for log files output. # "common" is the NCSA Common Log Format (also known as CLF) # "common-with-vhost" is the same as CLF, but with support for multiple hosts # "combined" is the extended CLF format used by Apache (default) LogType = combined ############################################################################## # # MySQL logging support # ############################################################################## #LoadModule = mod_mysqllog.php # MySQL Logging module configuration MySQLLogHost = localhost MySQLLogDatabase = nanoweb MySQLLogUser = nanoweb MySQLLogPassword = nanoweb # Core modules ############################################################################## # # Access control module # ############################################################################## LoadModule = mod_ac.php # ACPolicy defines the default access policy and is set to "allow" or "deny" #ACPolicy = deny # ACAllowIP and ACAllowHost let you define which remote clients you will allow # if you set the policy to "deny" #ACAllowIP = 10.0.0.* #ACAllowIP = 192.168.* #ACAllowHost = *.localdomain # ACDenyIP and ACDenyHost work the same as their Allow counterparts, but will # deny clients when the policy is set to "allow" #ACDenyHost = *.aol.com # ACBlockError is the error code thrown to denied clients (default is 403) #ACBlockError = 403 # ACBlockMessage is an optional message returned with the error page #ACBlockMessage = Go away ############################################################################## # # The nanoweb proxy module # ############################################################################## #LoadModule = mod_proxy.php ProxyCacheDir = /var/cache/nanoweb ProxyAllowIP = 10.0.0 ProxyDenySite = /etc/nanoweb/badsites ProxyDenyPopup = /etc/nanoweb/popup.txt ProxyDenyPub = /etc/nanoweb/images.txt ProxyAccessLog = /var/log/nanoweb/mod_proxy # 2592000 seconds = 1 month, u can put whatever you want here ProxyCacheMaxAge = 2592000 ############################################################################## # # Email Address Protection Filter # ############################################################################## #LoadModule = mod_emailprotect.php #Filter = application/x-httpd-php emailprotect ############################################################################## # # URL mispelling support # ############################################################################## LoadModule = mod_mispell.php # What to do when we catch a mispelled URL ? # advice : the client is returned a 404 not found page with an link # redirect : the client is automatically redirected MispellAction = advice ############################################################################## # # Files and directories browsing module # ############################################################################## LoadModule = mod_fb.php # Allow browsing of files and directories. You may define this for each # virtual host FileBrowser = 1 # FBSortOrder=(name|size|date)[ desc]) defines the sorting order and direction FBSortOrder = name # FBDateFormat defines how mod_fb will represent the date and time of each file # and directory. The format is the same as the PHP date() function. #FBDateFormat = Y-m-d H:i FBDateFormat = d-M-Y H:i:s # Show .xxxxxxx files in browser ? #FBShowDotFiles = 1 # This file, if found, is displayed before the listing in file browsing mode FBWelcomeFile = .welcome # Name of the description file. Format is "filename.ext desc of the file" for # each line FBDescFile = .desc # FBIconByType define icons associated to mime types in file browser. # Syntax is "FBIconByType = /path/to/icon mime[/type]" FBIconByType = /icons/exec.gif application FBIconByType = /icons/pic.gif image FBIconByType = /icons/son.gif audio FBIconByType = /icons/txt.gif text FBIconByType = /icons/video.gif video # FBIconDirectory define the icon shown for directories in file browser. FBIconDirectory = /icons/rep.gif # FBIconDefault define the default icon used in file browser. FBIconDefault = /icons/misc.gif ############################################################################## # # Download bandwidth limiting # ############################################################################## #LoadModule = mod_throttle.php # Bandwidth = 16K/s ############################################################################## # # Multiviews support (content negotiation) # ############################################################################## #LoadModule = mod_multiviews.php # LanguagePriority : A browser requesting http://example.com/ will be delivered # 'index.html.en' in favour of 'index.html.de' (if the users browser has not # been configured to request with another language preference). Of course # this only works if no 'index.html' exists in the docroot, which nanoweb # otherwise would have preselected. A file called 'index.html.fr.gz' may get # send in favour of all other variants, because of the higher priority of # compressed content. LanguagePriority = en fr de # OtherPriority : sets priorites which come into use, when the client doesn't # send an Accept:-header. As you can see, you may intermix file extensions # (as "php" - without dot!) and mime-types known to nanoweb; where you don't # specify a priorty value with qs= (0.0 - 1.0) a lesser (divided by 1.7) value # as the previous one will be choosen. #OtherPriority = php; qs=0.28, text/html; qs=0.27, text/* ############################################################################## # # RewriteEngine (powerful URI to filename mapping) # ############################################################################## # Please see the manual before use #LoadModule = mod_rewrite.php # ReflectRewriting will reflect changes to the requested path name in server # error responses, when for example the rewritten file name does not exist or # has no read permissions set; otherwise the url from the request will be # printed in such server messages. # Note: This config directive affects mod_multiviews as well and shouldn't # be used if mod_proxy is active. #ReflectRewriting = 1 ############################################################################## # # Message digest support # ############################################################################## #LoadModule = mod_digest.php # Enable DigestMD5 to make nanoweb generate a "Content-MD5" response header # whenever it's possible (static content, not too large) #DigestMD5 = 1 ############################################################################## # # HTML meta-information extractor # ############################################################################## # Extracts meta-information from hypertext files and makes http-equiv data # available as standard https header inside nanoweb. Data from a companion # .meta file is additionally appended to the http headers #LoadModule = mod_meta.php # MetaFetch defines how the meta information will be fetched from the HTML # document. It can be set to "fast", "regex" ,"no" or "0" #MetaFetch = fast ############################################################################## # # RBL use (see http://mail-abuse.org/rbl) # ############################################################################## #LoadModule = mod_access_rbl.php # dns or web, dns is more faster thant web #Access_RBL = dns ############################################################################## # # Server Load Limit # ############################################################################## LoadModule = mod_load_limit.php # Defines the maximum load average after which the server will return an error # and won't serve documents until load goes down. LoadLimit = 8.0 # LoadLimitAction can be set to "error" if you want to generate an error page # on overload, or "redir" to redirect to another page/site. LoadLimitAction = error # If LoadLimitAction is set to "redir", LoadLimitRedirect is the site the # client browser will be pointed to. #LoadLimitRedirect = http://www.example.com/overloaded.html #LoadLimitRedirect = http://www2.example.com%REQUEST_URI # If LoadLimitError is set to "error", the server will return LoadLimitError as # HTTP error number. The default is 503 which means Service Unavailable. LoadLimitError = 503 # This is the message displayed in the error page. %CUR_LOAD and %MAX_LOAD are # replaced by the current load average, and the maximum allowed load average. LoadLimitErrorMessage = Server load is too high (%CUR_LOAD/%MAX_LOAD), try again in a few moments. ############################################################################## # # DoS Evasive module # ############################################################################## #LoadModule = mod_dosevasive.php # Delay in seconds #DosEvasiveTimer = 10 # Maximum allowed number of requests for one resource in DosEvasiveTimer sec. #DosEvasiveMaxReqs = 5 # Error thrown if the maximum is reached, 403 Forbidden is a good default #DosEvasiveError = 403 # If you want to block IP of DoSing hosts, specify how long (in seconds) with # the DosEvasiveBlockTime (use 'perm' to place a permanent block) #DosEvasiveBlockTime = 120 # Authentication modules ############################################################################## # # Simple authentication # ############################################################################## LoadModule = mod_auth_simple.php # Use these directives in a conf/vhost/access file to use mod_auth_simple # # AuthRealm = your auth realm name here # AuthRequire = SIMPLE # AuthSimpleUserPass = login1 pass1 # AuthSimpleUserPass = login2 pass2 # ... # AuthSimpleUserPass = loginN passN ############################################################################## # # Backwards compatible .nwauth authentication # ############################################################################## LoadModule = mod_auth_nwauth.php # Use these directives in a conf/vhost/access file to use mod_auth_nwauth # # AuthRealm = your auth realm name here # AuthRequire = NWAUTH # AuthNwauthFilename = /var/www/vhosts/www.example.com/admin/.nwauth ############################################################################## # # Apache compatible .htpasswd authentication # ############################################################################## #LoadModule = mod_auth_htpasswd.php # Use these directives in a conf/vhost/access file to use mod_auth_htpasswd # # AuthRealm = your auth realm name here # AuthRequire = HTPASSWD # AuthHtpasswdFilename = /var/www/vhosts/www.example.com/admin/.htpasswd ############################################################################## # # MySQL based authentication # ############################################################################## #LoadModule = mod_auth_mysql.php # Use these directives in a conf/vhost/access file to use mod_auth_mysql # # AuthRealm = your auth realm name here # AuthRequire = MYSQL # AuthMysqlHost = localhost # AuthMysqlUser = db_user # AuthMysqlPass = db_pass # AuthMysqlDB = db_name # AuthMysqlTable = table_name # AuthMysqlPassType = plain | crypt | md5 | mysql # AuthMysqlLoginColumn = login_field_name # AuthMysqlPassColumn = password_field_name # # Password types are # # plain : password is plaintext # crypt : password is hashed using the system crypt() # md5 : password is hashed using the md5 algorithm # mysql : password is hashed using the mysql password algorithm ############################################################################## # # Database based authentication via abstraction layer # ############################################################################## # AnydbLoadInterface = /usr/local/php/adodb/adodb.inc.php # AnydbLoadInterface = /usr/local/php/DB.php #LoadModule = mod_auth_anydb.php # AuthRealm = your auth realm name here # AuthRequire = ANYDB # AuthAnydb = database://db_user:db_pass@localhost/db_name/table_name # AuthAnydbLoginColumn = login_field_name # AuthAnydbPassColumn = password_field_name ############################################################################## # # Anonymous authentication (ftp-like) # ############################################################################## #LoadModule = mod_auth_anonymous.php # AuthAnonymousNames = anonymous anonym guest nobody # AuthAnonymousSmtpCheck = 0 # AuthRealm = your auth realm name here # AuthRequire = ANONYMOUS ############################################################################## # # IP Address blocking management # ############################################################################## LoadModule = mod_blockadm.php BlockAdmAllowIP = 127.0.0.1 ############################################################################## # # WWW Spam filtering # ############################################################################## #LoadModule = mod_nospam.php #SpamBlockError = 403 #SpamBlockMessage = Something in the content you submited has been identified as www spam, your IP address has now been blocked from this server. #SpamBlockTime = 86400 #SpamCheck = GET POST #SpamRegex = /http:\/\/[a-zA-Z0-9.-]+\.ru/i #SpamRegex = /
    Index of @$dir_name@
    @$welcome@

    @$total_size_formated@ bytes in @$total_files_formated@ files Sort by name | date | size

    [/fb_header] [fb_header:fr] Contenu de @$dir_name@
    Contenu de @$dir_name@
    @$welcome@

    @$total_size_formated@ octets dans @$total_files_formated@ fichiers Trier par nom | date | taille

    [/fb_header:fr] [fb_header:de] Inhalt des Ordners @$dir_name@
    Inhalt des Ordners @$dir_name@
    @$welcome@

    @$total_size_formated@ bytes in @$total_files_formated@ files Sort by name | date | size

    [/fb_header:de] [fb_parent_name] Parent directory [/fb_parent_name] [fb_parent_name:fr] Répertoire parent [/fb_parent_name:fr] [fb_parent_name:de] Übergeordnetes Verzeichnis [/fb_parent_name:de] [fb_directory_row] [/fb_directory_row] [fb_file_row] [/fb_file_row] [fb_footer]

    @$server_signature@ [/fb_footer] nanoweb_2.2.9/conf/nanoweb.theme0000644000000000000000000002464611023557654015363 0ustar rootrootNanoweb server theme (c)2003 by sIX / aEGiS Internal theme data [theme_id] nanoweb [/theme_id] [theme_name] nanoweb server theme [/theme_name] [theme_language] en-us [/theme_language] Core generated content [server_signature] Page generated by @$server_string@ at http://@$server_name@ [/server_signature] [server_signature:fr] Page générée par @$server_string@ - http://@$server_name@ [/server_signature:fr] [server_signature:de] Seite generiert von @$server_string@ - http://@$server_name@ [/server_signature:de] [error_admin] Please contact the server administrator if the problem is abnormal and persists.

    [/error_admin] [error_admin:fr] Veuillez contacter l'administrateur du serveur si le probleme persiste.

    [/error_admin:fr] [error_admin:de] Bitte kontaktieren Sie den Server-Administrator, wenn das Problem weiter besteht.

    [/error_admin:de] [error_resource] An error occured trying to access document or resource @$resource_name@.

    [/error_resource] [error_resource:fr] Une erreur s'est produite a l'accès du document ou de la ressource @$resource_name@.

    [/error_resource:fr] [error_resource:de] Ein Fehler trat auf, bei dem Versuch auf das Dokument oder die Resource @$resource_name@ zuzugreifen.

    [/error_resource:de] [error_page] @$error_label@
    Nanoweb home


    @$error_label@

    @$error_resource@ @$error_add_message@ @$error_admin@

    @$server_signature@
    [/error_page] File browser module [fb_header] Index of @$dir_name@
    Nanoweb home



    Index of @$dir_name@

    @$welcome@ [/fb_header] [fb_header:fr] Contenu de @$dir_name@
      Name Last modified Size    

    Nanoweb home



    Contenu de @$dir_name@

    @$welcome@ [/fb_header:fr] [fb_header:de] Inhalt des Ordners @$dir_name@
      Nom Date Taille    

    Nanoweb home



    Inhalt des Ordners @$dir_name@

    @$welcome@ [/fb_header:de] [fb_parent_name] Parent directory [/fb_parent_name] [fb_parent_name:fr] Répertoire parent [/fb_parent_name:fr] [fb_parent_name:de] Übergeordnetes Verzeichnis [/fb_parent_name:de] [fb_directory_row] [/fb_directory_row] [fb_file_row] [/fb_file_row] [fb_footer]
      Name Letzte Änderung Größe    

    @$name@ @$date@ < dir >   @$desc@
    @$name@ @$date@ @$size@ bytes   @$desc@

    @$server_signature@
    [/fb_footer] nanoweb_2.2.9/CREDITS0000644000000000000000000000137011023557654012766 0ustar rootrootNanoweb Credits =============== Vincent Negrier - author and main developer Mario Salzer - author and maintainer of the nanoweb manual - official provider of Good-Ideas(tm) - approved poor-english to german translator - install-sh v2 - nanoconfig - mod_rewrite - mod_multiviews - mod_pfilters - mod_html_filters - mod_img_filters - mod_libphp - mod_method_put - a whole lot of other modules myrdin - htpasswd.php util - mod_proxy - mod_mispell - mod_access_rbl Phanatic - author and maintainer of the nanoweb debian packages see http://linux.psoftwares.hu/nanoweb/ - mod_auth_pgsql splif - file browser icons and some neat ideas nanoweb_2.2.9/docs/0000755000000000000000000000000011023557654012675 5ustar rootrootnanoweb_2.2.9/docs/README.mod_bsp0000644000000000000000000000227511023557654015205 0ustar rootrootREADME.mod_bsp ============== What is mod_bsp ? It's a nanoweb module used to serve BSP content. But what is BSP ? BSP stands for Brainfuck Server Pages. But ... What the f*ck is Brainfuck ? To quote this page : "Brainfuck is the ungodly creation of Urban Müller, whose goal was apparently to create a Turing-complete language for which he could write the smallest compiler ever, for the Amiga OS 2.0. His compiler was 240 bytes in size. (Though he improved upon this later -- he informed me at one point that he had managed to bring it under 200 bytes.)" If you want to see what it looks like, have a look at htdocs/default/bspdemo.bsp Quick facts about mod_bsp : - mod_bsp makes use of the PHP Brainfuck Interpreter v1.01 by Daniel Lorch. visit the official site at : http://daniel.lorch.cc/projects/brainfuck/ - The parameter given to ParseExt is the content type of the served pages. - If "BSPAllowSource = 1" is defined in config file, calling a bsp page with "?source" as query string will show the BF source code of the page. - The input fed to the BF programs is the content of the POST request - The output directly goes to the client browser nanoweb_2.2.9/docs/README.mod_worms0000644000000000000000000000224211023557654015562 0ustar rootroot# If you plan to use mod_worms, you must copy this file 'README.mod_worms' to # '/usr/bin/wpop' or any other directory in the default path, and chmod +x it. # You may also have to compile samba if you don't already have smbclient and # nmblookup, and edit the four paths at the top of the file. # CUT HERE ! CUT HERE ! CUT HERE ! CUT HERE ! CUT HERE ! CUT HERE ! CUT HERE ! # # wpop # Version 2.0 # by Vincent Negrier # # Sends a winpopup message to the specified IP address # Usage: echo "blah" |wpop 10.0.0.1 # # Requires smbclient and nmblookup from samba SMBCLIENT='/usr/bin/smbclient' NMBLOOKUP='/usr/bin/nmblookup' # Where to send the very interesting output of smbclient OUTPUT_TO='/dev/null' # Check if paths are OK if [ ! -x "$SMBCLIENT" ]; then echo "can not find $SMBCLIENT" exit fi if [ ! -x "$NMBLOOKUP" ]; then echo "can not find $NMBLOOKUP" exit fi if [ "$1" != "" ]; then $SMBCLIENT -M `$NMBLOOKUP -U $1 -A $1 |grep "<00>" |grep -v "" |grep -v "~" |cut -c2- |cut -d" " -f1` -I $1 >$OUTPUT_TO 2>$OUTPUT_TO else echo "usage: wpop [CONDPATTERN must be lexically greater than TESTSTRING =CONDPATTERN must be lexically equal to TESTSTRING ›ž‹ˆY©Z§PG•s!My¨×¡" (Ž Û4@‚jI¨ãñT×¹©úYÌÐva;‡ëš 1)ð(!XÀê)S¸c bg]#Ãâµ/7¿¾~ B³ßæ ÑW2À/<6Ò8L£ŠBy/Ý‘ˆT©ƒ6{.9N'ìÜEb ÏÇûódSö¼{X<ï®i¢Öƒt—}ßOÕúÈÕ}« ½ÓÌÙ1 ̡㠇3€ ܃¯Ð%îD⽜çLcºˆª¿8A45Knây‚‘Ì©Ê$q§¸Ü ƒ¢ÊiPÏYâDþ°¢Ù¨š‹7E9Lœ}÷J× Í"”ù Ïõ•.ªQR^¤I„ðêkùÅiÃ26<5Ôi߯>榇°}c‰¥”˜3b‡a£6àšÖÁ¿­­a‰žéRþj;¨(y9¨´Ýƒü»³! ·Æå²Ô¾­åqé”ïêEǪ^/ÕOˆ‹;ÏØ@½Ó!@ò[Y¼,hÛVbÑ:mBâÕ°¦õ«±>ˆl3qϱ`»Kôñ!y˜nô{V¤®%kƒ7#Vkþ–GQûiòØœ·&.3±©x¨Ã#¦¥—Ì€ítýôq#þBƒiñ~ŽÈçò|“³mZ§S‹7È ¯Bp†påœuÆv&Et3îÄls{KWŸ7wYÄ=ü‰ššý1'ñ>Y¿Ú¶nanoweb_2.2.9/docs/man/man1/mkhugenanoweb.php.1.gz0000644000000000000000000000204411023557654020425 0ustar rootroot‹¡áN>mkhugenanoweb.php.1uUÛnã6}çWLõä±´mQ è[ڤͱóP4û@K´E„U^âø›öús=CÊŽ¼Æ†‘£™sΜ!Ë—‚B«=ág{EvƒWE½ìíN­©“= r«¼(8Ãëû²õlŠÄPkwÁþpÁq¢\ÝR÷ÚÆ­ó”C;ÐTü©Ö.J·§Ÿ>}ú¹ âZ­5*üuÿ\}Ö}|ÇÒ³WŽîd¥ñÈ´¼¥û«»qžîeNr¨\Û~£·$û†:ÛD£@¦ºIpʳüûþáq¹XŠò÷stâ^žKñE|AóšŠcb.\ˆ/4nõ“-|1Ù±Ø)˲2xç§1"a»¾Yþñ´x\-îÅŠÛ¬5TC›µ¢èUÃrgº,úýØžÛÕꑖʽA³ÿÖº‡´_E¹8¡¾Ó¡%i éà±Xœhpj>HDzŒÑÉ mO 2ËW¯û­A4d÷µÓC ]«ë–|Yã@’Ö: ½S´‘>—`"mô °$|Ô•6Ö!µ ©_°Ü rÑRˆë¨Æò*­+šm4j¯÷ÄÏ b¸€ÃNeVj¬lwd-Ô{P½g#ÝË tüêàíQÝÝ%'ùØ¥°^»›+ö”¬[ õ4ãR£Ù$ˆW+ŸÀhæh´zËZg.Jq‡ž¥€ÀhƒÝ*dqGes"ÌŽâvòuNÑźI×ÚvƒÑ5$i.³º! ¬œbIÆv g N­£6 ímtì‰3ó ®¹ÏÌ„êhFáÆ¸šà”4SξLv}HNÅ$­“Ëy_|ã~*^6O—/ Õ¡("Š*zWyXµú^p¶1b¥Œñ£Ñ¦ƒ0:cÄh””¦‹>°îŒÚ: Ñ¥öÁéud×eã^’2>GåqÚi˜h#µ¡ÙN±'z@‰Ñ0Ðoö9°‰?ZúAº.¾= ¦DFÙ˜´ õouzz,åþÀñ´ïÉÇ¡O~É ñÑ$'§~¦°)$ËÎÏ™).ÃCÂÕ(*¼§,éapache2nwconf.1uSÁnÛ0 ½ë+¸\–ÓuØe‡éš-Ú$¨Óúƒl3±E $*žÿ¾”ì4H ‘Ôãã{Tö2ª•þ¬A°>"ilƒ쥃ܢùØr^𲩒C±jÛýpëD¶ž<ȲÆ[Ó”Ölà ~`á‚t-ÜÞÜ|Àà Åè?ÏãeÂ?={tð(MÚ3J>ƒÅäq*.¡^FÀÿ#:ò}“>F6jœ$eM¤v`cÝ^RÂÊ/–«|ž‹ìî’øCc¤rÜÅÇ5Ñ¡ÊRî¯øOýHr.âÞOóïOóÕz¾\ž “3Ò‘‡ d{ºI®_Ê7³žÀcézØ8»OÙIj±½`-øÖ»É6J# Ïô®DoC7'm -z b5th™kÎô„¸ô½R.R:"+마0É驲®Á[hmƒ|—¬pØ]‰;A•gt_£Ö_Å;ÛF¾u÷ÖŒ5‹à;•“×Ëõ4g~*î–Õq#O T‡¼š­@K³ qá$§¹Ñ5HS%R%o5(wqaÊZ(:ïÊ›ÈÖ©­2R÷¦ÂYMhÕ<ãž%â%çµçÎ^U(Ò\¥SÊÄœ"5c ¤ndë¡B¯œ,ØVª´‡–úä¥G"e¶é½ô޼Q¾¶A³ 5–»ÄYð¼tz†}Ðñzg|l3C’t)ØãeI¾A>Âä!_ò˹{:=€n®á—+ñ b6 •ênanoweb_2.2.9/docs/man/man5/0000755000000000000000000000000011023557654014310 5ustar rootrootnanoweb_2.2.9/docs/man/man5/nanoweb.conf.5.gz0000644000000000000000000000377711023557654017410 0ustar rootroot‹ÄáN>nanoweb.conf.5}Wmoã6þ®_Á 69¤rr׋îCš·5dƒØÛâp- Z¢m"”¨’”ÿû{f(Jr6{è%j^žyæ™añG.ÂV{¶Q®ñS‰F6v¯V¢–håFù¬ÀÁü<à½l^¼–Oâ[»ö‡S:—ËÏÉBQÚf-~ù­Z¹Nºƒøçùù¿r‘_«•†ñ»Ç¯³{Ýt¯xôÕ+'dÓIãadñY<^>ÜdG–þøI<±éFÐC½éœ Ú6b­â¯oWÏó§åüËc¶D”ñůGQeH9fð®Er÷ùÐ*·T¯A,lü±>9liM†Àwø-›Š ôBÃßoT£œ4«t³!Ÿ2ˆºóAȶ5’Î’O-Ubíl-¶sÀÕ‡B̨ó€_[Ê€Sˆ›e¨ü\üWlŒ]!û?³ì’ 3|C\•ZktøN»@ @úWTÕ+Å^b—ÌÅ.¾ã&ܨ€P¯²ncS쉿ѿB#Pî-R ºTE–Í¢EòJ‹ßKÏï¤éTÒru ìHŽ!G*7ç÷<¾¹ø·Èéóœ s<rÂÍ“Úö¢øX\ a€1øÜ2“•P^ošXõ«/·ó»¯Ï—¤âzþ|sµœÿv³  ¤T¼Çß <¶7ùZ)4ìÐ¥o+”:©ußmõÛ例 yøìi‘ýÇvD*ž§öN%„†JÇVßòÙ.ŸÄ/ ê‚¥ëleT÷û}ÑBýë<»fÖD‚A²3 ËQ|Ày¯‹S¾µhW’4üo¯Ã–}M<]-=»úDZ£¹'žÉªÒ”%’®À-vA˜±ÿÞ/»’e©Ú0Z¿¶eW«&<[Øül'Ý é§°"ÅStME¹ÕŽâŒ2Œ:{&4Wèù­íLEo)‚^¸vZ²ØLÂI.æððÊiú«h·mÿ×6Ôi¯§s7ú÷­*õZ«ˆ`¬ÝH~n Ne•“\tÈ6 ß‘²Aà`Y&äâ,¢”ÆÏŒöD—·uz°Ud„(¥42G)cüPw”Úu t•¨ñé™õËŠ½u/€‰­42+©jÛ‚D6êÕÛi ð“F C5A8’ñ óe_b:s¸zÖH(c+ã,ôšš«±\YÙ[Ë.yžV*(WÃ~Å=#û7¥vFYâi€r µ=O.N3¶?–B#7¥éz4†3€êPoÚÜ±ÌÆÊŠZ"¢’bygOÑM¿Š•s€‚ø”QûAì*·@{keÒÖžqåã'—J7c H” öc”{AycW»çXyÛáaÇqEôýÒ¯EÜd/H¥?ÃýŠ©ÆóŒÂ˜°¥f†õy¤£Ï¬«ò·û1Â'‰o^cïS“]ÝÍŬón¶ÒÍŒüW¿h¶Ób™g—É›O<B‰'iÞ‚©gˆ¿®yP£—J§[f¦‘ͦƒžbX@­#¡Ÿ^"9°MŽÔºø1ÐÏñ%ëÇ-¹¥˜¡QQòì–U ïý¤,÷B-#ž¤—Q.GP6,—G+¢8!f`+KO4-b¤lÜTðF`oœ³.©+GúóùÏBÑSüAz–gwìV‚}_öÃÀ«)¦åøI4õ/[uÚÚÞ6(O—(éŸ-™Ðâ$BK³ æiÐeý`9³à»E?à~Â&)ólA±8½ÓÕѶu©Ÿjí/…x¤Í“ô‚¶‰Ê6‚ØË&¤ J’B®›£1Ô:¬‡F!ƒB܃{Mhôt¸s¶ky;O1ÞÛÍ8¹ŒÝ :yQàQÎÛhÔNrm܉Ôl,'×6D ‘µ @Ë UÊhÂ0™qM… nèÆÒS¾ÂÑ“tÕàåÚ©8Ò}–ouUõ îó ¾Ø7íí·8ÔFÓõ0¹~ã“-]6â¹hû˜Ç$i:ÊG÷˜Sª™S§­e{æ¼àÿ"*ÁiX€¹O=Lß”qN’‡£;êqPfH£¢÷Fh3ͪ~%œ®›£~¦Å¹x7˜éíè›XÞŸÓÕd=ºÅ`Þ\✙Èwk•/nnÄåýâKÎÑdéªÙ(O×WWךܩî×åsþ mûŠ£ç€ÏÒ¶ÒÜ/æ´¼y¼#ÈK*¢ô1´Ý>в§˜‚‹ï˧U±(Dv;&Ù‚J×€^%þȲìÏxw_üöm±Z/ž–c,0²ýn/ €¤6j£cGÇ.w$qÇ@k¹ÚÀ ©øÍ»½òkõÅÚKj³ò.ºÒšÎ×ëÕŒPàAùŒng·ƒäñ}ˆÈ¸¢l½W6rÊxê‰o­Õ¸; ‰E}ʰñ+ >CµO¾U·x«\Ù6”Q;K­­”g}v1î?ç¹q¥4;bÞ¤ä"Kb=% ±£35¥ß&0*ÑÄêmÓÆ‘fí¸&Pù ¬èã ´·ÇÚ·âC=ˆîCÝ^ô->ª¤‚r§(¯zÈ5 90á¶:jiô_êd ržŽ:îÈÎW!eI¨µ©«"ôã®l¥>Oeœ¬Ä£|ù‡^Éj˜m‡¦€‰­õ¶õ½Ðµ6¸2Ýtøl+ú®hþ¼Ao­4ã ½;³ãìLÛ ŠERhQ«ïFµONéó'ü» 3;šÓ¨öæ6:ð<Á²Œú Fˆ½w¥ ‰·n0<ñ¨–MÖ8¯Ïjú$´›þÒä=]ªT”¨¾_Øá¶µóMÒæ}üÿUraÃ9ÊdŠ•‚¡UEí#8»5üWÎËìlO‡š›2'7ØJ\FïõåÓú¾ß1‡è+×\9û!’U¸‰.µAï–ÿ߃ƒc‰AKך ˜©˜4üÉ‘<법ô=/¿#É7zÑš~œ‰Á×ÍËã>ÔI€úÿµè&w†” ]¢Tõª7F Ô±+"ßú¤^e³7¬ {°¯÷4JNˈßáÇ™=ˆ%B¢jhã\ij±5Ð:*¡Zd ËT±‰è£í Cž˜'d^'¹ŠeîËë¬ÊE¥½*£ƒ­Ï(ö¹}þúf­£œÄyË–ÎQ­Ž¤¼Ç½¶åߪ! Ìâm°š’âA©èW¸rÓeBܤýúL†œ•êEHµœ %M?ÍDí]3nT§.†yªœ l™$…JV‹»KÞ$ÛèØ÷e²w(úrõF‚}Γ$g åŽàã$“+±Â^øgO²ëeú²x€‡yÈÒçàŸŸ`uÕoÊÄfçLÕÙ0ë„ÏYñHSž‰w?7çÔ#€u“„ŠÉ:0&ÚöÓ| ,{v“âþžnЧÉÏ’þ:{kú¿‰ ½’nanoweb_2.2.9/docs/man/man8/nanoweb.php.8.gz0000644000000000000000000000246711023557654017253 0ustar rootroot‹°áN>nanoweb.php.8}VÛŽÛ6}çWLõ²6°ö¦- ò‹Ûu‘µ]Û[ È-Ñ6»©åÅŽûõ=CI޲u ‹˜Μ™9sF㇌Â^{Â?kÙ-~*2ÒØ£ÚP% Õr§¼Ãp€Ÿ'ÜKóè)Ød‰#6 ½=ûÃíÄx}Ûy×ûš^Rö»4QºýôâÅÏeïÕFÃõo³û›ÚÄ/8º÷ÊÑ›•.V·4{s7}?#šµÀnOµrkõ%ÐÚIã·x»p6ØÜ–Gå’‹Õ_³ùb5]‰ñÛ>"ñQŒ§tS˰¿ ö¦»É­ÙŠOô‘­Gûóÿ⓸ààí”F9et£BÞ¹øÆUÖz€…ÝU¡Êƒ>¨×YFuÕ»—ß¹OI¼Ÿ¬Þ-§‹õt>]þh—$dy¢m©¾èM©þ·$ƒÛõz1l+s-Ž{ïÙÇ6–å‰tU—ªR&¨‚´á¶Õ’¸äƒ‡ÂçN×A›•Òì"w[š‚r[) (-.Ž:ìh ü‚C@¡Œ×ÖPe‹X*?bj|P²àkmö‘ö»Û¤8'Éïm,9¼È$]êð$!ãg0¥ÁË¡w*ä¢!éÉ cXªË ƒrFrm[ÿyrÿwôdQ ôQÍ–ÕÚð¸õEí…ȇEŠËÖ»èàin5:€Ç{yPŒEÆ`+\å’ HŽ‹ CmP7NÝ©§¨|@e¸ÇóÔ^ðt½HŒÈF9f‚¾¡eÛåõÔ5Ñ_ãì[Æ­y–ƒ*Kžá¦Ù—áF¯^‘Þ¶-Ÿë@¥£åB0Aˆç$(²‚ŸFuA/yº”ÜØ sàûÎs”„õ¸±¹=µ?‘,zQ¥®5Â4™ý9]Îgw“Ùú¼|JíYÞ9eÚYÃÓ-K°Öi†Áß½4¬ÊÚôª9öi”*’–oNmº`òpÓ~©­ Ý8´bÉÂÔ:hy®”™·CJ®jÅR¡âÕ•fš C^³‘‡–å¼ÁRóY8$Kà&U·¡>oŠ’%ƒ·hÉ6¼”6§VÿÇ®ò¨´ƒ[öå²NMèJÜ„&ûf‰ñ´Æœ×åÑÉðûc8MÖï>/'wóõäáót‘‰®&—Kñìiûòób¾\g‚í×ïM)[?©«oï[aj#o§k2¬z¯†éæ×é‡Iú\úîgM2ËV“ ½ù°šgÏ2º4øeøly^(å¥öõ¿BþÔZúª nanoweb_2.2.9/docs/man/man8/in.nanoweb.8.gz0000644000000000000000000000123111023557654017056 0ustar rootroot‹ò3ê=in.nanoweb.8mSKOã0¾ûWÌöÔJl`‘VâÊ£»T‚RÑpãâÆÓÆKbgm§¥ÿ~¿IR(ÕJ¹$ÏIö:¢TÚHx¼còk¼29íüŽWTkGÞpTÇxÝã\»·HÉw“ø$Tú]òß&2§²üž¬Ë W4šû-×+tyqq9¢Ñ¯, Ï_άkßñé%âøQ»VWË{š_?NÕÎëw r2T{ô ºip%Á6‰Ö>мì.ßM—·Ï³E>{š«ìæHŽ‚ÓÐ:Z_w¬K€K±Tlj4×ÞáæóÀ9¾š¨]ÉŽåTSà¿-DŽ̨ñ!ÑÕ…$h8q‘Ød4K‚í(&R¤¶ÁÂ7û!`5H¥û=8s~O”íâà‹à“/|EƒÄMŃÚÂ×Öm 2ÕÛƒFÕè9vc¾TCÑopVxç ÌB­ŽÐd¬ëûƒæ¯9f}òOùt©^"º¨¤pL±ômeHWµÙÓŠá¨/¸?cÊÀ´¦ñOÉÊ%%®ªø)œý1ï4ÒÞ·X¤=ýii©·,êZqZ³KdÅåµ1Vˆ¤“F% dI¡céaªk¦ñ‰úè9M›l±ÐÅ›¬,8¤°P‹ ™˜-AS~»èKÕÆ5~¬Š2—øKÓ™¤yh²hC€XäUhç|ú‚-?XŠ\!Ó ³ªlm“CñðÓõeEÂ6°‹R–ÔZ±Õ”Mg§¯ITÚmZø˜ôýš= ³,_H8眊óÏFT. Ö;„פ­ë·¤ë¯o ¢‰^aDcS¶4(;‰ºõucÏ?ZN§tý°|ü5ÿYù4 f±aì´»cãÿzêûªnanoweb_2.2.9/docs/man/man8/nanoweb.8.gz0000644000000000000000000000006411023557654016454 0ustar rootroot‹"è=nanoweb.8Ó+ÎWÈM̳ÐÏKÌË/OMÒ+È(гÍÛ¨”nanoweb_2.2.9/docs/manual/0000755000000000000000000000000011023557654014152 5ustar rootrootnanoweb_2.2.9/docs/manual/apachecompat.html0000644000000000000000000000567611023557654017503 0ustar rootroot keeping .htaccess files from apache
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    keeping apaches .htaccess files Features

    NANOWEB uses a different configuration file layout (ini style) than apache (markup style) does; also most of the directives names differ.
    This is no problem if you start with nanoweb or if you're going to switch to nanoweb fully. However, when you need or want to switch between these two webservers you need to take care, because apache throws an HTTP error 500 on any directive found in one of the per-directory configuration files if it doesn't know it. Nanoweb in contrast just ignores any directive it doesn't know; so from it's point there is no problem at all.

    However, as nanoweb per default looks for configuration directives in .nwaccess and apache reads .htaccess instead there's no problem for the two different servers if you just place two versions in every directory.

    As there exists a few configuration directives in nanoweb that were designed for compatibility with existing .htaccess files from apache (mod_rewrite for example), you may wish nanoweb to read .htaccess files (AccessFile directive) and don't want to keep two concurrent versions up to date.
    The solution to this problem is to prevent apache from reading configuration directives it doesn't understand:
    # following directives are understood by apache and nanoweb:
    
    DirectoryIndex  index.php index.pdf index.html
    LanguagePriority ep en de fr es
    
    RewriteRule ^file(.+)$ newpath/newfile$1  [NC]
    
    
    # this is apache-specific and thus ignored by nanoweb
    
    AddHandler cgi-script .bat
    
    
    # apache will ignore everything in between following "tags",
    # while nanoweb still notices it
    <IfModule nanoweb>
    
      # nanoweb version of AddHandler
      ParseExt = .bat CGI C:\WINDOWS\COMMAND.COM $FILENAME
    
      # multi-purpose http communication enhancement
      AddHeader = X-Powered-by: beer
    
      # and all others...
      AllowExtSymLinks = 1
      FbSortOrder = name
    
    </IfModule>
    
    
    (sample .htaccess file)



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/authentication.html0000644000000000000000000001314511023557654020063 0ustar rootroot HTTP Authentication in NANOWEB
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    HTTP Authentication

    The authentication feature is part of the hypertext transport protocol (HTTP), and allows to restrict access to specified directories or complete areas with login names and passwords.
    NANOWEB allows this very flexible, again due to its modular structure. Currently there exist 9 extensions modules for HTTP authentication:
    mod_auth_simple SIMPLE User names and passwords are kept in one of the configuration files.
    mod_auth_htpasswd HTPASSWD Authentication files from the apache webserver can be used with this module.
    mod_auth_nwauth NWAUTH Nanoweb authentication files are much like the apache ones.
    mod_auth_mysql MYSQL This module expects login/password pairs to be listed in a MySQL database.
    mod_auth_pgsql PGSQL PostgreSQL database authentication.
    mod_auth_ldap LDAP Authentication data from LDAP.
    mod_auth_anydb ANYDB Any database supported by either PEAR::DB, ADOdb or PHP_dbx can be used for authentication.
    mod_auth_anonymous ANONYMOUS Anonymous login (like with FTP).
    mod_auth_subversion SUBVERSION Subversion repository authentication.

    In order to use them, you have of course to load them into the server (using the LoadModule directive). You can load all authentication modules together, as authentication can be activated with one of them on a per-directory basis (in .nwaccess files), for example:

    AuthRealm = Info: Directory password required!
    AuthRequire = SIMPLE
    
    AuthSimpleUserPass = ... 


    In this example config file the »SIMPLE« authentication scheme (from mod_auth_simple) is used. But for another directory you could use a apache password file with "AuthRequire=HTPASSWD".

    # two methods combined => logical OR
    AuthRequire = SIMPLE
    AuthRequire = MYSQL
    

    If you combine two AuthRequire directives in one configuration file (.nwaccess) like in the above example, the user will be granted access if its login name and password are verified by one of the authentication modules (logical OR). This way you could specify system-wide authentication data for a few people only with mod_auth_simple and grant thousands of other users access via mod_auth_mysql where required.

    # Require auth only for some locations
    AuthRequire = SIMPLE
    AuthLocation = /admin/
    AuthLocation = /site/admin.php
    

    Using the AuthLocation in the global, virtualhost, or access file will restrict the need for authentication to the specified locations.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/core.html0000644000000000000000000027276011023557654016006 0ustar rootroot Nanoweb Configuration Directives
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Nanoweb Configuration Directives

    The nanoweb configuration files reside in /etc/nanoweb/ and the following configuration directives can currently be used in the main server configuration file /etc/nanoweb/nanoweb.conf but often also in per-directory configuration files (.nwaccess):
    Starting from nanoweb 1.8.1 you may write all directives in apache style without the equal sign in between a directives` name and its value.



    AccessFile directive
    Syntax: AccessFile = .nwaccess
    Context: Server Config, Virtual Hosts
    Module: Core

    Specifies the filename of the per-directory config files to be read. This is .nwaccess per default, but you may want to set it to .htaccess so nanoweb takes the files you previously used with apache.




    AccessBlock directive
    Syntax: AccessBlock = this_directive
    Context: Server Config, Virtual Hosts
    Module: Core

    Use this directive to disallow overriding of configuration settings made in the main configuration files for just the given directive, regardless of what the default behaviour given in AccessPolicy is.




    AccessMerge directive
    Syntax: AccessMerge = directive-name
    Context: Server Config, Virtual Hosts
    Module: Core

    Use this directive to allow settings from the main configuration file to get merged with the ones found in .nwaccess files for the directive named here, regardless of the default behaviour given by AccessPolicy.




    AccessOverride directive
    Syntax: AccessOverride = name_of_a_directive
    Context: Server Config, Virtual Hosts
    Module: Core

    This enables overriding of settings made in the main configuration files with the ones found in .nwaccess files for the directive name given here, regardless of the default behaviour given with AccessPolicy.




    AccessPolicy directive
    Syntax: AccessPolicy = block | override | merge
    Context: Server Config, Virtual Hosts
    Module: Core

    Defines the default access files policy regarding overriding of configuration values from higher level configuration files (for example .nwaccess file in another directory). You can override the default behaviour defined here for some directives using AccessMerge, AccessBlock or AccessOverride.
    block means that, configuration values cannot be overriden by settings in a .nwaccess file. Setting override here allows that per default. merge defines that settings from the main configuration files are merged with the ones found in .nwaccess files.




    Access_RBL directive
    Syntax: Access_RBL = dns | web
    Context: Server Config
    Module: mod_access_rbl

    Gives the prefered RBL query method. The default "dns" is much faster than the http access method "web".
    See also mail-abuse.org/rbl for further informations on the RBL system.
    Note: The maps service is free for personal usage only; but you can easily edit this nanoweb modules` code to use another one if desired.




    ACPolicy directive
    Syntax: ACPolicy = allow | deny
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, mod_ac

    This directive sets the default access control policy. For public webservers you may wish to leave this value to allow, for intranet systems however deny is recommended.
    The default behaviour can be tweaked for individual hosts using ACAllowIP, ACAllowHost, ACDenyIP and ACDenyHost.




    ACAllowIP directive

    ACAllowHost directive
    Syntax: ACAllowIP = 192.168.*
          ACAllowHost = *.example.net
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, mod_ac

    These directives effectively allow the specified hosts to access files from your webserver. You may give complete IP addresses and host names for a single host here as well.




    ACBlockError directive
    Syntax: ACBlockError = 403
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, mod_ac

    Defines the response code for hosts which you denied access to the server.




    ACBlockMessage directive
    Syntax: ACBlockMessage = You won't get access! Go away!
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, mod_ac

    You can also set an individual greeting for hosts that have no permission to access the server.




    ACDenyIP directive

    ACDenyHost directive
    Syntax: ACDenyIP = 54.7.*
          ACAllowHost = *.microsoft.com
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, mod_ac

    Using this directives you can deny the specified hosts access to files from your webserver, even if the default access control policy was set to 'allow'.




    AddHeader directive
    Syntax: AddHeader = X-HTTP-Header: value
    Context: Server Config, Virtual Hosts
    Module: Core

    You can append additional headers to the HTTP responses nanoweb sends back to the client (browser). This is a very powerful feature if you know the headers recognized by special http clients (or you've written one of your own).
    A good example is the "P3P:" http header, which states the privacy policy of your site. A funny example mentioned in the distributed main server config file is "X-Powered-by: beer", you can do this because current browsers ignore all unknown headers.




    AddServerVar directive
    Syntax: AddServerVar = CGIENVVAR value
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    Using the AddServerVar directive you can pass arbitrary environmental variables to any executed CGI program. You may also overwrite one of the default server vars with any static value you would like to (so you can fault any CGI, for example let it assume a different webserver or tell it a false request uri).
    Don't use an equal sign between the variable name (uppercase letters are recommended) and its new value! You may use this directive in .nwaccess files, too, of course.




    AddType directive
    Syntax: AddType = .ext mime/type
    Context: Server Config
    Module: Core

    This directive allows you to add a mime type for an extension on the fly without modifying your systems` mime.types file, it can however be used in the main server configuration file only.




    Alias directive
    Syntax: Alias = /virtual/ /real/path/
    Context: Server Config, Virtual Hosts
    Module: Core

    Declares an alias directory name to an existing path of the real filesystem. This directive can be used to get access to a directory from within any virtual host, as in the rewriting process the docroot gets changed.
    This directive is used by mod_fb for example, to always keep the /icons/ directory reachable.




    AllowExtSymlinks (obsolete)
    Syntax: AllowExtSymlinks = 1
    Replaced-By:

    The newer AllowSymlinkTo directive allows now much finer grained configuration of which symlinks are allowes within the docroot.




    AllowSymlinkTo directive
    Syntax: AllowSymlinkTo = /usr/lib/nanoweb
    Context: Server Config, Virtual Hosts
    Module: Core

    Nanoweb will generelly reject symlinks to outside of the DocumentRoot for security reasons. Using this directive you can give destination paths where symlinks are however allowed to (the directive can be given multiple times).
    If you just set it to the root directory /  symlinks will always be allowed.




    AllowPathInfo directive
    Syntax: AllowPathInfo = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    Any CGI may be called with a »pathinfo« appended to its filename (think of http://www.example.com/cgi-bin/program.php/arg1/arg2), which is treaten by many CGI interpreters as additional data input beside the »query string«.



    Syntax: AnydbLoadInterface = .../adodb/adodb.inc.php
    Context: Server Config
    Module: mod_auth_anydb

    You must specify this directive before the LoadModule directive for mod_auth_anydb, if you want to use the ADOdb or the PEAR::DB database abstraction layer.




    AuthAnydb directive
    Syntax: AuthAnydb = dbtype://user:password@server/dbname/table
        AuthAnydbLoginColumn = login_field_name
        AuthAnydbPasswordColumn = password_field_name
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_anydb

    With the ANYDB authentication method you can allow access to a restricted area using the auth data (login/user names and passwords) from any PEAR::DB, dbx or ADOdb supported database.
    The syntax for this directive is often called "dsn" (data source name), but additonally contains the name of the database table with the login names and passwords. The dbtype part tells which RDBMS you use, but the value depends highly on the database abstraction layer you choose (PEAR, ADO, dbx).



    Syntax: AuthAnonymousNames = anonymous anonym guest nobody
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_anonymous

    The ANONYMOUS authentication method allows to login suppling a email address as password for either "anonymous" or any other symbolic user name specified with this directive. You can give additonal names in one line or within multiple directive lines.



    Syntax: AuthAnonymousSmtpCheck = 0
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_anonymous

    The email address given as password for ANONYMOUS http authentication logins can be verified, and if the quick SMTP check fails, the mail address is rejected and cannot be used to access the restricted area.




    AuthFile (obsolete)
    Syntax: AuthFile = .nwauth

    This directive was used until 1.9.0, and is called AuthNwauthFilename now and used by mod_auth_nwauth.



    Syntax: AuthHtpasswdFilename = /path/to/.htpasswd
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_htpasswd

    With the HTPASSWD authentication method you can reuse the password files from the apache webserver, these are often called .htpasswd




    AuthLocation directive
    Syntax: AuthLocation = /path/to/protect
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    Using the AuthLocation in the global, virtualhost, or access file will restrict the need for authentication to the specified locations.



    Syntax: AuthNwauthFilename = /path/to/.nwauth
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_nwauth

    You can give just ".nwauth" to this directive to activate the authentication with "AuthRequire=NWAUTH" from a directories .nwaccess



    Syntax:
        AuthMysqlHost = localhost
        AuthMysqlUser = db_user
        AuthMysqlPass = db_pass
        AuthMysqlDB = db_name
        AuthMysqlTable = table_name
        AuthMysqlLoginColumn = login_field_name
        AuthMysqlPassColumn = password_field_name
        AuthMysqlPassType = plain | crypt | md5 | mysql
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_mysql

    These directives specify the mysql database + server, the database table and the columns which hold the user names and passwords to check for when using the MYSQL authentication method. The PassType setting tells if the password is saved unencoded in the table (plain) or using one of the system password hash algortithms (crypt, md5) or the according MySQL function (mysql).



    Syntax:
        AuthPgsqlHost = localhost
        AuthPgsqlUser = db_user
        AuthPgsqlPass = db_pass
        AuthPgsqlDB = db_name
        AuthPgsqlTable = table_name
        AuthPgsqlLoginColumn = login_field_name
        AuthPgsqlPassColumn = password_field_name
        AuthPgsqlPassType = plain | md5
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_pgsql

    Use these directives to give the name of the database of the PostgreSQL server with the column names which hold the user names and passwords to check for when using the PGSQL authentication method shall be used (see AuthRequire). The PassType setting tells if the password is saved as plain text in the table or was encoded using md5()



    Syntax: AuthSimpleUserPass = login password
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_auth_simple

    The SIMPLE authentication method allows you to specify the login and password pairs directly in the config file (.nwaccess most often, but may be also in one of the vhost sections to restrict access to the whole server).
    You need to give one directive with space seperated login name and password for each user, most often in the same config file where you activated the authentication (with AuthRequire).




    AuthRealm directive
    Syntax: AuthRealm = realm name
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, Authentication

    This directive is to be used to give the different authentication areas (most often single directories or directory trees) a name, to help users to remember the correct login and password to be granted access.
    Most often this is shown as info text in common browsers, so you may want to give a notice or a greeting message here.




    AuthRequire directive
    Syntax: AuthRequire = METHOD
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core, Authentication

    The different modules give you different choices on where to keep the authentication passwords and login names, so you need to specify which auth module to use for the current directory (or server if you want to restrict one of your vhosts at whole).
    Currently there a 6 different auth modules (have a look into the modules section), and thus you can specify SIMPLE, HTPASSWD, NWAUTH or the MYSQL, PGSQL, LDAP authentication method/module here.

    The AuthRequire is the directive out of the bunch of authentication directives that really triggers if the access to a directory is restricted, so you may specify all your passwords (say with AuthSimpleUserPass directives) in the main server configuration file but activate it occassionally in the .nwaccess files of some directories only.
    You can enable more than one authentication method by using this directive two or more times in one of your .nwaccess files. This leads to a logical OR, which means that the users login name and password needs to be verified by one of the authentication modules only to grant him or her access.




    Bandwidth directive
    Syntax: Bandwidth = 100K/s
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_throttle

    Limits the average download throughput to the given fixed amount for the server area it was specified ([global], [vhost] or a single directory via .htaccess).
    As the module only estimates the transfer size for every second, so the "/s" is optional (because the time slices cannot be influenced). You can however give the speed amount in bytes or in kilobytes (with an appended "K").




    BSPAllowSource directive
    Syntax: BSPAllowSource = 1
    Context: Server Config
    Module: mod_bsp

    Allows to view the source of .bsp scripts when ?source is appended to the requested url.



    Syntax: CGIFilterPathInfo = 1
    Context: Server Config
    Module: mod_cgi

    If you plan to use the CGI version of PHP you may want to leave this directive enabled, as there still is a unfixed bug in PHP-CGI that forbids passing the $PATH_INFO server var to the scripts as this would trash the $PHP_SELF var. If you don't use the latter one in your scripts you otherwise should probably disable this option, and use the more reliable $SCRIPT_NAME in favour of $PHP_SELF.




    CGIScriptsDir directive
    Syntax: CGIScriptsDir = /var/lib/cgi-bin
    Context: Server Config
    Module: mod_cgi

    This directive tells nanoweb, that the specified directory contains CGI scripts only. It is very common to have at least one such directory, which is often called /cgi-bin/ (and accessible with this name by using the Alias directive).
    If you do not want to have just one seperate directory for all your CGIs, you may set this directive to / to allow files located anywhere on your server to be treated as CGIs if they have the executable flag set.




    CGIScriptNoExec directive
    Syntax: CGIScriptNoExec = error | raw
    Context: Server Config
    Module: mod_cgi

    If a file in a CGIScriptsDir is accessed which is not marked executable, this directive tells nanoweb how to treat this. The value »error« leads to an error response message if a script without exec-bit is found, »raw« will deliver the according file as is (this is discouraged because of security reasons).




    CGIPHPOption directive
    Syntax: CGIPHPOption = phpini_setting="value"
    Context: Server Config
    Module: mod_cgi

    You may override php.ini directives on a per directory basis with this directive. Don't put any spaces in between the equal sign and the option name and its value. If the value contains spaces you have to enclose it in quotation marks. For settings that expect on/off in php.ini please use 0 and 1 only.
    This directive corresponds to apaches php_flag, php_option, ... directives.




    ChildLifeTime directive
    Syntax: ChildLifeTime = 21600
    Context: Server Config
    Module: Core

    The absolute maximum time (in seconds) a child process is allowed to live.




    ChildLifeTime directive
    Syntax: ContentMD5 = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_digest

    Enabling this will add the HTTP header Content-MD5: for static responses, which contains the md5() hash summary of the served file to allow the client to verify correct transmission.
    This requires the mod_digest extension module.




    ConfigDir directive
    Syntax: ConfigDir = /etc/nanoweb
    Context: Server Config
    Module: Core

    Sets the default directory to contain all Nanoweb configuration files. This allows you to leave it out for Include and LoadTheme directives.



    Syntax: DefaultContentType = text/plain
    Context: Server Config
    Module: Core

    When the server cannot determine a MIME-type by examining the extensions of the requested file, it will tell the client the file is of the type set with this directive. The default of text/plain may not always suit your requirements, so setting this value to text/html can do a better job in some cases.




    DefaultHandler directive
    Syntax: DefaultHandler = static
    Context: Server Config
    Module: Core

    Nanoweb feeds all files internally through an "parser"; you may specify one of them here (say CGI or SSI) if desired, but it is very rarely a good idea to feed standard static files through the PHP parser for example.




    DirectoryIndex directive
    Syntax: DirectoryIndex = index.html index.php /path/to/dirhandler.cgi
    Context: Server Config, Virtual Hosts
    Module: Core

    With this directive you may specify one or more files, which get sent in favour of a directory listing when found - this is very often called the »start file« and index.html per default. You can alternatively define the absolute path to a cgi script, which will then be activated to generate a directory listing (instead of Nanowebs mod_fb) if none of the other index files exists.
    The value of this directive may also be overriden finally in the per-directory configuration files (.nwaccess).
    You may want to set it to just "index" if you activated mod_multiviews, as this is more flexible.



    Syntax: DisableMimeMagic = 0
    Context: Server Config, Virtual Hosts
    Module: Core

    If nanoweb cannot determine the mime type from a files` extension then the PHP4.3 function mime_content_type() will be engaged to analyze the first 100 bytes of a file to guess the correct mime type. This directive can be used to disable this behaviour if you fear it slows down your server too much.
    If disabled Nanoweb will always report the DefaultContentType if a extension is unknown. You must set the according php.ini option if your mime-magic.data file is not located at its usual place.




    DocumentRoot directive
    Syntax: DocumentRoot = /var/www
    Context: Server Config, Virtual Hosts
    Module: Core

    Base directory path nanoweb will serve files from and where you should put all your html files and images into, as nanoweb doesn't allow to deliver files which are not located in there.
    This directive needs to be present in each virtual host configuration section.




    DosEvasiveError directive
    Syntax: DosEvasiveError = 403
    Context: Server Config, Virtual Hosts
    Module: mod_dosevasive

    Sets the http response code for »Denial of Service« attacks.



    Syntax: DosEvasiveMaxReqs = 5
    Context: Server Config, Virtual Hosts
    Module: mod_dosevasive

    The maximal number of requests one host may make in the time slice specified with DosEvasiveTimer before it is considered to be an attack.




    DosEvasiveTimer directive
    Syntax: DosEvasiveTimer = 10
    Context: Server Config, Virtual Hosts
    Module: mod_dosevasive

    Gives a delay in seconds that is used to detect denial of service attacks.




    ErrorDocument directive
    Syntax: ErrorDocument = CODE errorNNN.html
    Context: Server Config, Virtual Hosts
    Module: Core

    Defines files which get send on errors instead of the default (built-in) nanoweb messages. These documents must reside in the docroot.




    ErrorHeader directive
    Syntax: ErrorHeader = CODE HTTP-header: value
    Context: Server Config, Virtual Hosts
    Module: Core

    You can attach additional HTTP headers to responses with an error code above 400; see also AddHeader.



    Syntax: FallBackPriority = smallest | largest | newest | oldest
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_multiviews

    If the mime qualities of all available file variants are equal, then mod_multiviews can at least select the smallest, largest, newest or the oldest file out of them.




    FBDescFile directive
    Syntax: FBDescFile = .desc
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb

    Descriptions of each file in a directory may be given in the file specified here, its content is used to enhance the output of directory listings produced by the file browser module.
    Such a description file should look like that:

    filename.ext   desc of this file
    index.html  main/homepage...




    FBIconByType directive
    Syntax: FBIconByType = /icons/image.gif mime/type
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb, mod_fb2

    Associates icons pictures to mime types for output in directory listings produced by mod_fb.
    You may specify partial mime-types only; so you can associtate fall-back icons for general mime types like »application«, »text« or »image«.
    The default configuration of nanoweb also utilizes the Alias directive to keep all icons in a single directory (/icons/ which is rewritten to absolute real path /var/www/icons/) accessible from all the virtual hosts.




    FBIconDefault directive
    Syntax: FBIconDefault = /icons/misc.gif
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb, mod_fb2

    If none of the FBIconByType directives defines an appropriate icon for a file (or if a files mime type is unknown) this directive gives the name of the image to be used.




    FBIconDirectory directive
    Syntax: FBIconDirectory = /icons/directory.gif
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb, mod_fb2

    Defines the icon to be printed for directories.




    FBShowDotFiles directive
    Syntax: FBShowDotFiles = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb, mod_fb2

    This tells mod_fb to include files which names start with a dot to be included in directory listings. On UNIX machines these »dotfiles« should be treaten as invisible files by standard programs; and because nanoweb keeps some of its per-directory configurations in .nwaccess and .nwauth you probably want to set this directive to the default of 1.




    FBSortOrder directive
    Syntax: FBSortOrder = name | size | date [ desc ]
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb, mod_fb2

    Directory listings are sorted by mod_fb according to this setting (»name« is the default). The use of »desc« reverses the order.




    FBTemplateFooter (obsolete)
    Syntax: FBTemplateFooter = .fbfooter

    Dropped in favour of ServerThemes.




    FBTemplateHeader (obsolete)
    Syntax: FBTemplateHeader = .fbheader

    Removed in favour of ServerThemes.




    FBWelcomeFile directive
    Syntax: FBWelcomeFile = .welcome
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_fb

    Whenever a directory listing (»filebrowser«) is to be sent back to the client, the server searches for a file with the hereby given name to be included in the sent output.



    Syntax: FCGIFilterPathInfo = 1
    Context: Server Config
    Module: Core, mod_fcgi

    See CGIFilterPathInfo on informations about this directive. The name of this directive was renamed from FastCGIFilterPathInfo in 2.1.0 to normalize its name with all the other ones.




    FCGINoHeader directive
    Syntax: FCGINoHeader = Powered-By
    Context: Server Config
    Module: mod_fcgi

    Strips the given header from the output of a CGI.




    FileBrowser directive
    Syntax: FileBrowser = 1
    Context: Server Config, Virtual Hosts
    Module: mod_fb, mod_fb2
    Compatibility: separated out from the core server in 1.8-dev

    Is to activate / disactivate the automatic generation of directory listings by the server.




    FilterEnable directive
    Syntax: FilterEnable = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_pfilters

    This directive can be used to deactivate all filter rules on a per directory basis (in .nwaccess files).




    Filter directive
    Syntax: Filter = mime/type filtername [args]
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_pfilters

    Sets a filter rule which is applied to all files matching the mime pattern (most often text/html, but may be just */*).
    The second argument to this directive is the name of one of the internal filters which you may pass additional arguments.
    The most powerful filter is 'pipe' which passes the current content through an external filter program given as argument to it ("/usr/bin/tidy" for example). The 'unchunk' filter is very often required to be listed before the first 'pipe'. Other filters are currently 'null', 'shrink', 'downcase' and 'wap' (you need to load »mod_html_filters« to make them available).




    ForceHandler directive
    Syntax: ForceHandler = PARSER
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    This directive is to be used in .nwaccess files to enforce one of the nanoweb parsers (like CGI, static or SSI) to handle all files. So if you want to ensure, that none of the files in a directory is activated as CGI script, you could put the line "ForceHandler=static" into the .nwaccess file.




    Group directive
    Syntax: Group = groupid
    Context: Server Config
    Module: Core

    Default group nanoweb will run as (defaults to »www-data«).




    GzipEnable directive
    Syntax: GzipEnable = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_gzip

    This directive allows you to enable/disable mod_gzip for each virtual host or different directories (in .nwaccass files).
    Chunked CGI output will not get compressed as this often leads to poor results and is not supported by some browsers. You can however enforce compression of such content streams by setting this directive to 2 - A much better solution is however to apply the "unchunk" Filter, which will help mod_gzip. For PHP scripts you may wish to enable automagic output compression via php.ini rather.




    GzipLevel directive
    Syntax: GzipLevel = 5
    Context: Server Config
    Module: mod_gzip

    This options tells mod_gzip how much time to spend on compression. A value of 1 leads to very fast processing, 9 means maximum compression, which is of course very time consuming. So you probably want to have some value in between to achieve good compression in a justifiable amount of time.
    BTW, 0 means no compression, but this is stupid; see the above configuration directive for this.




    GzipMaxRatio directive
    Syntax: GzipMaxRatio = 90
    Context: Server Config
    Module: mod_gzip

    Max compression ratio (percentage of original size). If it is higher, the content is likely to be already compressed and does not need a recompression.




    HostnameLookups directive
    Syntax: HostnameLookups = 1
    Context: Server Config
    Module: Core

    Use reverse-DNS to put hostnames instead of IP addresses into server log.
    Note that using DNS slows down nanoweb a bit, so if you need some more speed you should think about disabling this feature, as you can get the names of the hosts which requested pages from your server later too by evaluating the server logs with appropriate software.



    Syntax: HostnameLookupsBy = server | logger
    Context: Server Config
    Module: Core

    Using the value "logger" in this directive tells nanoweb to delay DNS lookups and let these be done by the logger processes after the page already has been delivered. This is a speed improvement, because there is actually no need to do the slow DNS query for the requesting host in the main server; some modules may however depend on it, so you can set this directive to "server" for the old behaviour.




    IgnoreDotFiles directive
    Syntax: IgnoreDotFiles = 1
    Context: Server Config, Virtual hosts, .nwaccess
    Module: Core

    Setting this directive to 1 will make nanoweb ignore .xxx files. This is for security reasons (not allowing clients to request .nwaccess or .nwauth files for example). You shouldn't change this unless you know exactly what you're doing.




    Include directive
    Syntax: Include = /path/to/file.conf
    Context: Server Config
    Module: Core

    This directive reads another (swapped out) configuration file into the current one. In standard installations the main configuration file is /etc/nanoweb/nanoweb.conf which additionally loads modules.conf and vhosts.conf using this directive.




    KeepAlive directive
    Syntax: KeepAlive = 25
    Context: Server Config
    Module: Core

    Maximum number of http requests per connection (A client may get more than one file after it opened a connection to nanoweb, to speed up downloading of multiple files). To disable the keep-alive feature of nanoweb just set this value to 0.


    Syntax: LanguagePriority = en fr de
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_multiviews

    Content-negotiation occurs if the requested file does not exist, but some variants can be found instead. If the client doesn't specifies a preferred language this setting will come into use.




    ListenInterface directive
    Syntax: ListenInterface = 127.0.0.1
    Context: Server Config
    Module: Core

    Specify the IP address the server shall listen to for incoming connections.




    ListenPort directive
    Syntax: ListenPort = 80
    Context: Server Config
    Module: Core

    Specify the TCP port number the server shall listen on for incoming connections. 80 is the default for web servers, but 8080 is also very common and you must use this to run nanoweb if you're not root (as ports below 1024 are reserved for system daemons).
    Starting with version 2.0 you can make Nanoweb listen on more than one TCP port, if you give this directive multiple times:

    ListenPort = 80
    ListenPort = 8080
    ListenPort = 12080
    




    ListenQueue directive
    Syntax: ListenQueue = 20
    Context: Server Config
    Module: Core

    Maximum number of queued connections.




    LoadLimit directive
    Syntax: LoadLimit = 25.0
    Context: Server Config
    Module: mod_load_limit

    Defines the maximum load average after which the server will return an error and won't serve documents until load goes down.




    LoadLimitAction directive
    Syntax: LoadLimitAction = error | redir
    Context: Server Config
    Module: mod_load_limit

    Per dafault nanoweb stops serving any further requests if the load limit is reached, but instead of just sending an error message response nanoweb is also able to redirect the request to another server (and thus probably all further queries from the requesting client).




    LoadLimitError directive
    Syntax: LoadLimitError = 503
    Context: Server Config
    Module: mod_load_limit

    This directive sets the http response code for error messages that are send back when the the server load gets too high. (rarely needed)



    Syntax: LoadLimitErrorMessage = Sorry, our server gets too slow...
    Context: Server Config
    Module: mod_load_limit

    Defines a custom error message that is send if your server gets too slow. Besides the common nanoweb server vars, you can use %CUR_LOAD and %MAX_LOAD in the message text.



    Syntax: LoadLimitRedirect = http://www2.example.com/%REQUEST_URI
    Context: Server Config
    Module: mod_load_limit

    If enabled with the LoadLimitAction directive, clients are redirected to the server given by this directive as soon as the load limit is reached.
    Please note that %DOCUMENT_ROOT may be useful together with %REQUEST_URI if your fallback server holds backups of different sites.




    LoadModule directive
    Syntax: LoadModule = /usr/lib/nanoweb/modules/mod_fb.php
    Context: Server Config
    Module: Core

    This directive is usually found in /etc/nanoweb/modules.conf (or C:\nanoweb\modules.conf on Windows), which is included into the main server configuration file. It registers the specified module to the server core in the startup sequence of nanoweb.
    You don't need anymore to specify the full pathname of the PHP source file containing the module if you set ModulesDir accordingly.




    LoadTheme directive
    Syntax: LoadTheme = default.theme
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    Nanoweb supports themes to be applied to server generated response messages. This directive loads a template file on server startup, which then can be activated on a per-directory basis using the ServerTheme directive. You can give the full path to the theme file; but if you set the default configuration path using the ConfigDir directive you can leave that out, as theme files are usually located there, too.
    Theme files can be loaded from inside a .nwaccess configuration file, too.
    For more information about this, please see the manual section about Themes.




    Log directive
    Syntax: Log = /var/log/nanoweb/access.log
    Context: Server Config
    Module: Core

    Specifies the file where nanoweb notes all served requests. This file will contain one line for each requested file with informations on where the request origined, when it occoured, and if it succeded (file found) beside with some other notes.
    The format of this file is the same as with apache and often referred to as »common« or »combined« »log file format«, thus you can run some evalution program like "awstats" on it to generate a monthly traffic report for your site.
    You can leave out the absolute path name, if a default path is already set by LogDir.




    LogDir directive
    Syntax: LogDir = /var/log/nanoweb/
    Context: Server Config
    Module: Core

    Sets the default directory for log files (see Log and ServerLog), so you can give simple file names there.




    LoggerProcess directive
    Syntax: LoggerProcess = 2
    Context: Server Config
    Module: Core

    Logger Process support. If enabled, nanoweb will spawn logger processes at launch and all logging will be done by them. This can help if you are using User or Group directives or simply want more performance from the server. Set to the number of loggers you want, or 0 to disable.




    LoggerUser directive
    Syntax: LoggerUser = userid
    Context: Server Config
    Module: Core

    User the nanoweb loggers will run as.




    LoggerGroup directive
    Syntax: LoggerGroup = groupid
    Context: Server Config
    Module: Core

    Group the nanoweb loggers will run as.




    LogToConsole (deprecated)
    Syntax: LogToConsole = 1
    Module: mod_stdlog

    LogHitsToConsole replaced this directive.



    Syntax: LogHitsToConsole = 1
    Context: Server Config
    Module: mod_stdlog

    Logs every hit to standard output. Of course this requires you not to run nanoweb in daemon mode via nanoctl start, you need to run nanoweb.php from your vterminal/shell. Additionally the --quiet option given to nanoweb.php allows you to disable this on the fly (this is neccessary for inetd mode for example), so you don't need to change the configuration files.



    Syntax: LogHitsToServerLog = 1
    Context: Server Config
    Module: mod_stdlog

    Logs hits additionally to the standard server log, which normally wouldn't contain these (access.log used to contain hits).




    LogType directive
    Syntax: LogType = common | common-with-vhost | combined
    Context: Server Config
    Module: Core

    Sets the format used for log files (see Log) output. »common« is the NCSA Common Log Format (also known as »clf«), »common-with-vhost« is the same as CLF, but with support for multiple hosts, »combined« is the extended CLF format used by Apache, which also reports user agent and referer informations.



    Syntax: MaxRequestBodyLength = 1000000
    Context: Server Config
    Module: Core

    Limits the size of the request body (the content of POST and PUT request),



    Syntax: MaxRequestURILength = 512
    Context: Server Config
    Module: Core

    Sets the maximum length of the request URIs nanoweb will accept. Usually the size of URLs is already limited at client side (IE for example: 1024 characters) but for security reasons you may wish to trim it here.




    MaxServers directive
    Syntax: MaxServers = 25
    Context: Server Config
    Module: Core

    Limits the number of subservers (child processes) Nanoweb will create at maximum. A setting of 0 permits unlimited server processes.




    MetaFetch directive
    Syntax: MetaFetch = fast | regex | no | 0
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_meta

    This directive tells mod_meta how to fetch the http header fields given in the <META HTTP-EQUIV> tags in .html files. The default fast method is only suitable if your html files are very well formed, the regex method is often more reliable and fetches non-http meta information as well, but is therefor much slower. The no disables opening the .html files for scanning, so only the headers found in every files companion *.meta file are attached to http answers. mod_meta gets fully disabled only by setting this directive to 0.




    MethodHandler directive
    Syntax: MethodHandler = METHOD /cgi-bin/METHOD_handler.php
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_method_handler

    Defines a 'httpd user space' CGI script that handles HTTP requests with non-standard methods. The given script is called like a standard handler (as in mod_misc_filters) with the requested file given in $PATH_INFO. The path to the handler script must be absolute to the docroot.




    MispellAction directive
    Syntax: MispellAction = advice
    Context: Server Config (modules.conf)
    Module: mod_mispell

    The mispell module handles incorrectly entered URLs. If a file with the given name cannot be found on the server this module tries to figure out the correct name by checking the sounding of the filename against that of the files located on the server.
    This directives says what to do if it finds the correct name for the requested file. Default is »advice« which sends back an error page to the user, presenting him the corrected URL. You can also specify »redirect« which will send back a HTTP redirection response to the browser, so the users browser automagically re-requests with the corrected URL.




    MimeTypes directive
    Syntax: MimeTypes = /etc/mime.types
    Context: Server Config
    Module: Core

    Reads in the system-wide available MIME-types database from given file, and thus makes nanoweb recognize hundreds of typical file extensions.




    ModulesDir directive
    Syntax: ModulesDir = /usr/lib/nanoweb/modules/
    Context: Server Config
    Module: Core

    This directive specifies the default location of the nanoweb extension modules, so you don't need to give the full path name in LoadModule directives. You must append a slash to the directory name.
    You may give this directive multiple times, nanoweb will use the module it finds first in one of the given paths. Due to PHP's fopen wrapper mechanism you could also give a http:// address here to always have the most current module versions available - but this is still under devolopment (and would be mentioned in one of your configuration files then).




    MultiViews directive
    Syntax: MultiViews = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_multiviews

    This directive enables / disables mod_multiviews, so you can use the negotiation features only in directories you actually need them.




    MySQLLogHost directive
    Syntax: MySQLLogHost = localhost
    Context: Server Config (modules.conf)
    Module: mod_mysqllog

    The mysqllog module saves request hits to a database instead of saving it to files as mod_stdlog does. So you need to give a hostname here, where a MySQL database server runs on.



    Syntax: MySQLLogDatabase = databasename
    Context: Server Config (modules.conf)
    Module: mod_mysqllog

    Sets the name of the MySQL database for request logging.




    MySQLLogUser directive
    Syntax: MySQLLogUser = mysql_username
    Context: Server Config (modules.conf)
    Module: mod_mysqllog

    You need an account for access to a MySQL database server.



    Syntax: MySQLLogPassword = mysql_password
    Context: Server Config (modules.conf)
    Module: mod_mysqllog

    You need an account for access to a MySQL database server.




    OtherPriority directive
    Syntax: OtherPriority = php; qs=0.3, text/html; qs=0.2, image/*; q=0.1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_multiviews

    This gives additional preferences that will help mod_multiviews in selecting the "best" variant when the browser didn't send an Accept: header. Note that you can mix file extensions (without dot!) and mime types; quality-values help a lot.



    Syntax: ParseExt = extension TYPE [parameters]
    Context: Server Config
    Module: Core, mod_cgi, mod_fcgi

    Defines which script interpreter must be run to parse files with a given file extension.
    Valid parser TYPEs are defined by the modules you loaded and the parameters are type dependant. CGI is the most commonly used parser type and requires the absolute filename of the interpreter to execute. FCGI argument is the FastCGI server socket, while SSI never requires any parameter.
    See also the pages for mod_cgi mod_fcgi and mod_include and this example:

    ParseExt = php CGI /usr/local/bin/php
    ParseExt = awk CGI /usr/bin/awk $FILENAME
    ParseExt = js CGI /usr/bin/js $FILENAME




    PathInfoTryExt directive
    Syntax: PathInfoTryExt = php
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    This directive gives CGI extensions that should be checked for if a file with a pathinfo is requested but no file extension is there. You should use multiple PathInfoTryExt lines, one for each CGI extension you would like to leave out.
    See also AllowPathInfo




    PidFile directive
    Syntax: PidFile = /var/run/nanoweb.pid
    Context: Server Config
    Module: Core

    This directive gives a filename where nanoweb logs which pid (=process id, on Unix systems) it runs as.




    ProxyAccessLog directive
    Syntax: ProxyAccessLog = /var/log/nanoweb/proxy.log
    Context: Server Config
    Module: mod_proxy

    The proxy module generates an additonal seperate log file, as you probably don't want the main server log to be intermixed with request informations for files that are not located in your servers docroot.




    ProxyAllowIP directive
    Syntax: ProxyAllowIP = 168.192.
    Context: Server Config
    Module: mod_proxy

    Use this directive to allow hosts or all hosts from a network (with an abbreviated IP address range) to access the www via the nanoweb internal proxy server. Hosts not listed here cannot make use of the nanoweb proxy.




    ProxyCacheDir directive
    Syntax: ProxyCacheDir = /var/cache/nanoweb
    Context: Server Config
    Module: mod_proxy

    The proxy module of course needs a dedicated directory where it can save all the files that were requested in the past, so that they do not need to be fetched a second time from the real server if they get requested another time.



    Syntax: ProxyCacheMaxAge = 2592000
    Context: Server Config
    Module: mod_proxy

    Cached pages get invalid (need to be refetched) after an amount of time specified with this directive, the value is in seconds.




    ProxyDenySite directive
    Syntax: ProxyDenySite = /etc/nanoweb/badsites
    Context: Server Config
    Module: mod_proxy

    If you want some servers not to be accessible through your proxy you just need to list them in a text file (one server name per line) which you specify here; so access to such servers will be forbidden.




    ProxyDenyPopup directive
    Syntax: ProxyDenyPopup = /etc/nanoweb/popup.txt
    Context: Server Config
    Module: mod_proxy

    The proxy module can additonally filter popups out of delivered pages, if they match one of the regexs listed in the specified file.




    ProxyDenyPub directive
    Syntax: ProxyDenyPub = /etc/nanoweb/images.txt
    Context: Server Config
    Module: mod_proxy

    This directive enables you to filter images. Just put a line with the filename or URL into the file »images.txt« for every image, that you do not want to be delivered through the proxy.




    RefererAllow directive
    Syntax: RefererAllow = http://www.google.com
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_access_referer

    In a context where RefererCheck has been activated, this allows requests refered by the defined URL (or part of URL) to be processed as if they were coming from the local site




    RefererCheck directive
    Syntax: RefererCheck = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_access_referer

    When activated, nanoweb will answer every request which referer is nonempty and differs from the ServerName with a 403 Forbidden error page.
    Other exceptions than the ServerName can be set with the RefererAllow directive.



    Syntax: ReflectRewriting = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_rewrite, mod_multiviews

    If a URL is rewritten via a RewriteRule or because of some content negotiation, this setting influences if the rewritten URL (or if unset the requested one) shall be presented in error messages that may occur.
    Enabling this probably leads to trouble if you also run mod_proxy.




    RewriteRule directive
    Syntax: RewriteRule REGEX REPLACEMENT [flags,...]
    Context: .nwaccess
    Module: mod_rewrite

    Mappes the requested file name to real one by rewriting with usage of regular expressions pattern matching. Please refer to the modules` documentation for a short explanation.




    RewriteCond directive
    Syntax: RewriteCond TESTSTRING CONDPATTERN [flags,...]
    Context: .nwaccess
    Module: mod_rewrite

    Does additional regex tests that trigger if the following RewriteRule gets executed (on success of this RewriteCond).




    RequestTimeout directive
    Syntax: RequestTimeout = 15
    Context: Server Config
    Module: Core

    Nanoweb will wait specified amount of time for receival of the actual http request after a TCP/IP connection was established, before it closes this connection again to not prevent others from correctly connecting.




    ServerAdmin directive
    Syntax: ServerAdmin = webmaster@example.com
    Context: Server Config, Virtual Hosts
    Module: Core

    Admin mail address present in most of the server generated pages (errors, status, directory listings).




    ServerAlias directive
    Syntax: ServerAlias = www.secondname.example.net
    Context: Server Config, Virtual Hosts
    Module: Core

    As there can be only one default ServerName, you may use this directive to let nanoweb listen to additional DNS names (just give multiple lines here).
    You can optionally give a port number after the server name.



    Syntax: ServerFakeSignature = apache/1.3.19 (Unix) Debian GNU/Linux PHP/4.0.6
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    If you'd like to annoy possible attackers to your webserver you can give them false informations on which webserver you are actually running using this directive.
    You have to enable this behaviour by additionally changing the ServerSignature directive to 'fake'.




    ServerLog directive
    Syntax: ServerLog = /var/log/nanoweb/server.log logmode
    Context: Server Config
    Module: Core

    The ServerLog directive may be given multiple times, to let nanoweb create separate files where runtime informational messages are written to. Having multiple of them makes sense, because the second parameter (logmode) to this directive allows you to filter parts of the possible server messages.
    The internally generated server messages are divided into the classes: error, notice warning, debug, and hit. You can even say all or default here, or give multiple modes by connecting them with the plus sign, like "error+warning+hit" for example.

    ServerLog = /var/log/nanoweb/server.log default+hit
    ServerLog = /dev/tty9 all
    ServerLog = /var/log/nanoweb/error.log error+warning
    ServerLog = /var/log/nanoweb/server.debug notice+warning
    

    If you leave out the logmode parameter, the default will apply, which is logging notices, errors and warnings to the specified file.




    ServerMode directive
    Syntax: ServerMode = standalone
    Context: Server Config
    Module: Core

    You may wish to run nanoweb in standalone mode in most cases. This is, the nanoweb server is started to stay resident in memory and waiting for incoming connections.
    Another variant of using the nanoweb server is by invoking it via inetd - the »internet superserver« used on many UNIX systems to startup internet services on oncoming requests, which leads to some overhead and is slower in general as one copy of nanoweb.php needs to be executed for each requested file.




    ServerName directive
    Syntax: ServerName = www.example.com
    Context: Server Config, Virtual Hosts
    Module: Core

    Default DNS-name of this server. You may append a port number to the name.




    ServerSignature directive
    Syntax: ServerSignature = full | os | prod | min | off | fake
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    Webservers usually reveal their name and version in the HTTP answer headers, but you can restrict nanoweb in how much information it gives away. Per default (full) it tells "nanoweb/NW_VERSION OPERATING_SYS PHP_VERSION", with this directive set to os it leaves out the PHP version, min still includes the nanoweb version but prod only tells "nanoweb" (the product name).
    Finally you can disable the output fully with off. But much more funny it is to give clients wrong information instead using fake and the ServerFakeSignature.




    ServerTheme directive
    Syntax: ServerTheme = default
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: Core

    This directive selects one of the theme templates (loaded using LoadTheme) to be applied to server generated responses like error messages or directory listings.



    Syntax: SingleProcessMode = 1
    Context: Server Config
    Module: Core

    This is used to force nanoweb in single process mode (which is usually slower than the default process forking mode). You should uncomment it when running in win32 or if your php binary was not compiled with pcntl.




    StatusAllowHost directive
    Syntax: StatusAllowHost = 127.0.0.1
    Context: Server Config
    Module: mod_status

    This gives an IP of a host allowed to consult the server status through /server-status. Multiple lines with this directive may be specified; an incomplete IP address can be used to allow a range of host addresses to be granted access.



    Syntax: StaticBufferSize = 1048576
    Context: Server Config
    Module: Core (mod_static)

    Limits the chunk size of static files to 1M per default, because nanoweb cannot keep files with unlimited size in memory. You may in fact speed up requests (for some cases) if you lower this value.



    Syntax: StaticDisablePartial = 0
    Context: Server Config
    Module: Core (mod_static)

    Disallows http clients to retrieve only parts of a resource/file, when set to 1. Usually the partial GET is used by clients like 'wget' to resume a stopped/unfinished previous download attemp.




    TempDir directive
    Syntax: TempDir = /tmp
    Context: Server Config
    Module: Core

    This specifies where nanoweb shall put temporary files into, so this directory should be read+writeable by the user/group nanoweb will run as.




    TempDirectory (obsolete)
    Syntax: TempDirectory = /tmp
    Replaced by: TempDir

    This directive was renamed to TempDir in 2.1.1 to match general naming syntax.




    User directive
    Syntax: User = userid
    Context: Server Config
    Module: Core

    Default user nanoweb will run as (the user name is »www-data« per dafault).




    UserDir directive
    Syntax: UserDir = public_html
    Context: Server Config, Virtual Hosts
    Module: Core

    This is the subpath which nanoweb will look for in users homedir when an URL like http://webserver/~user is requested.
    This directive can be set in the global section or for each virtual host.




    WormsRun directive
    Syntax: WormsRun = /usr/bin/command [args...]
    Context: Server Config
    Module: mod_worms

    Commands specified with such directives are executed, if a worm is detected.
    Please refer to the file README.mod_worms (in the docs/ directory of the unpacked tarball) as mod_worms requires additional preparation to work.




    WormsWpopText directive
    Syntax: WormsWpopText = message text ...
    Context: Server Config
    Module: mod_worms

    Text that is sent to the offending IIS server console.




    WriteAccess directive
    Syntax: WriteAccess = 1
    Context: Server Config, Virtual Hosts, .nwaccess
    Module: mod_method_PUT

    This directive enables writing files via HTTP for clients that support the PUT request method.
    You shouldn't enable this setting in the main configuration file or one of the vhost sections; it is often a good idea to allows this type of access only for selected directories (in a .nwaccess file), even if the PUT module only can write to files and directories that have the world-writable bit set or that are owned by the default Nanoweb user/group.




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/env.html0000644000000000000000000000541611023557654015636 0ustar rootroot Environment Variables
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Environment/Nanoweb Variables

    Following variables will be exported to environment for every cgi executed, and they are also available as %VARNAME in many directives (those who allow to specify response messages as LoadLimitErrorMessage, or in the RewriteRule directive for example):
    SERVER_NAME
    www.example.com
    SERVER_SOFTWARE
    SERVER_API
    SERVER_ADMIN
    SERVER_PROTOCOL
    SERVER_ADDR
    SERVER_PORT
    are describing the server
    REMOTE_ADDR
    REMOTE_PORT
    informations about the client
    DOCUMENT_ROOT
    where most pages come from
    PATH_TRANSLATED
    SCRIPT_FILENAME
    contain the real path of the script
    REQUEST_URI
    contains the real request uri
    SCRIPT_NAME
    the uri fully rewritten according to rewriterules / multiviews
    REDIRECT_URL
    is required for compatibility with the Apache-CGI-SAPI PHP interpreter
    PATH_INFO
    any additonal path that was supplied to the CGI
    REQUEST_METHOD
    may be GET or POST
    QUERY_STRING
    the cgi parameters sent via GET
    CONTENT_LENGTH
    the length of data on STDIN submitted in a POST request
    HTTP_*
    most other headers of the http request are made available as environment variables with a name of the form like HTTP_WHATEVER, common are HTTP_ACCEPT_LANGUAGE, HTTP_ACCEPT, HTTP_X_FORWARDED_FOR, HTTP_USER_AGENT

    Anything you add with the AddServerVar will most always appear in the CGI environment, too.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/features.html0000644000000000000000000000373511023557654016666 0ustar rootroot Features
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Features

    NANOWEB is a http server written entirely in PHP 4.2.
    It does not need apache or any other server software to work, just the php4 binary.

    NANOWEB has become quite advanced with the time and now features:
    • HTTP/1.1 implementation
    • Keep-alive connections and cache helpers
    • Modular architecture
    • CGI and Server side includes support via included modules
    • Name based virtual hosts
    • Authentication support
    • Error documents
    • MIME support
    • gzip content encoding
    • Nice configuration
    • PHP support
    • Apache combined log format
    • MySQL loging
    • Directory browsing
    • inetd support
    • SSL via external helpers
    • Access control
    • RBL support (mail-abuse.org)
    • Denial of Service protection
    • Proxy Server extension
    • Filter support
    • Extension Protocols (request methods) support
    • ...
      (it's fairly difficult to keep this page up to date)



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/index.html0000644000000000000000000000676111023557654016161 0ustar rootroot NANOWEB 2.2.9 documentation
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server Version 2.2.9

    NANOWEB is a http server written entirely in PHP. It does not need apache or any other server software to work, just the php binary.

    NANOWEB User's Guide



    Release Notes

    NANOWEB Reference Manual

    Additional Notes


    If this manual doesn't help you at all, just feel free to put your question into the offical nanoweb support forum or the one regarding general questions or ask the author.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/inetd.html0000644000000000000000000000530111023557654016142 0ustar rootroot ServerMode inetd
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    ServerMode inetd

    Usually nanoweb runs in so called ServerMode »standalone« (this is the case if it is started via nanoctl or when the nanoweb.php is invoked by you).
    However many internet services (or the programs providing them) don't need to be kept in memory all the time and may get started at first when a connection gets established for this service. This is done on UNIX systems using the »internet superserver« inetd (or xinetd respectively). If you desire to use nanoweb in inetd mode, you need to change the ServerMode directive accordingly in nanoweb.conf .

    Then you have to tell your inetd to invoke the distributed inetd-wrapper of nanoweb whenever the www/http service on your machine gets requested. Just insert these two lines into your systems /etc/inetd.conf config file:
    www    stream tcp nowait root  /usr/sbin/in.nanoweb in.nanoweb
    https  stream tcp nowait root  /usr/sbin/in.nanoweb in.nanoweb -ssl
    

    This is probably already done by the install-sh, you just may need to remove the # in front (which made these lines comments).

    You can force inetd to rearead its configuration file by:
    root@www:~# killall -HUP inetd
    (isn't such a bad command like it sounds)

    Requirements

    The nanoweb inetd-wrapper currently requires the »getpeername« app from the tcputils package. You can download the source at ftp://ftp.lysator.liu.se/pub/unix/tcputils or if you are using Debian with apt-get install tcputils.

    But, see also the README for most up to date informations on this issue.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/install.html0000644000000000000000000000736611023557654016522 0ustar rootroot installing nanoweb
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Installing nanoweb

    Installation of the nanoweb web server should be fairly easy, as the commandline tool install-sh will do the work for most of you.
    For Windows you may wish to use the install.bat (which should be customized to your needs before running it). Please have a look into the README about Windows installation also.

    Compiling PHP

    Nanoweb requires the interpreter of the PHP scripting language to be present on your system. You can get the source code from www.php.net, but it is often much better to use a precompiled package (for Windows especially!) if there is one in your distributions CD set. However the precompiled ones often miss the pcntl extensions which gives mcuh more speed on UNIX systems, so you're encouraged to compile PHP yourself and to adopt it to your needs:

    To compile it for »CGI« or »CLI« support (the latter one is often better suited for standalone scripts like nanoweb) all you need to do is to execute the configure program from the unpacked source tarball this way:

    ./configure --with-cgi --enable-cli --enable-sockets --enable-pcntl

    You may want to add other very common configure options like --with-zlib to use mod_gzip, and --with-mysql to have MySQL-support compiled in (but see ./configure --help for a complete list).

    make will start the build process, the binary should afterwards be installed using make install.

    If compilation with the above instructions fails, then you should have a look into the README from the PHP tarball, which starts with a »quick install guide«.

    Install nanoweb

    Run ./install-sh and follow instructions ...
    Starting from nanoweb 2.0 the install-sh will appear with a nice text or graphical user interface if you installed one of the "dialog" utilites (namely cdialog, Xdialog, whiptail or the one of the linux kernel tarball), so the installation or update should be much easier.

    Type 'nanoctl start' to start the server and connect to http://localhost/ to see if it works.

    install-sh commandline options

    • install-sh -f does a quick --forced installation into the default directories.
    • install-sh -v is more --verbose

    Installing under user-account

    If you're not root you'll need to take special care for installtion and configuration (you can not run it on TCP port 80 as ordinary user). The best way to install it is then doing it by hand. You could just copy everything into one one directory under your home directory, this however requires to configure the directory names correctly inside the configuration files.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/invoking.html0000644000000000000000000001301011023557654016657 0ustar rootroot Starting and Stopping nanoweb
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Tools

    there are of course different ways and tools to start up our bring down nanoweb depending on the operating system your computer runs:
    · nanoctl for Linux/MacOS/UNIX
    · nanostart.bat for Windows
    · invoking nanoweb.php directly  

    Starting nanoweb server

    You should use nanoctl for starting, stopping or restarting the nanoweb server; as it handles the pid files and gives the default configuration file to the server.
    
       nanoctl start
    
    
    will bring up the server

    starting of nanoweb at boottime

    The nanoctl util was designed to be easily installed for use by the common linux bootup scripts (sysV init rcNdirs). All you need to do is to create a symlink from nanoctl into the init-directory:
    
       ln -s /usr/sbin/nanoctl /etc/rc2.d/S80nanoweb
    
    
    this will bring up nanoweb automatically when your computer starts up into runlevel 2.

    Please refer also to the README of this utility.

    Starting nanoweb without nanoctl

    Its highly recommended to use nanoctl for starting or terminating the server, you may however just run nanoweb.php as any other ordinary program, which is useful for debugging (set LogToConsole accordingly).
    
       php nanoweb.php /etc/nanoweb/nanoweb.conf &
    
    Giving the name of the php binary on the prompt is not required in most cases. The first argument must be the path to the server config file.

    Starting nanoweb this way is useful if you'd like to give it additonal configuration options overriding the ones found in the default config files.
    Please use nanoweb.php --help to see how this can be done.

    Stopping

    You can use nanoctl again to stop nanoweb:
    nanoctl stop

    Or without nanoctl:
    kill -TERM `cat /var/run/nanoweb.pid`

    Restarting

    There is also of course a nanoctl option to restart nanoweb:
    nanoctl restart

    Without nanoweb:
    kill -HUP `cat /var/run/nanoweb.pid`


    Please see also the nanoctl README.
     

    Starting nanoweb under Windows

    If you installed nanoweb to the default directories, there will be a C:\NANOWEB\NANOSTART.BAT which can be used to start the server. You may want to make a Windows visual connection from this batch file onto your Desktop.  

    nanoweb.php

    You can of course invoke the server script directly by entering it's name on the commandline (optionally preceeded by the name of the PHP interpreter):
    localhost~# nanoweb.php
    C:\> PHP.exe C:\nanoweb\nanoweb.php
    

    This form of invocatition allows you to give additional command line options. Just enter to nanoweb.php --help to get following:
    --help gives help on commandline options
    --version shows nanoweb version
    --config=/path2/nanoweb.conf defines where the nanoweb configuration file is located
    --set-option="directive=value" overrides configuration directive from the main server configuration file
    --add-option="directive=value" adds additional configuration directive from the main server configuration file, where a directive may be given multiple times
    --start-daemon brings up nanoweb in standalone mode
    --inetd runs nanoweb in inetd mode (one request from stdin)
    --quiet no output to stdout during run (for inetd mode)
    --verbose more noise on startup, try this one if you can't get nanoweb to startup correctly
    --debug like verbose



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_access_rbl.html0000644000000000000000000000244211023557654020001 0ustar rootroot mod_access_rbl
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_access_rbl

    The mod_access_rbl checks the connecting clients` IP to be in the RBL of mail-abuse.org and forbids access if it is listed (an error message gets send back).

    You can select the access method to the mail-abuse RBL with the Access_RBL directive in the server configuration file; the "dns" one is much faster.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_htpasswd.html0000644000000000000000000000424411023557654020561 0ustar rootroot mod_auth_htpasswd
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_auth_htpasswd

    Using this module you can use the .htpasswd authentication files from apache webserver within nanoweb. These authentication files differ only slightly from the nanoweb .nwauth files (which still can be used instead).
    As the other authentication modules this one must not only be loaded, but also activated with the AuthRequire directive in one of your configuration files (main conf, vhosts.conf or .nwaccess files):

    AuthRealm = realm name (will be shown as info text in most browsers)
    
    # use the apache compatible auth scheme
    AuthRequire = HTPASSWD
    
    # the login and password pairs are
    # kept in this file:
    AuthHtpasswdFilename = /var/www/vhosts/www.example.com/admin/.htpasswd 


    IT is more secure to give the full path to the .htpasswd file (may have a different file name of course). Apache`s per-directory password files must look like:
    login1:des-password1
    login2:des-password2
    ...
    loginNNN:des-passwordNNN
    

    So you see, only the first line distincts this the original nanoweb authentication files. The passwords should be encrypted witg the standard crypt() system call (DES passwords).


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_mysql.html0000644000000000000000000000467711023557654020103 0ustar rootroot mod_auth_mysql
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_auth_mysql

    The most flexible authentication is to use an already existing mysql database containing user names and passwords. In order to activate this authentication mechanism you need to load this modules of course and set it up as follows:

    AuthRealm = realm name (will be shown as info text in most browsers)
    
    # use the mysql database login lookup module
    AuthRequire = MYSQL
    
    # following directives specify the database and the server
    # it is running on as well as the db access password
    AuthMysqlHost  = localhost
    AuthMysqlUser  = db_user
    AuthMysqlPass  = db_pass
    AuthMysqlDB    = db_name
    
    # you can use any existing table that contains
    # login/password pairs, by giving this authentication
    # module the correct table and column names
    AuthMysqlTable = table_name
    AuthMysqlLoginColumn = login_field_name
    AuthMysqlPassColumn  = password_field_name
    
    # "plain" if the password lies unencoded in the database,
    # or "crypt", "md5" if the system hash functions were
    # used, and "mysql" if MySQL's password() encoded it
    AuthMysqlPassType = plain | crypt | md5 | mysql
    


    So the funny thing about this authentication scheme is that it allows easy integration of HTTP authentication areas into an already existing portal site like SomethingNuke, because the user database and the user management tools already exist.

    Note that you can use different databases/tables, as you can restrict access on a per-directory basis when you give the AuthRequire directive in one of the .nwaccess files.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_nwauth.html0000644000000000000000000000406511023557654020233 0ustar rootroot mod_auth_nwauth
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_auth_nwauth

    The authentication schema first introduced in nanoweb was the use of nanoweb authentication files™ often named .nwauth.
    You still can use these authentication files, when you load and activate this module in one of your configuration files (nanoweb.conf, vhosts.conf, .nwaccess):

    AuthRealm = realm name (will be shown as info text in most browsers)
    
    # use the .nwauth module
    AuthRequire = NWAUTH
    
    # the login and password pairs are
    # kept in this file:
    AuthNwauthFilename = /var/www/vhosts/www.example.com/admin/.nwauth 


    You really should give the full path to the .nwauth file (can have another file name of course). Such a file should look like:

    #?nwauth
    login1:des-password1
    login2:des-password2
    ...
    loginNNN:des-passwordNNN
    

    Remember that the first line isn't taken into account (it formerly contained the auth realm name). des-password means that the password has been encrypted using the standard crypt() system call.

    There is a small utility within the nanoweb tarball, which sould ease creation of this type of authentication files.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_simple.html0000644000000000000000000000301411023557654020207 0ustar rootroot mod_auth_simple
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_auth_simple

    With the simple authentication module you can restrict access to your documents with logs/password pairs that you specify within one of the config files (main config, vhosts.conf or .nwaccess files).

    one of your your .nwaccess files may look as follows:

    AuthRealm = realm name (will be shown as info text in most browsers)
    
    # activate the simple auth mechanism
    AuthRequire = SIMPLE
    
    # these directives give the user names and passwords
    AuthSimpleUserPass = login1 password1
    AuthSimpleUserPass = user2 password2
    ...
    AuthSimpleUserPass = userNNN passwordNNN
    



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_bsp.html0000644000000000000000000000532011023557654016463 0ustar rootroot mod_bsp - Brainfuck Server Pages
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Brainfuck Server Pages

    mod_bsp

    Don't forget to have a look at the README for this module!

    mod_bsp is a nanoweb module used to serve BSP content - BSP stands for Brainfuck Server Pages.

    But ... What the f*ck is Brainfuck ?

    "Brainfuck is the ungodly creation of Urban Müller, whose goal was apparently to create a Turing-complete language for which he could write the smallest compiler ever, for the Amiga OS 2.0. His compiler was 240 bytes in size. (Though he improved upon this later -- he informed me at one point that he had managed to bring it under 200 bytes.)"
    http://www.muppetlabs.com/~breadbox/bf/

    If you want to see what it looks like, have a look at ../bspdemo.bsp in the docroot.

    Quick facts about mod_bsp:

    • mod_bsp makes use of the PHP Brainfuck Interpreter v1.01 by Daniel Lorch. visit the official site at : http://daniel.lorch.cc/projects/brainfuck/
    • The parameter given to ParseExt is the content type of the served pages.
    • If "BSPAllowSource = 1" is defined in config file, calling a bsp page with "?source" as query string will show the BF source code of the page.
    • The input fed to the BF programs is the content of the POST request
    • The output directly goes to the client browser

    If you're further interested in Brainfuck: there are thousands of pages covering this language.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_cgi.html0000644000000000000000000000414611023557654016446 0ustar rootroot mod_cgi
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_cgi

    This module allows nanoweb to execute the appropriate script interpreter for a filename extension, if you set it up coreectly by using the ParseExt directive:
       ParseExt = php CGI /usr/local/bin/php
       ParseExt = cgi CGI /usr/bin/perl -w $FILENAME
       ParseExt = pl  CGI /usr/bin/perl -w $FILENAME
       ParseExt = py  CGI /usr/bin/python $FILENAME
       ParseExt = sh  CGI /bin/sh -c $FILENAME
       ParseExt = js  CGI /usr/bin/js $FILENAME
       ParseExt = awk CGI /usr/bin/gawk -f $FILENAME /dev/null
    
    (these are just some examples, but php and perl are the most commonly used ones)

    PHP
    <html>
    <head><title>php example</title></head>
    <body>
      <?php
          echo "<h2>Welcome to my homepage!</h2>";
          include("counter.php");
          echo "You are visitor no $counter_n <br>";
          $f = fopen("counter.php");
          fwrite($f, '<?php $counter_n = ' . $counter_n++ . "; ?>");
          fclose($f);
      ?>
      ...


    Perl
    #!/usr/bin/perl -wTU
    require "cgilib.pl";
    ReadParse();
    
    echo "Content-Type: text/html\r\n\r\n";
    echo "<html><body>";
    ...




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_fb.html0000644000000000000000000001415711023557654016276 0ustar rootroot mod_fb
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_fb

    mod_fb is the »filebrowser« (directory listing generator) that got extracted from the main server (in 1.8.0-dev) to a module. As it now doesn't intermix with core server code it's easier to extend and more functions will be implemented in near future.

    It currently takes these configuration directives:



    FileBrowser

    Syntax: FileBrowser = 1
    Context: Server Config

    Activates or Disables the automatic generation of directory listings. You shouldn't disable it however, as this is a essential service of nanoweb.
    If a file with a name allowed in the DirectoryIndex directive exists in the requested directory no listing will be generated of course.



    FBDescFile directive

    Syntax: FBDescFile = .desc
    Context: Server Config, Virtual Hosts, .nwaccess

    Descriptions of each file out of a directory may be given in the file specified here. Such a description file should look like:

    filename.ext   desc of this file
    index.html  main/homepage...



    FBIconByType directive

    Syntax: FBIconByType = /icons/image.gif mime/type
    Context: Server Config, Virtual Hosts, .nwaccess

    Associates icons pictures to mime types for output in directory listings produced by mod_fb.
    You may specify partial mime-types only; so you can associtate fall-back icons for general mime types like »application«, »text« or »image«.
    The default configuration of nanoweb also utilizes the Alias directive to keep all icons in a single directory (/icons/ which is rewritten to absolute real path /var/www/icons/) accessible from all the virtual hosts.



    FBIconDefault directive

    Syntax: FBIconDefault = /icons/misc.gif
    Context: Server Config, Virtual Hosts, .nwaccess

    If none of the FBIconByType directives defines an appropriate icon for a file (or if a files mime type is unknown) this directive gives the name of the image to be used.



    FBIconDirectory directive

    Syntax: FBIconDirectory = /icons/directory.gif
    Context: Server Config, Virtual Hosts, .nwaccess

    Defines the icon to be printed for directories.



    FBShowDotFiles directive

    Syntax: FBShowDotFiles = 1
    Context: Server Config, Virtual Hosts, .nwaccess

    This tells mod_fb to include files which names start with a dot to be included in directory listings. On UNIX machines these »dotfiles« should be treaten as invisible files by standard programs; and because nanoweb keeps some of its per-directory configurations in .nwaccess and .nwauth you probably want to set this directive to the default of 1.



    FBSortOrder directive

    Syntax: FBSortOrder = name | size | date [ desc ]
    Context: Server Config, Virtual Hosts, .nwaccess

    Directory listings are sorted by mod_fb according to this setting (»name« is the default). The use of »desc« reverses the order.



    FBTemplateFooter directive

    Syntax: FBTemplateFooter = .fbfooter
    Context: Server Config, Virtual Hosts

    Define a footer template filename (printed below directory listings).
    The macro "@genpage_signature@" can be used in such a file to display the standard nanoweb server signature.



    FBTemplateHeader directive

    Syntax: FBTemplateHeader = .fbheader
    Context: Server Config, Virtual Hosts, .nwaccess

    Define a header template for use with the file browser.
    Available macros for use in the files specified with this directive are "@real_uri@" to display the requested directory, and "@welcome_formated@" for the formated welcome file (if any is present).



    FBWelcomeFile directive

    Syntax: FBWelcomeFile = .welcome
    Context: Server Config, Virtual Hosts, .nwaccess

    Whenever a directory listing (»filebrowser«) is to be sent back to the client, the server searches for a file with the hereby given name to be included in the sent output.




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_fcgi.html0000644000000000000000000000302411023557654016606 0ustar rootroot mod_fcgi
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_fcgi

    FastCGI is a method to run all your favorite scripting languages much faster, as the according interpreters are alwas kept in memory and just wait for a script to be passed from the webserver.
    With mod_cgi a copy of the script interpreter needs to be run whenever a CGI is to be processed, which may be a bit slower than neccessary.
    Just register your script extensions with the ParseExt directive as you did for mod_cgi, but now specify FCGI as the second argument and server name and port as args to mod_fcgi:
       ParseExt = phpf FCGI localhost:9000
    



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_gzip.html0000644000000000000000000000546411023557654016661 0ustar rootroot mod_gzip
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_gzip

    The HyperTextTransferProtocol defines methods to transmit files in encoded formats from server to client. These encodings focus on compression (the only one used nowadays is GNU's gzip) to speed up transmissions over the internet.
    This module handles transparent compression (activated when a browser states it supports it) without requiring you to change anything to your files.
    Note that this procedure gives a little overhead on the server side as well as for the client, but especially decompression is amazingly fast and the many times faster download of html files via today still used modems should encourage you to activate this module.

    As this module is now internally implemented as filter, there are different ways to activate it:

    # standard method (tries to compress every file)
    GzipEnable = 1
    
    # or activated with a Filter rule (here for all files)
    Filter = */* gzip
    
    # or (only tries to compress text files)
    Filter = text/* gzip
    


    To activate it for 'text/*' files only is probably a good idea, as most other file types rarely can be compressed that well.
    There are also some general options for this module you may wish to tweak:

    # compression level (1 - 9)
    GzipLevel = 5
    
    # send uncompressed if size didn't reduce significantly
    GzipMaxRatio = 90
    


    Note that mod_gzip currently doesn't compress output of CGI scripts (which often comes in chunks), so you may want to apply the "unchunk" Filter before "gzip".
    For PHP scripts you should activate "zlib output compression" in the php.ini or activate the "ob_gzhandler" in every script. This is safer and also some nanoseconds faster than using nanowebs mod_gzip.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_include.html0000644000000000000000000000403111023557654017320 0ustar rootroot mod_include
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_include

    mod_include enables you to utilize the so called Server Side includes in documents with the file extension .shtml (per default, refer to ParseExt directive for changing this).

    SSI commands appear in HTML documents` comments:
    <!--#SSI_COMMAND ... -->
    (don't forget the '#', no spaces allowed at the beginning!)

    where SSI_COMMAND may be one of:
    include virtual "uri"
    replaces the SSI-comment with the contents of the specified file URI (virtual means corresponding to the client-visible directory structure)
    include file "file"
    includes contents of the given file into the document (the SSI-comment is replaced with the files content)
    exec cmd "command"
    executes the given CGI (and afterwards throws this CGIs output where the SSI-comment was)



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_libphp.html0000644000000000000000000000637611023557654017171 0ustar rootroot mod_libphp
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_libphp

    mod_libphp is an experimental attemp to process php scripts without the need to invoke a new php interpeter, because this may be under some circumstances a bit slower. However it turned out, that there is often NO SPEED GAIN, if you use this module instead of mod_cgi!!
    Please note, that this module makes use of the PHP pcntl extension, and thus CANNOT BE USED UNDER WINDOWS, as current Windows versions don't support UNIX compatible process forking.

    Limitations

    Before you start to test (don't forget this step!!) this module, you should know that it uses very stupid tricks to achieve this "internal processing" of php scripts, and thus following things don't work:
    • scripts run inside mod_libphp cannot define functions that were already used inside nanoweb (for example: "errexit", "techo", "loadfile", "load_modules", "modules_init", "access_query", "log_srv", "reload_config", "send_response", ...)
    • header() and setcookie() won't work, so there is a new nwheader() which must be used (nwsetcookie will be implemented later)
    • mod_libphp only handles GET requests, anything else is passed to be handled by mod_cgi, which works more accurately

    If you thought about all these drawbacks and have ensured that none of the nanoweb internal functions will be redefined by your script and that the unsupported ones are not critical to it, you can try to run it under mod_libphp instead of the real php.
    To activate the module you must load it into the server and setup ParseExt accordingly:
    #ParseExt = php LPHP
    ParseExt = lphp LPHP
    

    You should activate mod_libphp for all scripts not before you really have tested that it works! Instead of activating it for all scripts you may only want to run some of them inside nanoweb by changing their extension to .lphp as defined by the above ParseExt directive (such a .lphp script may itself include() any other ordinary .php of course).

    This module is deactivated per default of course, due to its guessworking nature; and may not even be included in your nanoweb tarball. You have to edit nanoweb.php, search for "libphpHACK" and uncomment these few lines that make it work.

    bugreports are welcome: mario@erphesfurt·de


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_load_limit.html0000644000000000000000000000377311023557654020026 0ustar rootroot mod_load_limit
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_load_limit

    This module stops nanoweb from serving pages when the server load gets higher than the one you specified with the LoadLimit directive. An built-in or a custom error message is send back then.

    Alternatively you may wish to redirect incoming requests to a »fallback server« which holds a copy of all the available files. You can easiliy do so by giving the name of the secondary webserver with the LoadLimitRedirect directive. You need to enable this feature with LoadLimitAction=redir.

    LoadLimit = 25.0
    LoadLimitAction = redir
    LoadLimitRedirect = http://www2.example.com/%REQUEST_URI
    


    The server load redirection can also be activated on a per-directory basis, so you have the choice to redirect parts of your site earlier than others or even to different fallback servers.

    The virtual file /proc/loadavg is used by this module to determine if it should block incoming requests.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_mispell.html0000644000000000000000000000257111023557654017351 0ustar rootroot mod_mispell
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_mispell

    mod_mispell checks requested filenames for existence, and if a user submitted URL is not on the server it starts a search for files that sound much the same as the requested one (using the PHP built-in levenshtein algorithm). If found it presents the user or the client the corrected URL; see also MispellAction configuration directive.

    mod_mispell was written by Myrdin


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_multiviews.html0000644000000000000000000001445011023557654020113 0ustar rootroot mod_multiviews
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_multiviews

    The HTTP/1.1 specifies some methods to deliver different variants of files based upon headers the client identifies its or its users preferences / capabilities. This is called content-negotiation and can be accomplished even if the files on the server are "static".

    This module now supports server-driven negotiation, and additonially allows the client to choose the "best" variant.
    The selection depends on an average »quality« which is calculated with the qualitiy values of the mime type (file format), language (english, french, ...), encoding (compression) and features (javascript, tables, etc.) of each file.

    To enable the content negotiation features of nanoweb you only need to construct different variants of a file and give them suitable file name extensions. For example:
    example.en.html original HTML version of the document, in english
    example.js.html.gz compressed HTML file (using javascript)
    example.pdf a pdf version of the original file
    example.fr.swf shockwave flash variant, in french

    As all the variants of the document now have very different file extensions you cannot refer to them any longer using <A HREF="example.html">, you must instead use just the basename of the file, so nanoweb and/or the client select the right one for you (it is still possible to reference one of the variants, but you probably don't want to do that).
    In the above example most people would receive 'example.en.html'; many recent browsers however will trigger the compressed variant (with javascript), and the other two are rather bad examples here.

    The alogorith in mod_multiviews of course differs from the one in apache, but it seems to give good results; and you still could tweak it yourself (the source is most always available).
    This module for example tries to multiply the different quality factors where possible, but if you specify more than one file type (mime) the according values are summed. Much of the algorithm depends on internal downgrading quality factors, but there are additionally some configuration options which also have a big impact on the results:


    FallBackPriority directive

    Syntax: FallBackPriority = smallest | largest | newest | oldest | stupid
    Context: Server Config, Virtual Hosts, .nwaccess

    If the mime qualities of all available file variants equal, then mod_multiviews can at least select the smallest, largest, newest or the oldest file out of them.



    LanguagePriority directive

    Syntax: LanguagePriority = en fr de
    Context: Server Config, Virtual Hosts, .nwaccess

    A browser requesting http://example.com/ will be delivered 'index.html.en' in favour of 'index.html.de' (if the users browser has not been configured to request with another language preference)

    Of course this only works if no 'index.html' exists in the docroot, which nanoweb otherwise would have preselected. A file called 'index.html.fr.gz' may get send in favour of all other variants, because of the higher priority of compressed content.



    MultiViews directive

    Syntax: MultiViews = 1
    Context: Server Config, Virtual Hosts, .nwaccess

    This directive enables / disables mod_multiviews, so you can use the negotiation features only in directories you actually need them.



    OtherPriority directive

    Syntax: OtherPriority = php; qs=0.28, text/html; qs=0.27, text/*
    Context: Server Config, Virtual Hosts, .nwaccess

    Is a new directive which sets priorities which come into use, when the client doesn't send an Accept: header As you can see, you may intermix file extensions (as "php" - without dot!) and mime-types known to nanoweb;
    where you don't specify a priority value with qs= (0.0 - 1.0) a lesser (divided by 1.7) value as the previous one will be chosen.

    Some micro-priorities (PNGs in favour of GIFs) are built-in but can be overridden this way.

    Multiple OtherPriority-lines may be given in the config.



    ReflectRewriting directive

    Syntax: ReflectRewriting = 1
    Context: Server Config, Virtual Hosts, .nwaccess

    If this directive isn't set, the requested URI will show up in any error message that may occur, if set to 1 the rewritten filename will be shown instead.
    Note: This directive also affects mod_rewrite.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_mysqllog.html0000644000000000000000000000277111023557654017555 0ustar rootroot mod_mysqllog
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_mysqllog

    If you load the MySQL-Logging module into the server, all occurred requests will be noted into a database, instead of to a text file (what mod_stdlog does).
    The logging table is automagically created, you need however to create the database given with the MySQLLogDatabase directive yourself.

    in the server config you'll also need to set these directives:


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_pfilters.html0000644000000000000000000002547111023557654017540 0ustar rootroot mod_pfilters
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_pfilters

    The pfilters module allows you to pass the contents of delivered pages (static files as well as CGI output) through any of the internal filters or through any external filter program available on your system.

    All the filters get available when the appropriate module is loaded (core filters within mod_pfilters, "gzip" filter is part of mod_gzip, and some extension filters are located in mod_html_pfilters). However except mod_gzip these filters are not active until you put a Filter directive referencing them into the configuration files:
     FilterEnable = 1
     Filter =        */*   null  -- you don't want to use this one!
     Filter =        */*   unchunk
     Filter =  text/html   pipe  /usr/bin/tidy -q -latin1
     Filter = text/xhtml   pipe  /usr/bin/tidy -xml -q
     Filter =  text/html   wap
     Filter =    image/*   wbmp 100x60
    #Filter =        */*   gzip  -- this is added automagically by mod_gzip
    
    Note: every filter is assigned to a mime-type, and it will only be executed if the current content matches this. This way you could bind »tidy« to html files and for example »watermark« to image files.

    Besides mime-types you can also use file extensions to make a filter rule. Finally both can be combined:
     Filter = .html        null
     Filter = .exe         pipe /usr/local/f-prot/f-prot -ai -
     Filter = .txt|.pdf    null
     Filter = pdf|image/*  null

    These are the currently available filters:

    unchunk core Content from CGIs is often chunked, that means it is is splitted into many parts and thus cannot be passed to filters (like 'pipe') which require to work on the whole file. So you always should enable the unchunk filter which tries to resemble all chunks up to a given size (128K without argument). For example Filter = */* unchunk 300 would try to recombine chunks up to 300 kbytes.
    pipe core The pipe filter is the most powerful of all the filters, as it is used to pass the current content through an external filter program, that is given as argument to this filter (you need to specify the full path name here, as it is prior checked for existence).
    Filter programs are very common utilities in a UNIX-like environment, but you probably want to use html-aware or xml-capable filters only.
    BTW, the »pipe« filter is the one, the pfilters infrastructure was implemented for.
    null core does absolutely nothing
    (you could use /bin/cat to do equally nothing)
    static core The server core now converts statically generated content into an internal parser object itself, so you really don't need to take care about this one!
     
    gzip
    (automagically)
    mod_gzip Currently delivered content will be compressed on the fly, if you load mod_gzip into the server. This filter is activated automagically for all files, but you can however assign it in a Filter= directive like all the others (you however should take care, that it is the last one).
     
    shrink html_filters This filter tries to remove all newlines from your html page, so it'll get to just one line. Beside the smaller size (also helps gzip) your page gets unreadable without appropriate tools and this makes it a small weapon against code sniffing.
    Warning: this conversion does not harm your CSS areas (per specification of the w3c), but ElsewhatScript gets unusable if it contains comments; additonally this filter refuses to work if the file contains <PRE> tags.
    downcase html_filters Converts all tags and their attributes (where missing quotation marks are added also) to lowercase which additonally helps compressing the file. This filter is rather slow.
    wap
    (experimental)
    html_filters tries to convert your html to wml code; but this rule is of course only applied if the client actually requests wml.
    The HTML should be valid, else the WML won't be too, so it is highly recommended to use a more sophistcated external conversion utility instead of this very slow internal one.
    # best way to use the »wap« filter:
    Filter = text/html pipe /usr/bin/tidy -q
    Filter = text/html wap
    Filter = application/vnd.wap.wml pipe /usr/bin/tidy -xml -q
    garbage
    (senseless)
    html_filters this filter corrupts all your html files.
     
    convert img_filters There exists a demo filter package for images; and the convert filter enables you to change the image type from png to jpeg and vice versa by specifying the target format after the filter name. Some other file formats may be supported (for input at last), but note that .gifs are rather rarely allowed and thus cannot be used with the img_filters module.
    copyright img_filters You can use this filter to add a text snippet to served images; just add some text after the filter name, e.g.:
    Filter = image/jpeg copyright (c) 2002 whoever 
    wbmp img_filters The wbmp format is to be used for cellular phones` browsers, you probably want to enable this filter for images where you enabled the »wap« filter for hypertext files.
     
    error misc_filters this filter enables you to prevent certain files from being delivered, it doesn't output a real http error response but you may give an response code as argument to this filter
    addservervar misc_filters you can setup server/environment variables with this filter for some selected files / mime types (for CGI scripts for example)
    addheader misc_filters Allows you to output an additonal arbitrary HTTP response header together with selected files, or files of a specified mime type.
    nocache misc_filters This filter applied to any file prevents it from getting cached by proxies, it does so by just adding the according HTTP response headers.
    handler misc_filters This filter corresponds to the apache »AddHandler« directive and allows you to get specified files processed by the CGI script given as argument to this filter.
    Filter = .myhtm|.txt /cgi-bin/needs-frame.php
    In this example files with the extension .myhtm or .txt would invoke the given php script with PATH_INFO set with the filename of the originally requested .myhtm or .txt file. So this script (handler) must take care to produce some output out of the file (build some html table around loaded plain text file, or such things).


    Note that you can disable all filters at once with the FilterEnable directive on a per-directory basis.

    The name »pfilters« comes from the fact that it wraps a filter around the nanoweb internal »parser« objects which represent the requested files.

    The module mod_gzip now uses the pfilters infrastructe as well, so there is no need to take care if the Filter rules are mentioned before mod_gzip, as this is ensured internally (most filters don't work on already compressed content).




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_proxy.html0000644000000000000000000000636711023557654017074 0ustar rootroot mod_proxy
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_proxy

    With the nanoweb internal proxy server you can save download time as it caches all requests gone through it. This is especially useful if you have a local network with one internet gateway server which also works as firewall to the local network (in this special case you are really encouraged to use mod_proxy).
    Beside its caching facility it can help you to filter unwanted content (whole sites, images and popups as well).

    In order to make use of mod_proxy, you have to make it loaded by nanoweb by uncommenting the according LoadModule directive in the modules.conf; and you need of course to setup proxy usage in all browsers you want to use on the computers of your local network (use port 80 as for accessing nanoweb itself).

    You may want to tweak the behaviour of mod_proxy with following directives:

    ProxyAccessLog directive

    Syntax: ProxyAccessLog = /var/log/nanoweb/proxy.log
    Context: Server Config

    The proxy module generates an additonal seperate log file, as you probably don't want the main server log to be intermixed with request informations for files that are not located in your servers docroot.


    ProxyAllowIP directive

    Syntax: ProxyAllowIP = 168.192.
    Context: Server Config

    Use this directive to allow hosts or all hosts from a network (with an abbreviated IP address range) to access the www via the nanoweb internal proxy server. Hosts not listed here cannot make use of the nanoweb proxy.


    ProxyCacheDir directive

    Syntax: ProxyCacheDir = /var/cache/nanoweb
    Context: Server Config

    The proxy module of course needs a dedicated directory where it can save all the files that were requested in the past, so that they do not need to be fetched a second time from the real server if they get requested another time.


    ProxyDenySite directive

    Syntax: ProxyDenySite = /etc/nanoweb/badsites
    Context: Server Config

    If you want some servers not to be accessible through your proxy you just need to list them in a text file (one server name per line) which you specify here; so access to such servers will be forbidden.




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_rewrite.html0000644000000000000000000002130511023557654017361 0ustar rootroot mod_rewrite
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_rewrite

    This module tries to imitate the famous apache module. However not all features supported in the original one can be used with this version.
    See bottom of this file for what it doesn't understand.

    mod_rewrite is used to map requested file names to existing files by using regular expressions. For example, if your browser wants to GET say
    http://www.example.com/thisfile.html
    you can use the keyword "RewriteRule" to change the requested filename:

      RewriteRule  thisfile  changedfilename  
    
    so that a file named "changedfilename.html" gets sent back to the browser.

    Such keywords must be written into files named ".htaccess" in the directory the rewriting shall take place.

    This mod_rewrite supports most of the regular expression syntax that you can use with apache's module:

    
        .        matches any character  
        .+       matches many of any character, at a minimum of 1  
        .*       matches also zero length character string  
    
        [a-z]    matches one character out of specified range  
        [4x#]    matches one of the specified characters  
     
        ()       grouping (and for backreferences in replacement string)  
        (a|bc)   matches "a" or "bc"  
     
        .{2,5}   exactly specified repeat count (here: 2 to 5 of any character)  
    

    An exclamation mark ! at the beginning of a regex means that the rule matches only if the regular expression pattern itself doesn't match the filename of the requested URL.

    If you used one of the special regular expression characters in a filename you just have to prepend this character with an backslash to mask it,
    for example \* just matches the asterisk character and not a row of backslashes.

    an example:
      RewriteRule  file([a-z])+[.]html  new$1.php  
    
    would rewrite specified name "fileABC.html" to "newABC.php", where the dot occurred in square brackets to only match the dot and not _any_ character.




    RewriteRule

    RewriteRules may also have some flags specified (write these in brackets!, comma separated list of flags), so the complete Syntax is:

        RewriteRule  REGEX  REPLACEMENT  [flag1,flag2,...]
    
    [NC|nocase]
    make regular-expression match case-insensitive
    [R|redirect]
    send an redirection header back to the browser, default HTTP errorcode will be 302 (TEMP), you can specify others by appending the code [R=301] or these special values: [R=TEMP] (default), [R=permanent], [REDIRECT=seeother]
    [P|proxy]
    if mod_proxy is loaded, you may do an (internal) redirect to another server for virtual inclusion of thats content; use http://example.com/... as replacement string to make this work
    [F|forbidden]
    sends http status code, that tells client "no permission"
    [G|gone]
    tells browser, that requested page no longer exists
    [L|last]
    stop rewriting URLs after this Rule
    [N|next]
    restart rewriting with first rule
    [chain|C]
    if this rule does not match, do not use following one (you can chain several rules together by use of this flag)
    [type|T=MIME-type]
    set mime of the target file
    [qsappend|QSA]
    if you rewrite a filename and specify ?var1=xy any previous query-string will be lost; this flags preserves former values and just appends your new ?var1=xy
    [skip|S=num]
    skip next "num" rules, if the current one matches
    [env|E=VAR:VAL]
    set environment variable to specified value (may contain backreferences to regex) if rule matches
    [header|H=X-Header:Content]
    sets the disired HTTP response header to given value; Note that overriding default response headers may not work in all cases.
    This flag is not found in apache's mod_rewrite, so using it will make this rule a trap for the apache module.

    But see also the much more complete apache documentation about RewriteRule.


    RewriteCond

    There exists another keyword, which just does regex matches, but no rewritings; and by failure prevents following RewriteRules from being executed:

      RewriteCond  TESTSTRING  CONDPATTERN   [NOCASE,ORnext]  
    

    Here the second argument is the regular expression, and NC and OR are the only allowed flags.
    TESTSTRING can be constructed by using %{SERVER_VARS} or backreferences to last RewriteRule-groups $NN or RewriteCond-groups %NN. For more Information see the documentation of apache's mod_rewrite.

    Available vars are for now:

    • %{ENV:PATH}         any UNIX environment variable may be specified
    • %{HTTP:header}         any HTTP request header can be used
    • %{VARNAME}         any of the nanoweb internal variables

    CONDPATTERN may be a regular expression as seen above, or:


    -d tests TESTSTRING to be an existing directory
    -f tests TESTSTRING to be an existing file
    -s file specified by TESTSTRING must be grater than 0 bytes

    >CONDPATTERN must be lexically greater than TESTSTRING
    =CONDPATTERN must be lexically equal to TESTSTRING
    <CONDPATTERN must be lexically lower than TESTSTRING


    ReflectRewriting directive

    Syntax: ReflectRewriting = 1
    Context: Server Config
    Status: mod_rewrite, mod_multiviews

    will reflect changes to the requested path name in server error responses, when for example the rewritten file name does not exist or has no read permissions set; otherwise the url from the request will be printed in such server messages.
    Note: This config directive affects mod_multiviews as well.



    differences to apache

    in nanoweb the main server formerly (pre 1.8.0) used to append 'index.html' to the request_uri, when it existed in the given path, the workaround was to use following regular expression (not necessary anymore):
      RewriteRule  ^(index.html)*$  otherpath/new-index.html   
    



    this mod_rewrite clone does not support:

    - some of that very special Rule-flags
    - rewriterules in main server config (not yet)
    - all the other keywords:
      RewriteEngine (not yet)
      RewriteBase (not yet)
      RewriteOptions (inheritance of rules, not yet)
      RewriteLog*, RewriteLock, RewriteMap



    examples

      #-- WAP-redirect, based upon accepted file type
    
      RewriteCond %{HTTP_ACCEPT} (x-)*(application|text)/(x-)*(vnd[-.])*(wap[-.]|wml)+
    
      RewriteRule ^(index.html)*$ index.wml [L]
    
    
    
      #-- redirect file names to google search
      
      RewriteRule  ^(.+)$   http://www.google.de/search?q=$1  [R=seeother]
    

    But, see also the URL rewriting guide from the apache.org team (they must know it!) ;>


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_static.html0000644000000000000000000000234011023557654017165 0ustar rootroot mod_static
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_static

    This module contains the code that is responsible to load all the ordinary files from the docroot into objects of the nanoweb internal "parser" type.
    The code of it was extracted during development of 1.9.0 to make the server code architecture much cleaner.

    Suddenly there is nothing about this module to be configured.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_status.html0000644000000000000000000000546311023557654017232 0ustar rootroot mod_status
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_status

    The status module enables you to view your servers current load.

    There are different pages you can view:
    general status page http://localhost/server-status
    more verbose general info /server-status?detailed
    statistics for the virtual hosts /server-status?vstats
    active servers` last served requests /server-status?who

    You can merge vhosts statistics and detailed modules information into one status page by retrieving /server-status?detailed&vstats.

    For security concerns you should restrict access to these statistical pages by using the StatusAllowHost directive (most often found in modules.conf); keeping such informations secret is probably a good idea.

    StatusAllowHost directive

    Syntax: StatusAllowHost = 127.0.0.1
    Context: Server Config (modules.conf)

    This gives an IP of a host allowed to consult the server status through mod_status. Multiple lines with this directive may be specified; an incomplete IP address can be used to allow a range of host addresses to be granted access; as for example in:

      # access allowed from common local ethernet address range:
      StatusAllowHost = 192.168.
      StatusAllowHost = 10.0.
    




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_stdlog.html0000644000000000000000000000245211023557654017176 0ustar rootroot mod_stdlog
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_stdlog

    If mod_stdlog is loaded and enabled with the LogToConsole directive the server log will additonally be written to standard output (the console or the command window respectively).
    This is of course possible only, if you run nanoweb.php directly without using »nanoctl« which otherwise would run nanoweb in daemon mode so it would be detached from the console.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/modules.html0000644000000000000000000004057711023557654016525 0ustar rootroot nanoweb Modules
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    nanoweb Modules

    The configuration files of nanoweb reside in /etc/nanoweb/; there you'll find modules.conf containing lots of LoadModule directives registering extension modules to the server core. If you want to have another overview of supported features, have a look at the page with all available configuration directives.

    core modules
    following modules are essential parts of nanoweb and thus must always be loaded:
    mod_static core This module makes standard files from the docroot accessible to nanoweb through the internal "parser" interface.
    mod_fb core FileBrowser. Without this module you wouldn't get those fancy directory listings, which is probably the most heavily used nanoweb extension.
    mod_pfilters core Filters are an extension to the internal "parser" representation of all files and content served by nanoweb. If this module isn't loaded, you probably run into trouble with some other extensions.
    mod_ac core The Access Control module allows to restrict access to the webserver to only some hosts, or to deny access only for some of them.

    standard modules
    mod_cgi standard CGI Parsing Module. You can register any script language interpreter (PHP, Perl, Python, AWK, Ruby, Shell, JavaScript, ...) with the ParseExt directive to let the according files be processed by this module.
    mod_include standard Server Side Includes support (therefore formerly called mod_ssi)
    mod_gzip standard GZIP Content Encoding support
    This module tries to compress all your files on the fly with the gzip encoding, which is understood by all recent browsers.
    mod_status standard online server status reports
    mod_load_limit standard Stops nanoweb from serving pages if the load average gets too high.
    mod_mispell standard Mispelled URL correction support allows to select the correct file if a user request had some typos. A redirect or a notice can be send back.
    mod_auth_simple standard authentication with user names and passwords given in one of the configuration files (.nwaccess files most probably)
    mod_auth_htpasswd optional enables to use the authentication files from the apache webserver
    mod_auth_nwauth optional Nanoweb authentication files look pretty much like the apache-style password-login files.
    mod_auth_mysql optional This authentication module allows you to use an already existing database with a table of user/password pairs to restrict access to directories/areas of your webserver.
    mod_auth_pgsql optional likewise for PostgreSQL
    mod_auth_ldap optional Authentication information (login names and passwords) can also be accessed via LDAP using this module.
    mod_auth_anydb optional This authentication module allows to use nearly any database, because it can utilize itself one of the database abstraction interfaces PEAR::DB, ADOdb or PHP dbx.
    mod_auth_anonymous optional Allows ftp-like "anonymous login" authentication (a user must only submit its email address).
    mod_proxy optional Proxy Server inside nanoweb.
    The Proxy server implemented by this module is primarily a caching one (but introduces many filtering mechanisms as well), which means that it can speed up http requests if all computers of your local network are configured to request pages through nanoweb/mod_proxy.
    mod_dosevasive optional Prevents your server from going down due to attacks following the »Denial of Service« routine.
    mod_multiviews optional MultiViews enables nanoweb to perform transparent content negotiation with or without support from the requesting browser.
    mod_meta optional Reads .html files and makes the content of <META HTTP-EQUIV> tags available as usual http response headers (for use by other extension modules as well).
    mod_fcgi optional FastCGI support.
    mod_mysqllog optional Log is written into a MySQL database.
    mod_stdlog optional Writes log to stdout (console).
    mod_rewrite optional RewriteEngine (powerful URI to filename mapping) allows you to introduce a very flexible virtual directory layer.

    various other goodies
    mod_method_PUT add-on Adds support for the "PUT" request method, which is used by some clients to upload files (something like FTP over HTTP).
    mod_method_TRACE add-on Enables Nanoweb to reply to requests with the HTTP "TRACE" request method, which can be used to echo the incoming HTTP request.
    mod_method_handler add-on Allows to use CGI's to extend nanoweb with non-standard (user defined, experimental or other extension protocol) http request methods.
    mod_access_rbl add-on RBL checks (see mail-abuse.org/rbl)
    mod_emailprotect add-on Encodes <A HREF="mailto:..."> to hide email addresses from spambots. It does so by requiring to POST submit a <FORM> before a mail address gets clearly readable.
    mod_access_referer add-on Deny linking from external sites
    mod_bsp add-on Brainfuck Server Pages
    mod_asis add-on Support for apache-style .asis files, which carry http headers before the actual content.
    mod_lnk optional This module allows to use .lnk files to reference to another filesystem location or remote proto:// source. Additonally enables Win32 visual shortcut files to be used like symlinks.
    mod_digest add-on Computes the MD5 checksum of transmitted static content if the ContentMD5 directive activates it.
    mod_throttle add-on Allows to limit the download transfer speed to a fixed amount for all requests to the specified server, vhost or directory.
    mod_libphp (useless) add-on guessworking internal-PHP-execution module
    mod_worms add-on Module that warns you about attacks targeting to scripting bugs regularily found in IIS (no problem with nanoweb usually),
    but please refer to the README on mod_worms.
    mod_fb2 add-on Alternative filebrowser module (lists directory contents, when no "index.html" is there). This one is more icon centric than the recommended mod_fb.
    mod_msff add-on Microsoft®-Free Fridays is a campaign against IE's »Smart-Tags®«.
    mod_unzip add-on Allows serving files from inside ZIP archives (while still allowing the .zip to get downloaded as usual).
    mod_gunzip separate Decompresses gzip encoded files on the fly if a client without support for transfer encodings requests such a pre-compressed file. This module so does the opposite of mod_gzip. It is believed that this method is faster than using mod_gzip because most browsers support gzip nowadays, and even if one didn't, decompression is much faster than compression.
    mod_mysql_scheme separate This PHP extension module introduces a mysql:// access fopen handler. It is intended to be used with mod_lnk to allow access to "files" contained in a column of a MySQL database table.
    mod_mp3 separate Makes your mp3 collection available through a www interface.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/nanoconfig.html0000644000000000000000000000316311023557654017164 0ustar rootroot nanoconfig
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    nanoconfig

    Starting from 1.9.0 an online configuration utility is distributed with nanoweb. It allows you to do an initial setup of most of the directives by giving short informations on the options, it doesn't however try to replace the manual.

    To let this small tool work, you need to change some things for UNIX/Linux, WinNT and successors. As the tool is implemented as .php web script it cannot write to the nanoweb config files, of course, so you need to allow that with:
    chmod a+rw /etc/nanoweb/*

    Please revoke these writing rights after you've finished configuring!

    Remember, this is not necessary for Windows 4.x (95,98,ME).



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_throttle.html0000644000000000000000000000205611023557654017547 0ustar rootroot mod_throttle
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_throttle

    Can limit downloading from your server to a fixed average throughput. See the description of the Bandwidth directive.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/nwaccess.html0000644000000000000000000000563511023557654016657 0ustar rootroot .nwaccess - per-directory configuration files
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    .nwaccess - per-directory configuration files

    Most of the configuration directives that are understood in the main server configuration file (/etc/nanoweb/nanoweb.conf) are also allowed to be used in the per-directory config files. The format of that files is the same as in the main server config file.

    These files can be placed in every directory below the docroot and must have the filename set by the AccessFile directive (in main server config file); per default the name of these files is .nwaccess. In apache these files are called .htaccess, but as however only a few directives are fully equal to that of apache, you most likely want to have these different names for them; see apache compatibility issues if you would like to merge them.

    example of a .nwaccess file:
    # .nwaccess
    # comments start with the hash sign
    
    FBSortOrder = date desc
    # will let the directory listing be ordered by modiftime, last first
    
    ErrorDocument = 403 errorpage.html
    # output customized error page
    
    RewriteRule ^(*.tgz)$  /cgi-bin/log_download.php/$1  [nocase]
    # binary files go through a .php script
    


    If you give a directive in the .nwaccess file it will most likely override the one specified in the main server config file. This behaviour can be tweaked by setting AccessPolicy to block, override or merge. This default behaviour can then differ for some directives if you change it using AccessBlock, AccessOverride or AccessMerge.

    Note that starting of nanoweb 1.8.1 you may omit the equal sign for assigning values to the directives. This is true for the main config file (nanoweb.conf), too.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/performance.html0000644000000000000000000000660011023557654017343 0ustar rootroot Performance Hints
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Performance Hints

    On this page we'll collect some recommendations telling you how to configure nanoweb to get it to operate at highest speed possible.
    • disabling extensions you don't want to use is almost always a very good idea

    • HostnameLookups lead to some network traffic and delay time, so you probably want to disable this if you need more speed. Another good solution to skip this overhead for the server is to let the logger processes resolve the hostnames after the page already has been delivered; see HostnameLookupsBy for this / or you could completely skip this step and let some log file analyzing tool do these DNS lookups.

    • the libphp module is not faster than mod_cgi in general, it currently only seems to give you many disadvantages if used. It may be a bit more speedful than using the php cgi interpreter if your server load is _often_ very high.

    • using mod_rewrite generally slows down the server as it needs to re-read the .nwaccess/.htaccess files for every subdirectory files are requested from, and additionally the regular expressions are a real treat to server speed

    • the content negotiation method of mod_multiviews only comes into use if the requested file doesn't exists on the server, so the file search and regular expression matching shouldn't occur all the time and therefore doesn't slows down the serving process.
      So most of the time it shouldn't be a performance problem using multiviews, when it is used only to select the primary html document.
      However not specifying the filename extions in your <IMG>-tags and let the server select the appropriate one is probably a bad idea unless you don't serve different language variants of a picture (containing some rendered text of course!), multiviews cannot select the best variant out of GIFs and PNGs for example, because most browsers just request image/* (of any type) without telling wether they support any of the formats (-> thats why you should favour PNGs in general ;-).

    • mod_mysqllog should work on the same speed level as standard file or syslog logging, using the database one probably won't lead to more speed.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/ssl.html0000644000000000000000000000650111023557654015643 0ustar rootroot SSL with nanoweb HOWTO
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    SSL with nanoweb HOWTO

    First, nanoweb has no official support for HTTP over Secure Sockets Layer (also known as HTTPS).

    There is however a mean to make it work, with some help from the popular "stunnel" application.

    Starting from version 1.8.0, nanoweb supports running as an inetd service, and this is necessary for wrapping nanoweb with stunnel.

    Prerequisites

    Installation

    1. If you already have setup nanoweb in inetd mode, you may want to backup your non-SSL config files as you probably want to host different virtual hosts for http and https.
    2. Generate a certificate for nanoweb:
      root@www:~# cd /etc/ssl/certs
      root@www:/etc/ssl/certs# openssl req -new -x509 -nodes -out nanoweb.pem -keyout nanoweb.pem -days 9999
      root@www:/etc/ssl/certs# ln -s nanoweb.pem `openssl x509 -noout -hash < nanoweb.pem`.0
    3. Copy the wrapper script /usr/sbin/in.nanoweb to in.nanoweb-ssl; comment the line for normal operation and uncomment the ones for SSL (stunnel).
      You want these two files to keep nanoweb operating as plain http server on port 80, but also over SSL via stunnel.
    4. uncomment the https line in your /etc/inetd.conf (this line was already written to there by the nanoweb install-sh)
      # nanoweb inetd support
      www   stream tcp nowait root /usr/sbin/in.nanoweb nanoweb
      https stream tcp nowait root /usr/sbin/in.nanoweb nanoweb -ssl
      

    Testing

    Once all this is done, open your favorite SSL enabled web browser, and try to open "https://localhost". If it works, you should see the default web page, and your browser should tell you some things about the cert not being signed by a trusted authority (this is not a bug, just send your CSR for signing to a trusted CA if you want).

    If it does not, stunnel log files are quite informative :)


    See also the text versions of this HOWTO about SSL support for nanoweb.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/updates.html0000644000000000000000000000242211023557654016505 0ustar rootroot Download Latest Version
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Where to get it

    The website for nanoweb is http://nanoweb.si.kz/.

    There you'll find an announcement for the latest stable/official release.

    The download location for nightly builds is hidden deeply in the nanoweb board, as these are intended for developers only (they may not work, and there's absolutely no support for them).


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/vhosts.html0000644000000000000000000000400711023557654016367 0ustar rootroot Virtual Hosts
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Virtual Hosts Configuration

    The configuration files of nanoweb usually reside in the /etc/nanoweb/ directory. Nereby the main configuration file »nanoweb.conf« you'll find the file »vhosts.conf« which should contain the directives to setup separate configurations for the »virtual hosts«, which are just other directories bound to other servernames than the main one.

    In the vhosts.conf you start a new virtual host with its DNS-name in square brackets: [www.example.com] followed by all the common directives you can use in the main configuration file, like DocumentRoot, ServerAlias and FileBrowser, ...

    an example:
    [www.example.com]
    ServerAlias       = www.example.org
    DocumentRoot      = /var/www/nanoweb/vhosts/www.example.com
    Log               = /var/log/nanoweb/access_www.example.com
    

    You could add [/www.example.com] below this, as section names beginning with a slash [/whatever] tell Nanoweb to return to the [global] scope again.

    There can be a port number behind the virtual hosts name in the square brackets [www.example.net:8080].




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_meta.html0000644000000000000000000000716111023557654016632 0ustar rootroot mod_meta
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_meta

    The HTTP/1.1 specification recommends, that parties involved in transfer of hypertext files should evaluate the <META HTTP-EQUIV> header tags of HTML pages as they would usual http transfer headers.
    <HTML>
     <HEAD>
       <META HTTP-EQUIV="Content-Type" CONTENT="text/html">
       <META HTTP-EQUIV="Refresh" CONTENT="5; URL=page2.html">
       <META HTTP-EQUIV="X-Note" CONTENT="Nanoweb rulez">
    ...


    mod_meta reads html files and makes these fields available in the actual http responses, as well as to other nanoweb modules which may want to see these additional http headers. All recent browsers understand these HTML-internal header fields, but proxys and webservers should be aware of them, too. However one can assume that proxys are regularily not, so this module is a good idea if you want to assure that the actual content is handled correctly by all involved http software.

    Besides this, mod_meta reads companion .meta files that may exist and also makes the http headers found therein available in the http response. One could do this with mod_asis also, but for binary files this method is much easier to realize. The companion files require to have exactly the same name as the files to which the meta data should be added plus ".meta" at the end. If your file would have the name "example.html" the companion http headers file needed to have the name "example.html.meta". These files may only contain http header lines, no empty lines and especially no comments:
    Content-Type: text/html
    Content-Features: tables, javascript, css, color, graphic
    X-Note: Nanoweb rulez!
    


    How this module reads the META tags from the HTML files can be defined with the MetaFetch directive. The value 'fast' is the default and makes mod_meta use very fast string artithmetics to grep the content of the tags out of the html head. This however only works if these headers are in the form seen above (case doesn't matter of course).
    If you want more reliability than you could use 'regex' instead, which also makes standard META tags (author, description, ...) available to other modules. A value of 'no' makes mod_meta not evaluate the html files, so only the .meta files are appended to the http response headers (the headers don't get available for use by other nanoweb extension modules currently).
    You can effectively disable mod_meta with MetaFetch=0, this is useful if you want it to activate for some directories and files only.


    bugreports are welcome: mario@erphesfurt·de


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_dosevasive.html0000644000000000000000000000334111023557654020050 0ustar rootroot mod_dosevasive
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    »Denial of Service« Evasion

    Everybody has probably already herad of DoS-attacks that try to bring down servers through many senseless queries in a short time period. The extension module mod_dosevasive tries to detect and reject such requests by simply restricting the amount of queries in a specified period of time from one of the requesting clients.

    The algorithm needs of course some fine tuning to meet the power of your server machine (big ones are less likely to go down because of 1000 requests per second). The configuration directives you may want to check out are DosEvasiveTimer and DosEvasiveMaxReqs. With DosEvasiveError you may change the error response code which gets sent back if an attack is detected.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_ac.html0000644000000000000000000000364611023557654016273 0ustar rootroot mod_ac
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Access Control module

    The access control module mod_ac is loaded per default and allows you to restrict retrieval of web pages from your server to specified hosts or to disallow this only for some.

    The directive ACPolicy gives the default for all hosts. If it is set to allow everybody can access pages of your server. This is the default bahaviour for public www servers, but for intranet systems where you only want local hosts to get access you could use deny as default and list all your local servers in one or more ACAllowIP or ACAllowHost directives.
    Likewise you could use ACDenyIP and ACDenyHost in the former case.

    If one of the requesting hosts isn't granted access it will receive an error page which you can customize using ACBlockError and ACBlockMessage.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_asis.html0000644000000000000000000000351011023557654016635 0ustar rootroot mod_asis
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_asis

    This module allows you to use the .asis 'file format', which is a file carrying some http response headers before its actual content:
    Content-Type: text/html
    Last-Modified: unknown
    
    <HTML><HEAD><TITLE>example</TITLE></HEAD>
    <BODY BGCOLOR="#ffffff">...
    


    Currently mod_asis is an extension of mod_static and requires to be activated with the ParseExt directive in the nanoweb main configuration file:
    ParseExt = asis asis
    
    The first argument gives the file extension which the .asis files need to have, while the second lowercase 'asis' defines the parser class of mod_asis to be used.

    This works very well for text/html files, but for files containing binary content you should consider using mod_meta and a companion *.meta file carrying the headers instead.




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_method_handler.html0000644000000000000000000000345111023557654020657 0ustar rootroot mod_method_handler
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Extension Protocol and User Request Methods Support

    With the MethodHandler directive you can dedicate a CGI script to handle non-HTTP request methods (or these that are not implemented in the Nanoweb core).
    MethodHandler = FASTFETCH /cgi-bin/handle_FASTFETCH_request.pl
    MethodHandler = UPDATE /cgi-bin/UPDATE_method.exe
    


    The CGI scripts see the requested URL in the $PATH_INFO environment variable and the actual content of the HTTP request appears in <stdin> if there was any, so these handlers work much the same like the handlers of mod_misc_filters.

    Note: User defined request methods cannot be utilized with standard browsers, not even with <FORM METHOD="mymethod"...>, so you'll need dedicated http clients to make use of your extension.


    bugreports are welcome: mario@erphesfurt·de


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_method_put.html0000644000000000000000000000430111023557654020045 0ustar rootroot mod_method_PUT
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    PUT request method

    The PUT request method as defined in RFC2068 (HTTP/1.1) allows clients to upload files to the server much like with FTP. This is normally not desired, so it is encapsulated into an extension module for Nanoweb.

    The PUT file upload feature should only be enabled for some dedicated directories using the WriteAccess directive in one of the .nwaccess files. Additionally to this, files can only be overwritten if they were made "world-writable" using chmod o+rw example.file. You could also make a whole directory writeable or chown the writeable files to the user or group id Nanoweb runs with.

    Important: For your security you really should make only single files writeable or disable executing of CGI scripts in a dedicated directory, or else anybody may execute arbitrary script code on your server and thus easily spy sensitive data. See the ForceHandler directive on how to prevent uploaded files from being parsed as cgi scripts.
    Also very important is to keep the setting "IgnoreDotFiles=1", or else anybody would be able to remove your .nwaccess file.


    bugreports are welcome: mario@erphesfurt·de


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_pgsql.html0000644000000000000000000000407511023557654020054 0ustar rootroot mod_auth_pgsql
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    PostgreSQL Authentication Module

    This module can access a PostgreSQL database to fetch user names and passwords for http authentication from it. Works like mod_auth_mysql for MySQL databases.
    As you can have several different authentication method modules loaded in nanoweb, you must select this one for the directory where authentication is required (following directives must be put in the .nwaccess file):

    AuthRealm = realm name
    
    # use the postgres database login lookup module
    AuthRequire = PGSQL
    
    # following directives specify the database and the server
    # it is running on as well as the db access password
    AuthPgsqlHost  = localhost
    AuthPgsqlUser  = db_user
    AuthPgsqlPass  = db_pass
    AuthPgsqlDB    = db_name
    
    # you can use any existing table that contains
    # login/password pairs, by giving this authentication
    # module the correct table and column names
    AuthPgsqlTable = table_name
    AuthPgsqlLoginColumn = login_field_name
    AuthPgsqlPassColumn  = password_field_name
    
    # "plain" if the password lies unencoded in the database,
    # "md5" if the system hash function was used
    AuthPgsqlPassType = plain | md5
    





    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_ldap.html0000644000000000000000000000322011023557654017635 0ustar rootroot mod_auth_ldap
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_auth_ldap

    This module allows to use authentication data from LDAP.

    AuthLDAPServer = ldap.example.com
    AuthLDAPBindDN = cn=%AUTH_USER%,ou=people,dc=example,dc=com
    AuthLDAPMatchFilter = (&(attrfilter=val)(httpaccess=on))
    
    


    In AuthLDAPBindDN, %AUTH_USER% is replaced with the actual login provided by the HTTP client. You may also use %AUTH_USER_U% and %AUTH_USER_D% if you want to allow user@domain type logins.

    In order to activate the authentication to take place for one of the directories on your server, you must place the following two directives in one of the .nwaccess files:

    AuthRealm = place some information here
    AuthRequire = LDAP
    




    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_fb2.html0000644000000000000000000000443511023557654016356 0ustar rootroot mod_fb2
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_fb2

    mod_fb2 can be used alternatively to mod_fb - read: there can only one of them be loaded into the server!

    It evaluates the configuration directives of mod_fb, but it presents directory listings in a more icon centric way.
    The generated output does not contain some of the information the tables of mod_fb usually do. The size and last_modified_date for example are attached to the "icons" as <IMG TITLE> and thus are not shown by all browsers. The page will show up even more differently for non-graphical browsers, where the mime types are visible instead of icons.
    Be aware, that many users may not like the output generated by this filebrowser module.

    The directives effictively supported are:



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_msff.html0000644000000000000000000000533111023557654016634 0ustar rootroot mod_msff
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Microsoft-Free Fridays

    »Microsoft-Free Fridays« is a campaign against the »Smart-Tags« which are external pop-up hyperlinks to be included within one of the next versions of the MS Internet Exploder.

    This campaign was initiated by Dave Winer. Find more about it at Smart Tags are stupid.

    This module implementetion checks the current day to to be friday and engages if the strings "MSIE" and "XP" are found in the 'User-Agent:' request header, as Smart-Tags enabled IEs won't be available for previous versions.
    You can additonally engage the module for different weekdays as well by using the "MicrosoftFree" directivem where the days must be written numerically where Monday is 1, Tuesday 2 and so on (like in crontabs):
      # Tuesday, Friday, Sunday
      MicrosoftFree = 2 5 7
    Note that the module will however always print "Microsoft-Free Fridays" regardless of the current weekday.

    This is what the output will look like:

    403 Forbidden

    An error occured trying to access document or resource /.

    Happy Microsoft®-Free Friday!

    In support of freedom of choice in browser software, this web site is Microsoft-Free on Fridays. Please use any browser except MSIE to access this web site today.

    Please contact the server administrator if the problem is abnormal and persists.


    Page generated by aEGiS_nanoweb/2.0.1 (Linux; PHP/5.0.0-dev) at http://localhost



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/faq.html0000644000000000000000000001231211023557654015606 0ustar rootroot known bugs and common problems (OAQ)
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Common Problems
    (Occasionally Asked Questions)

    Bugs in Nanoweb are often resolved only minutes (!!) after they get reported. There are however not only bugs in Nanoweb, most problems result from misconfiguration or bugs of the PHP scripting language interpreter.
    problem why and where?
    "Security Alert! The PHP CGI cannot be accessed directly." Your PHP interpreter was probably compiled using --enable-force-cgi-redirect. This option is recommended for the Apache webserver for security reasons. Nanoweb installations are however less vulnerable to such attacks and therefor you should disable this paranoia setting in the php.ini with:
    cgi.force_redirect=0
    or better in the nanoweb.conf using:
    AddServerVar = REDIRECT_STATUS 200
    Nanoweb is that slow under Windows!! (Only one person can connect at a time) This is because nanoweb must run in the SingleProcessMode because current PHP.exe versions do not provide a wrapper to the POSIX fork() system call (which exists as a variant at least for NT). If you know how to do, you could compile PHP yourself using the Cygwin GCC to get a fully working version.
    Another solution is to run Nanoweb in inetd mode using a binary ineternet superserver. Such a inetd.exe can be retrieved at Cygwin, some Shareware and Commercial implementations are also available and newer NT versions reportedly supply some sort of inetd. The next release of the Winstaller will probably contain a preconfigured one.
    PATH_INFO is empty / not passed to my scripts if the referenced file exists This is a PHP bug introduced with 4.3.0. Someone "enhanced" the CGI-version of the PHP interpreter to "correct" this CGI environment var. Stupidly Nanoweb handles and sets the PATH_INFO correctly (if it wasn't disabled with CGIFilterPathInfo or AllowPathInfo which were necessary for older PHP versions with much more heavy PATH_INFO related bugs). Btw, Nanoweb is not vulnerable to the attack that misleaded the PHP authors to damage the CGI version that way.
    To prevent PHP from garbaging the CGI environment variables, you must add the directive cgi.fix_pathinfo=0 to your php.ini.
    nanoweb.php does not respond to commandline parameters See your php.ini and activate "register_argc_argv" as this is defaultly disabled (because commonly not used in PHP webscripts).
    "FATAL: function 'socket_create' not available, aborting" Your PHP interpreter does not support all the socket_* functions, which are necessary for nanoweb to operate as server daemon. If you use a distributed (precompiled in a win or linux install package) PHP your lucky: just activate the extension module in the php.ini ("extension=php_sockets.dll). Otherwise you must recompile your interpreter using the --enable-sockets switch to the configure script.
    Output of .php (.cgi) scripts are empty pages This usually happens if the CGI interpreter cannot be found, and thus the script won't be "executed" correctly. Check the ParseExt directive in your config files, and change the path name of your script interpreter.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/themes.html0000644000000000000000000000566711023557654016343 0ustar rootroot theme_template
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Themes for server generated responses

    Nanoweb allows to use themes for server generated output like error messages or directory listings.
    The look and feel of all error messages can now be changed very easily and quickly, because the actual themes are rather simple and thus can be changed to your needs with only little time effort.

    The default.theme file gives also a good example on how to include response messages in different languages (which Nanoweb selects automagically based on the browsers configured preferred language). After creating your own custom theme file, you just need to load it with the LoadTheme directive and enable it where needed using ServerTheme.

    currently available themes
    default.theme core This is the theme file which gets applied to all server messages, until you define another one. It looks as plain as the server messages from all other common webservers, but contains already some translations.
    fancy.theme core Generates more icon-centric directory listings. It utilizes client-side Javascript to achieve correcter table layouts, which may be a hurdle for some search enignes and outdated browsers. How the name tells it is really fancy nevertheless and thus worth to give it a try! (your servers visitors will thank your)

    If you create a pretty server message theme, just feel free to send it to sIX for inclusion with the next release or extension repository.



    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_method_trace.html0000644000000000000000000000251111023557654020334 0ustar rootroot mod_method_TRACE
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    TRACE request method

    The TRACE request method as defined in RFC2068 (HTTP/1.1) says the webserver to echo the HTTP request headers as they were seen by the server originally.

    As the spec says this can be used to discover if a proxy or something else in between the client and the server distorted the http request (the cgi-nanoweb-wrapper for example usually does this).


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_lnk.html0000644000000000000000000000473311023557654016472 0ustar rootroot mod_lnk
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    .lnk files

    A .lnk file can be used to redirect to another location whithin the filesystem or to point nanoweb to some more virtual proto:// file source.

    If you create such a .lnk file it should just contain a line with the destination path or URI:
    /path/to/other/directory/   
    or
    ftp://ftp2.example.com/export/www/
    If a request http://www.example.com/a.lnk/this/file.txt for a .lnk file with a trailing path_info is detected mod_lnk will redirect Nanoweb to the given path or file.

    Of course this is not really impressive and could be done much more easily using syminks or the Alias directive, but as it comes to "virtual" file sources this module may help you. As seen above you can redirect to URLs as well. The ftp:// and http:// are already known to PHP and can be used here. Other extension modules (like mod_mysql_scheme) may introduce more strange protocol sources for use with mod_lnk.

    mod_lnk parses Windows' visual shortcut files as well to come around the lack of symlinks under Win32 systems. It currently seems to work for most .lnk files, but you should prefer the one-line .lnk file format as described above.

    To enable mod_lnk and .lnk files you must enable it using the ParseExt directive in nanoweb.conf:
     ParseExt = lnk LNK
    

    Note that requests to files redirected with .lnk files are currently handed over to nanowebs static_response() and thus cannot be .php scripts for example.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/manual.css0000644000000000000000000000203511023557654016141 0ustar rootroot body { background-color:#608a8e; color:#000000; margin:10px; padding:10px; } div.body { min-width:300px;max-width:720px; background-color:#ffffff; padding:17px; border:2px #000000 solid; -moz-border-radius:10px; border-radius:10px; } a:link { color:#204a4e; } a:visited { color:#204a4e; } a:active { color:#204a4e; } a:hover { color:#ee2a20; } hr { color:#063239; } kbd, var { background-color:#E7F7E7; } pre.samp, pre.code, xmp, samp,code { background-color:#DCDCE3; border:1px dashed #888899; } blockquote { background-color:#FFFFEE; border:1px solid #FFEEEE; } .directive { background-color:#333333; color:#ffffff; border:solid 2px #7777CC; padding:3px; } div.directive hr { display:none } .navline { text-alignment:justify; } .navline a { text-decoration:none; font:70% bold; color:#063239; } dt { font-weight:bold; margin-top:1px; background-color:#ddddee; } dd { margin-bottom:10px; margin-top:1px; background-color:#eedddd; } a[name] { text-decoration:none; } nanoweb_2.2.9/docs/manual/mod_auth_anydb.html0000644000000000000000000000645011023557654020022 0ustar rootroot mod_auth_anydb
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_auth_anydb

    If you don't use one of the common databases like MySQL or Postgres, you may want to utilize one of the database abstraction interfaces for database based user authentication: To use it you must first get one of these wrappers (PEAR is usually part of PHP, and the dbx is a compile-time PHP extension).

    The AnydbLoadInterface (to include the PEAR::DB or ADOdb wrapper - not dbx!) must be given before the A HREF="core.html#loadmodule">LoadModule directive of mod_auth_anydb.php!

    The database to be used is specifed in a DSN-like syntax using the directive
     AuthAnydb = database://dbuser:password@dbserver.example.com/dbname/table
    

    When you specify the database to search authentication data (user/login names and their passwords) for, you must use the database abbreviation your database abstraction layer is using (PEAR, ADO, dbx). In their current versions, there are:
    PHP dbx mysql, odbc, pgsql, mssql, fbsql, sybase_ct, oci8
    PEAR::DB fbsql, ibase, ifx, msql, mssql, mysql, oci8, odbc, pgsql, storage, sybase
    ADOdb access, ado, ado_access, ado_mysql, db2, vfp, fbsql, ibase, firebird, borland_ibase, informix, informix72, mssql, mssqlpo, mysql, mysqlt, maxsql, oci8, oci8po, oci805, odbc, odbc_mssql, odbc_oracle, oracle, postgres, postgres64, postgres7, sqlanywhere, sybase

    You should however have a look at the documentation of your db abstraction layer.

    The password column can be either the plain or the crypt() or md5() encoded string. You do not need to give the encoding type, because this is auto-probed.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_emailprotect.html0000644000000000000000000000273511023557654020376 0ustar rootroot mod_emailprotect
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    Email Address Protection

    The mod_emailprotect searches for mailto: links inside served text/html content and encodes them, so that the client/user is required to first go to secondary page and second initiate a FORM POST submit, before the mail address gets clearly readable.
    This procedure is believed to protect email addresses against spambots of the marketing mafia.

    The module itself works rather automatically (after being loaded), but you want to adjust some of the paramters on top of this modules source from time to time.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_auth_anonymous.html0000644000000000000000000000263111023557654020752 0ustar rootroot mod_anonymous
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_anonymous

    The "anonymous login" authentication module grants users access to a restricted area on your site, if they login with the username 'anonymous' (or whatever else is allowed with AuthAnonymousNames) and their email address as password.
    This is pretty much like the well-known "anonymous ftp login".

    Additonally this module allows to verify existence of the given email address (see AuthAnonymousSmtpCheck).


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/manual/mod_access_referer.html0000644000000000000000000000260311023557654020653 0ustar rootroot mod_access_referer
    [NANOWEB DOCUMENTATION]

    NANOWEB, the aEGiS PHP web server

    mod_access_referer

    The mod_access_referer checks the HTTP referer of every issued request and may reject them if the referer does not match a set of criteria : matches the server name (local referer) or any other listed in a ReferAllow directive.

    Even when loaded, mod_access_referer is not active and you must explicitly activate it in nanoweb.conf, vhosts.conf or a .nwaccess file using the RefererCheck directive.


    NANOWEB, the aEGiS PHP web server

    nanoweb_2.2.9/docs/README.cgi-nanoweb0000644000000000000000000001742111023557654015752 0ustar rootrootServerMode = cgi ================ This document describes how to use the Nanoweb HTTP Server as secondary engine below a running Apache. This procedure does not only sound strange, it is in fact not recommended; so if you've got the chance to run Nanoweb in standalone mode, you should do so. Why use it? ----------- If you however have a evil provider who crippled the Apache configuration to make "your" server partially unusable, this operation mode of Nanoweb may help you to come around most of the problems. Another good reason to use this is that Nanoweb is much more easily extendible than Apache; and even if you'd know how to write Apache extensions you probably didn't get access to your providers /etc/apache/httpd.conf to activate them. Step By Step ------------ (1) Setup a running Nanoweb on your homebox, tweak the configuration files to your needs, and load all wanted extensions modules. (2) Build a large nanoweb.php »binary« using the "mkhugenanoweb.php" utility. This step is not necessary, but recommended, because a large nanoweb binary starts up much faster, and as we will run it in fact in »inetd mode« later this is a good idea. (3) Create a subfolder /nanoweb/ in the docroot on the machine running the Apache server. - Install your "large" nanoweb.php into there (or alternatively the real nanoweb.php with all its modules and the configuration files). - You may also wish to place a php-cgi binary to there. - Copy the "cgi-nanoweb-wrapper.php" into this folder, too. (4) Change the config vars inside "cgi-nanoweb-wrapper.php" to suit your installation: - $NANOWEB_BINARY=... - requires the absolute path of where you installed your (large) nanoweb.php to. - $FAST_INLINE_NANOWEB=1 - is now the recommended setting, but may not always work reliable. - $PHP_BINARY=... - is only required if you set $FAST_INLINE_NANOWEB=0, because then another copy of the PHP interpreter must be used to run the Nanoweb subserver. Note that you also have to change the configuration settings inside nanoweb-large.php (or config files) to allow .php scripts to be executed via your uploaded PHP binary. (5) Add these lines to Apache's .htaccess file (in the docroot), to activate the Nanoweb subserver: # if mod_rewrite is activated inside Apache, you are able to # redirect any request through Nanoweb: RewriteEngine On RewriteRule .* /nanoweb/cgi-nanoweb-wrapper.php [L] # you could also only let Nanoweb serve requests, where Apache # failed (files not found, no access, etc.) ErrorDocument 200 /nanoweb/cgi-nanoweb-wrapper.php ErrorDocument 403 /nanoweb/cgi-nanoweb-wrapper.php ErrorDocument 404 /nanoweb/cgi-nanoweb-wrapper.php ErrorDocument 500 /nanoweb/cgi-nanoweb-wrapper.php # You could enforce the "500 error" with some forbidden (but # well known) directives inside the .htaccess. # Use this trick if your evil provider disabled even mod_rewrite # The ErrorDocument 404 is the most recommended setting, as this # passes only the requests to Nanoweb where Apache failed to # find the according file (mod_rewrite or Multiviews disabled) You should test then if requests are passed over to Nanoweb. This can be determined by looking at the HTTP response headers, a "X-Server: nanoweb" should appear there. If things don't work -------------------- PHP scripts don't Set the "_parseext" directive inside your large get executed nanoweb.php or inside the server configuration files. You need to give the path to the php-cgi interpreter (you probably need to upload one, as most apache installations are using an internal libphp version). 500 Infernal This is a message from Apache. You wrote an Server Error incorrect config directive in the .htaccess file, and Apache does not understand it. Use the ErrorDocument trick from above to pass the request to Nanoweb. Waiting endlessly You probably tried to run a Nanoweb below another for the page Nanoweb, possible but very silly. POST requests POST requests can easily be reconstructed in PHP are not working version 4.3.0 or later (from php://input stream). For previos versions the wrapper tries to set a php.ini setting which allows to easily fetch the whole POST request body from the PHP variable $HTTP_RAW_POST_DATA, but the result of this trick is unpredictable. The last chance to rebuild the POST request is to try to reconstruct it from the contents of $_POST - very stupid approach and even more error prone. File uploads are The problem is again, that POST requests need to not working be reconstructed from the variables PHP makes from the original request, and this is very effortful for file uploads and thus guessworking. If it is all that important you could switch to 4.3 or enable "always_populate_raw_post_data" in your php.ini to help the wrapper to see the original POST requests. Error 500 Request The wrapper failed to rebuild the POST request. Body Unavailable This should not happen, usually the wrapper rebuilds For Subserver it (even if it's content's are wrong). May be this was triggered by a PUT (HTTP/1.0) or BREW request (HTCPCP/1.0). POST data disappears If you called the wrapper via Apache's ErrorDocument directive then the POST request data never reaches the nanoweb-wrapper (at least for most Apache 1.3 versions). No workaround, you should prefer the RewriteRule method to execute the nanoweb wrapper. Error 500 Subserver The $NANOWEB_BINARY could not be opened in FAST Misconfiguration mode. You have to give the absolute path name of it. Error 500 File I/O Check the $TMP_DIR variable. ??? Go to the nanoweb support forum, or mail mario17@web·de Security -------- If you upload a PHP binary into the recommended /nanoweb/ you shouldn't forget to deny access to this directory in the .htaccess and/or .nwaccess configuration files. (Installing the PHP binary into /cgi-bin/ is harmful only if you call it "php.cgi") Random Notes ------------ You could of course write a nanoweb-wrapper in another CGI language, say /bin/bash or /usr/bin/awk, but you may only wish to do this if your evil providers server has no PHP support at all. Btw this wrapper is probably rather fast, as the nanoweb.php can be executed inside Apaches libphp as well. - There is a commented line inside the 'SLOW' part of the wrapper which is intended to pass the path of your own PHP configuration file (php.ini) to the interpreter - if you would like to use your own, because your providers one is as damaged like the webserver configuration is. - This wrapper could also be renamed to "nph-nanoweb-wrapper.cgi". The output of CGI scripts whose name starts with "nph-" is commonly passed directly to the client without further parsing by the server. This is a very old feature from the early days of the WWW but may still be supported by some Apache versions. Don't forget to add the "#!/where/is/my/php" line on top of the wrapper script if you'd like to use it that way! You can and should use FAST_INLINE_NANOWEB even if this wrapper is called as .cgi and not libphp script. PHP 4.3.0 is very broken (as are many other -dev versions); the CGI response headline "HTTP/1.1 CODE Response" is not passed from within .cgi scripts, and thus the whole HTTP answers of nph-scripts becomes incorrect. You need to edit the source code. Edit the file "/php-4.3.0/sapi/cgi/cgi_main.c", go to line #280: if (SG(sapi_headers).http_response_code != 200) { Change the "!= 200" into ">= 100", this should fix it. You then need run "make" again to rebuild your php binary. - You may wish to disable $nww_apache_headers if, you see a "Status:" line appear in all the HTTP responses. This setting is necessary when Apache overwrites the "HTTP/1.1 CODE Response" header from Nanoweb. nanoweb_2.2.9/docs/README.mod_unzip0000644000000000000000000000102511023557654015556 0ustar rootrootmod_unzip ========= This extension module enables Nanoweb to read and serve files from inside .zip archives. To use it your PHP needs to be compiled with the zziplib extension (http://zzlib.sourceforge.net/). If it is loaded files inside the archive can be referenced easily using a regular pathinfo after the .zip filename: http://www.example.com/archive.zip/index.html Note that many other extensions like Multiviews won't work together with this module, so for example .php scripts from inside archive files won't be executed. nanoweb_2.2.9/www/0000755000000000000000000000000011023557654012571 5ustar rootrootnanoweb_2.2.9/www/default/0000755000000000000000000000000011023557654014215 5ustar rootrootnanoweb_2.2.9/www/default/index.html0000644000000000000000000000466711023557654016227 0ustar rootroot Welcome to Nanoweb !
    Nanoweb


    Welcome to nanoweb !



    Congratulations, you successfully installed nanoweb on this computer !

    If the server seems slow (images taking a long time to load for example), it may be because your PHP binary was not compiled with pcntl support. See INSTALL and "SingleProcessMode" in config file.

    You should now edit the configuration file and also have a look at the manual.

    You may also use nanoconfig to set up the server.

    For anything else, visit the nanoweb home on the web or mail the author.





    poweredbyNANOWEB
    nanoweb_2.2.9/www/default/poweredbynanoweb.gif0000644000000000000000000000440011023557654020254 0ustar rootrootGIF89aX÷ÿÿÿýýþúûü÷ùúô÷øáéëñõöîóôêïðìòó³ÉÌÊÙÛÏÝßèïðçîïæíîCJBIAH@G?G>E=Dw}E|‚P„Š[‹]’^’[‰Ž_Ž“a”c‘–g”™n˜ƒ¨¬…©­†©­€¡¥‹­±°´Ž¯³¯³•±´¡½ÀŸ»¾žº½£¿Â¤¿Â¢½À¦ÀëÄÇªÃÆªÂŵÈʽÐÒÁÓÕÂÔÖ¿ÐÒÅÖØÄÕ×âëìáêëåíîLSKRJQIPHOGNFMELDKMTNUMTOVNUIPPWOVQXQXPW SZ RYHN SY TZ SZ T[ U\ SZV]W^V]X_RXZ`W^Z`[a[b\b]d_eag#ek$ek'gm)hn+kq,kq+io-lr-lq/lr0lr.hm3nt5qw6rx6rw8sy9tz9ty:uz;v{ lQ@ø<ð м€ÐCÐK¼ãÏ@ú4`#“X:Ð@=`iË6å¤äP=¥´c…ÔsÉcP¢@<Áœ ´Ï$VðÀ.aEYÐqB9#X!‘#„áA!u¸‘e”áEÞÜ¡†•–á"G4Ï2•˜@Ì4qÍc\qÑÿ$Œ\4‘EíCˆÄ( ÅwŒà!hHðH „2^<Å7Å"}@ÁÁ!„2È#A¬Á…âÇ@2¥B0ŽSÜ"P/°ÐŠ˜hB å Å!|@`B®‡LáÍ ´€?SþPŸDA?Õ"EP(+P ¨ »°ÏÇ<3Fäðæ.O°ÑÀBò ÀOh"P6¨ò8ð"oæ@%²DáE¨û"…/LÑA°†*i¨¡„@–HA‚ Ø€<D %ðR3a€ÑL£V¨ÁÚB++++++++++>++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++ ++>++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++>++ ++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++ +++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<< .>>>>>>>>>>>>>>>>>>.>>>>>>>>>>.<<<<<<.<.<<<<<<<<<<<<<<<<<<<. <<.>>>>>>>>>>>>>>>>>>.<<<.<<<<.>>>.<<<<<<<<<<<<.<<.>>>>>>>>>>>>>>>>>>>>>>>>>>>> .<<<<<<<<<.>>>>>>>>>.<<<<<<<.<<<<<<.<<<<<<<<<<<<<.>>>>>>>.>>>>>>>>>.<<<.<<<<<<< <<<<<<<<<<<<<<<<.>>>>>>>>>>>>.>>>>>>>>>>>>>>>>>>>>>>.<<<<<<<<<<<<<<<.>>>>>>>>.> >>>.<<<<<<<.>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<.>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<<< .>>>>>>>>>>>>>>>>.>>>>>>>.>>>>>>>>>>>.>>>>.<<<<<<<<<<<<<<<.>>>>>>>>>>>.<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>.>>>>.>>>>>>.<<.<<<<<<<<<<<<<<<<<<<<< <<.>>>>>>>>>>>>>.>>>>>>>>>>.>>>>>>>.>>.<<<<<<<<<<<<<<<<<<<<<<<<.<<<.>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>.<<<<<<<<<.>>>>>>>>>.<<<<<<<.<<<<<<.<<<<<<<<<<<<<.<<.>>>>>> >>>>>>>>>>>>.<<<.<<<<.>>>.<<<<<<<<<<<<. <<.>>>>>>>>>>>>.>>>>>>>>>>>>.<<<<<<<<<<.>>>>>>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<. <<.>>>>>>>>>>>>>>>>>>.>>>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>.> >>>>>>>>.<<<.<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>.>>>>>>>>>>>>>>>>>>>>>>.<<<<<< <<<<<<<<<.>>>>>>>>.>>>>.<<<<<<<.>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<.>>>>>>>.<<<<<<<< <<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>.>>>>>>>.>>>>>>>>>>>.>>>>.<<<<<<<<<<<<<<<. >>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>.>>>>.>>>>>>.<<.< <<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>.>>>>>>>>>>.>>>>>>>.>>.<<<<<<<<<<<<<<<<<<<< <<<<.<<<.>>>>>>>>>>>>>>>>>>>>>.>>>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<. <<.>>>>>>>>>>>>>>>>>>.>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<.<<.>>>>>>>>>>>>.>>>>>>> >>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<. <<<<<<<<<<<<[>>>>>>>>>>>> >>>>.>>>>>>>>>.>>>>>>..>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>.>> >>>>>>>>>>.<<<<<<<<<<. <<<<<<<<<<<<.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.>>>>>>>>>>>> <<.<<<.>>>>>>>>>>>>>>>.<<<<<<<<<<.<<<<<<<<<<.>.>>>>>>>.>>>>>>>>>>>>.>>> >>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<.<<.>>>>>>>>>>>>.>>>>>>>>>>>>>>.<<< <<<<<<<<<<<<<<<<<<<<<. <<<<<<<<<<<<[-]]>>>>>>>>>>>> <<.>>>>>>>>>>>>>>>>.>>>>>>>>.>>.<<<<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>.<<<<<<<.>>>>>>>>>>>>>.<<<<<<<<<<.>>>>>>.<<<<<<<<<<.<<<<<<<< <<<<<.<<<<<<<.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.<.>>>.>.<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<.>>>>>>>>. >>>>>>>>.>>>>>>>>>>>>>>.>>>>>.<<<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>.<<<<<<<<<<<<.>>>>>>>>>>>.<<<<<<<.<<<<<<<<<<<<<<<<<<<<<<<. >>>>>>.<<<<<<.>>>>>>>>.>>>>>>>>>>>>>>>>>>>.>>>>.>>.>>>>.<.<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.>>>>.<<<<<<<.<<<<<<<<<<.<< <<<<<<<<<<<<.<<<<<<<.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.<<<<<<<<<<<<<.>>>>>>>>> >>>>>>>.<<<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.<<.>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>.<<<<<<<<<<<<.>>>>>>>>>>>.<<<<<<<.<<<<<<<<<<<<<<.<<<<<<<.>>>>>>>>>>>>>>>>>>>> >>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>.<<<<<<<.>>>>>>>>>>>>>>>>>>>>>> >>>>>>.<<<<<<<<<<<.>>>>>>>>>>>>>>>.<<.<<<<<<<<<<<<<<<<<<<<<<<<<<.<<<<.>>>>>>>>> >>>>>>>>>>>>>>>>>>>.<<<<<<<<<<<.>>>>>>>>>>>>>>>.<<.<<<<<<<<<<<<<<<<<<<<<<<<<<.> .>>>>>>>>>>>>>>>>>>>.>>>>.>>.>>>>.<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.>>>>.<<<<<<<.<<<<<<<<<<.<<<<<<<<<<<<<<.<<<<<<<.> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.>>.<<<<<<<<<<<<<<<<<.>>>>>>>>>>.<<<.>>>>>>>>>. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>. <<.<<<.>>>>>>>>>>>>>>>>>>>.>>>>>>>>.>>.<<<<.<<<<<<<<<<<<<<<<<<<<. <<.>>>>>>>>>>>>>>>>>>.>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<. >>>>>>.>>>>>>>>>>>>>>>>.>>>>>.<<<.<<<<<<<<<<<<<.>>.<<<<<<<<<<<<<<<<<<<<<<<.>>>> >>>>>>>>>>>>>>>>>.>>>>>>>>>>>.<<<<<<<<<<.>.<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>> >>>>>>>.>>>>>>>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<.>>>>>>>>.>>.<<<<<<<<<<.>.>>>>>> >>>.<<<<<<.<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>.>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<.>>> >>>>>>>>>>>>>>>>>>>>>>>.>>>>>>>>.<<<<<<<<<<<.>.<<<<<<<<<<<<<<<.<<<<<<<.>>>>>>>> >>>>>>>>>>.>>>>>>>>>>>>>>>.<<.<<<<<<<<<<<.>.>>>>>>>.>>.<<<<<<<<<<<<<<<<<<<<<<<< <<<<.>>>>>>>>>>>>>>>>.>>>>>>>>>>>>>>>.<<.<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>> >>>>>>>>>.<<<.>>>>>.<<<.<<<<<<<<<<<<<.>>.<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>.>>>>>>> >>>>>>>>>.<<<.>>>>>>>>>>>.<<<<<<<<<<<.<<<<<<<<<<<<<<<.<<<.>>>>>>>>>>>>>>.<<<<<< <<<.<<<<<<. >>>>.<<<.>>>>>>>>>>>>>>>.>>>>>>>>>>>>.<<<<<<<<<<.>>>>>>>>>>>>>>>>>>.<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<. <<.<<<.>>>>>>>>>>>>>>>>>>>>>.>>>>>>>>>>.<<<<<<.<.<<<<<<<<<<<<<<<<<<<. nanoweb_2.2.9/www/vhosts/0000755000000000000000000000000011023557654014117 5ustar rootrootnanoweb_2.2.9/www/vhosts/www.cgidemo.com/0000755000000000000000000000000011023557654017126 5ustar rootrootnanoweb_2.2.9/www/vhosts/www.cgidemo.com/poweredbynanoweb-black.gif0000644000000000000000000000530711023557654024246 0ustar rootrootGIF89aX÷ÿÿÿýýþúûü÷ùúô÷øóö÷ñõöäèéßèêîóôéîïìòóéïð³ÉÌçîïæíîCJBIAH@G?G>E=Dw}AyZŠ]’`”c‘–g”™ƒ¨¬¦ª€¡¥‹­±¯³•±´Ÿ»¾žº½¤¿Â¦ÀëÄÇªÃÆ©ÂÅ‹ž ¬¿ÁµÈʽÐÒÁÓÕ¿ÑÓÆÖØ©±²ØáâáêëåíîLSKRJQIPHOGNFMELDKMTNUMTOVNUIPPWQXQXPW SZ RYHN SZ SY TZ T[ SZV\W^X_RXZ`[a\bag#ek$ek'gm(hn+kq,kq+io.lr3ms5qw6rx6rw8sy9tz|Т2£J8vP‘ÄÜó*;h«¯*`ï©eaìÿ€q)ÀºŠ+ kMŸäˆ;kÇYÉÏ÷ž…Ò¼¾ëdMVß*óåÀW#eá€*†ÌÒÈ4ô<äO:<HÀh“SC’‘ÅÂv,€Gh›åàÚsmQb Yp¤˜¾VL~`È ;ÈQ;È43É•ÀÎC’Õ§*bØ!%È“P„HI’ªÙו¨Ly_7®^8ìQL:ÍÃÌ7èhC¼· 9㈣ðˆ3Îâ¸?èàÇ Ï<³À&><ÃŒ3e%Z4>dò 4Ýx“£ŽêÖX3Í4Œ’é3—¸ðXCî\C€/Ó¤³ -MŒ@/@ÿ`œ:Ü Á@PÍ<냟2γ@©üŒ3<ð€0ܰN0à‹3ˆƒŒ 0Ð/Ù2ð@( ®1Ô†¨8ý(46ÃøB߬…ÃÜu ãM61dázt•N2‰àHY,¡„”P‹K¼ð =á#BìÒ>×¼†€ÁÅ$KF+dt¡Å¾´l “>Ûô’‰Z˜ 5šQÇ,X0ÁD¢<# G@!„°PÃL2mL0‰GA†#´±Å#àÁ ˜³-RQÄ$Ö ó "Œ¡FcÀÑFlŒPCA¤á†kLÿ!Îx…P8ØËH(RÖ#œ ÂxäQ"e½piD@BÊ(­˜` 8ƒè J„A‚m(ƒ 4‰QE'<ƒM’›0BŽÌï„‚E´€ŒÁDxÑ3 1c'ADeñQÁ »·ƒqÿBu b„0'ÇÌºà”“ ^T1]üP–*GÔ¡ÅÄ@û‘¨ƒQ°€¢ WøD¢`±„.,¯yˆš„5$Â è· €Á ³À÷âðƒD€z€ƒ‘†!8@G/: V°á2À …Vt ¸À,ÿšÐ…OìζxÅ+`!ŠP\A 5¨Å,fÁ‡#,a‡HÑ"TA 0 ’à>HÀU(Á!Â$´!0‚ð#( AЄ4ôr£ E¨D.¶Má ÀØ €ˆ ÔÁr‚ŒP„"H ¶è†@" ¡mµ€ÏAÖU¯ ¼EÃ.êP>¸A‡(K+†´ÂÎ8À$‡cÈÁŽxÌÁûX !5ˆ@-AÈ﹃ €8áˆ(D!ñZp |8D!Q%¨ÂÝ0<°Q€Ð1œ zh2LJn`£sÀë ñˆ” w`ÅZ—h<Â]ð@d ¬˜Ð„%ô`/è"‚ˆÀœp‡D#%ŠPãÅ 'È hPÿ¸‚ QhA%h@ A4A:І@à±”B Pˆj4ž¡6D š€"ð„[ØÑ0Å6@‚ ¨ÁâX†1@p Xà¹ø,p„#H JPAYj \ ɇ4^P X€€`ƒ"0WÀ ŒøBê; \ xÐW£aŒ ¡©€6àñD"½(‹øˆ|ƒ2ZàEbÈ(‡:°ƒ>¢!ü#ø@œ ôâ}Ô£ôÈAòQ{غ²Þ“=jmk~ðcïö;ä±!|Ôº÷HW?îqì{øƒÖ¶Ž¶´§l äÜø†9"´’n{ûÛà·¸Çí€;nanoweb_2.2.9/www/vhosts/www.cgidemo.com/index.php0000644000000000000000000000327211023557654020752 0ustar rootroot the aegis PHP nano web server official homepage
    aEGiS PHP nano web demo server









    This page is served to you by aEGiS nanoweb

    "?>



    this is an example of simple dynamic content generated by php and served by nanoweb

    user agent


    php version


    mysql version


    system uptime





    back









    This site and all its contents are (c)2002 by sIX



    nanoweb_2.2.9/www/icons/0000755000000000000000000000000011023557654013704 5ustar rootrootnanoweb_2.2.9/www/icons/exec.gif0000644000000000000000000000307511023557654015324 0ustar rootrootGIF89a ÷ÿÿÿûüüøùùö÷÷õööÉÏÍéìëçêéÝàß™¢ž ©¥«´°ÃÌÈÍÖÒÌÓÐÇÎË_ng[hbn}vm|uƒŠ€‡kvq—¤ž“ š¡®¨­º´–¡œ“ž™¢­¨Ÿª¥°»¶­¸³¹Ä¿´¿º".()705C¶<F1àÍ<ЦàÒî4Ñ)ŒðÅÜH? tÈ.f,Œm ±Â'Õôàݼ Ik!ËOLFL 5Ð=µ˜sŽ/cÜbM FXà :"pÓ Q@*ÅMxÑE'“„ÈäŒ%(ØÂ7ÄhR;DðÄ 5ȲE]È ˆSû°N 'ÐÂÂ&Ȉ¢…0àðJµè°Šž²Q†X‘ 51 £†™dSÄ(žPB‹ŠÅ;ö„O<аˆ$HIZ;nanoweb_2.2.9/www/icons/misc.gif0000644000000000000000000000327411023557654015334 0ustar rootrootGIF89a ÷ÿÿÿ÷øøïðð×ÛÚèëêÞáàÍÒÐËÐÎaoiˆ˜‘ІÃÌȾÇÃÌÕѬ³°¾ÅÂÏÖÓ6E>FUN]leo~wn}vm|u`mg_lfyˆlysp}w„‘‹Ÿ¬¦ž«¥œ©£›¨¢®¹´¦±¬¹Ä¿³¾¹²½¸!+%$0*=MEÖÀè¯ 6Ý dŒ³ R¼ñŒ1 àAM uLSÂQHDE3 ôˆ"K,À>¥8s(PÄP„3eSE ÔPs‡ %€ÀÃÔbŠð‘ÍÔÏ9dp³Ä8µÌ"Mg$ÑÌ%àq‡ÏðÆ.JD£ˆ {øA dUÓƒfˆFÒdÿ#B*gdS‡¦{Ðq˜Ch3ª"v„ñš@¨`Gç ¡Êzð‰dÓÇÙ@@DU‘Ȩé„AL0Lk é ÌŠŒú6Ùø@L.G¤#ˆ ‡ãAý¬cÎ5väPƒ\ãÌ u$"6íÎ2…-F r¯J¼SP ?¬è V\#H6¢´a¯ Š\£Cæ\qˆ"¶R@OAûðBÍI|R„Ú$"D/Ü«È!°¤¢‡â‡:,TÐb¤1Æ&ˆ°MSqͨ‚8à„´ È6u@“À°@F1fl2A1H3B€$Â@ÖV¸B‹. Ô!0Eè™Ó$pÈÊ òQ#‚)èìÑG×tðJ¼ô!‚4´qQ?d’ j8“ ¿ø PAJ.Y`ªÆ‹TÀ2à“591‡xDãÅ)R41ư£4Fù¸Ž.Ò`àC iLSG/ÇøPNð3VMð£±Ä"Mó‘ø}I\‰¥0Rùç_„!ìs~@;nanoweb_2.2.9/www/icons/pic.gif0000644000000000000000000000304511023557654015150 0ustar rootrootGIF89a ÷ÿÿÿûüüúûûùúúøùù÷øøö÷÷ÝàßÊÏÍÈÍ˦¯«°¹µ¯¸´­¶²ÇÐÌÄÍÉÁÊÆÉÒÎÈÏÌÆÍÊ!;HBgvow†„“Œœ•‹š“hsnˆ•z…€Ÿ¬¦›–š•š¥ ˜£ž¤¯ªŸª¥¯ºµ·Â½ÊÕÐ#3+#1* *%.<5?OG7E>FVNJZRN^V1;6=JZxñA C˜0Ç¡ìbÆk¨‡1æü!G­Ô!¿Hs,_(q‰H 2 (Z¨¡Æ\æ˜ÿãG¡ÌƒQ?uP!‹5ØòÉ %¡ —oàanÄQ‚:¤G5´¸Ò .É ‚åǃ]t Ä4á|åP6X˜c‚²4áÉ&Ip¡„2ËÀ°J6¨°B³@p¾ )pÄ,&”2C8ÍTÂ';X‚Ž57 aŠT =ÂC÷TÀ¹ð4%ÔâÂ&äô£ 4lðùó"bl‘.ãÈ#àIþðÍ:j ;nanoweb_2.2.9/www/icons/rep.gif0000644000000000000000000000300111023557654015153 0ustar rootrootGIF89a ÷ÿÿÿ™§ ˜¦Ÿ—¥žøùùóôôòóóñòòãääÉÑΑ›—±¶´ÂÇÅv{™ Sb[Ud]Wf_funkzsu„}fsm}Œ…‚‘Šq~xx…Ÿ˜’¡šnyt”¡›š§¡ª·±¤±«£°ª‹–‘–¡œœ§¢½ÈÃ$2+?MFJZRFTMKYRYiaLZS_ogSaZVd]gwoZhaYg`iyq]kdO[Uow_mfR^Xcqjw‡iwpZf`m{tkyrLVQ‚’Šo}v_keQ[Vv„}uƒ|szr€yŒœ”w…~Ÿ—†|Šƒ†”„’‹q}w_id‹™’‰—eoj”¢›’ ™ž—–œª£›©¢š¨¡–¤•£œ…‘‹nxs¡¯¨ ®§Ÿ­¦ž¬¥«¤™“‡““Ÿ™‘—Žš”§³­¤°ª£¯©Ÿ«¥muq²¾¸±½·­¹³µÁ»¨²­Š’Ž†ŽŠµ¿º´¾¹³½¸°ºµ¯¹´ÈÒÍÀÊű¹µ©±­ÄÌÈ´¼¸‘—”Œ’Ï×ÓÇÏË£ ·½ºÇÍÊšžœ½Á¿¶º¸ÛßÝ÷ùøêìëéëêÞàß4C;BQIN_VIXP@MFN]UM\TP_WFSL\mdQ`XHUNgxo\kcaph`og_nfetldskbqiVc\\ibn}um|ts‚zq€xbohyˆ€x‡ކ~…{Š‚mzs‚‘‰ˆ€‡Š™‘‰˜‡–Ž…”ŒtzŒ›“€†~‹„¬¤ ­¦œ©¢§´­¥²«=HB~‰ƒ›•Ž™“—¢œ’—~‡‚œ§¡ƒŒ‡¯º´ªµ¯·Â¼”˜ž§¢¿ÈÃ:JA3?8[kbZjaYg__meT`Ykyq‚’‰zˆ€Œ˜‘‚‰…’™•¨¯«¥¬¨¡¨¤²¹µÒÙÕCMGkuo·Á»ÊÏÌÈÍÊ»À½µº·~†š¢ÊÒÍÉÑ̺½»àãáßâà×ÚØÖÙ×ÒÕÓÎÑÏýþýðñðîïîíîíéêéþþþýýýúúú÷÷÷õõõÿÿÿ!ùþ, ÿØ\Ÿñø \Ȱ¡Ã~»*Œr¡ È63f4däÃm¨BUꦱä@{<.´!îÏšXi™s·Ï¤CC4ÆÌÒáAA¯WBĹËA¢66»¥E‹%šäš)F§¡&d3ægFý pØ"@‹/UÄà€6¡¨H*ð`±B‚sð4DƒŒ€æ0Á’/ʆëÈ'I~@)³h¡›bhÞ<@‹.¨4Mªt„>wâ8‘¥%±ôˆɹö2Y¸`iUd9ƒÎDU%Í@”¤h¼E YÁ›ËŠÉ£a;B?J ™òa`‚M\¶ÿnê<°`èµ{¢l˄К3Ð ^Ë:?€ìô  †.$°ƒLR„² )RŠùmñÜ_€`SP0Á°˜²Š TÈ ™i6!gFxp  ÐJ9RÊš™f B,yð!GÁÊ;Ñ Ž9š‡"€[°¡Ìð1ˆØ(qÏ@ÛxÂ$`Nnfa”>ć wœ’„H ”Ž(_‚I!fÑÆ äaB»` ÌBÇÀYÛŽÿHF:€ð†1”ŒA Õ±ä sŠ^V$*G¦ˆ„# =@ bX©…d\1 hDÂÁfèÞ³Ð#¤ä‚£…>IV„òÆ Œ±ƒ3 •SM,a€k®@4ôr *aLcŽC‡tâ g¡Gg³cx D’\À'ŒdT—Ì)n¶EY|’J µ¬âMIü‚I!„@›·šõ²L—p2CÄcÓ<@@@ ¿ô’Åh ÀPA*OXÓ¦Iú0 L„‡2qÄ3Ìxrƒ-¨“Ô@÷ òE Ò4A†2ä<³‡™ Eº7”>ŒJ*­LQ… 'DÓNÒ°H"ßp3B2ò8;nanoweb_2.2.9/www/icons/son.gif0000644000000000000000000000311611023557654015173 0ustar rootrootGIF89a ÷ÿÿÿûüü÷øøñòòÂÈÆÅÍÊÉÎÌÂÇÅœ¥¡ª³¯¾ÇÃÊÓÏÐ×ÔÊÑÎ=\±Ls, 3é4I5½Øb˯D¢Åe Ĉ¾<x‘¥ðÿrÅ/[è0Ì1€”@=¬ŒñÄ[ â9lÀOD!…/C0ñ ™e pÁXDQE,Ü\C[Ø2ʾ(rÌ0ï@[¦8©X!ÅGÈŽ2»œQÊ1«àAMM¢ç£µLÅS ˆ1oÜ1 Lc^¤ ‰®ÐÊ/Q`q/Å|Í2Ê첄‚Vº €ƒOø’C<À¼òL æ¤#‚k,à'  X`ñC y\°J|¼±æ8¢=9°Y(QÂçÌ¡E1mÈç¸IÓœØð„+¨Ó6 ˜S$Ž0“K ö4%>PQA ØÙ·0+! &ææœ2 ! 6h¡ì+·@û,cŠ 01‰“/h ì“s@;nanoweb_2.2.9/www/icons/txt.gif0000644000000000000000000000313411023557654015213 0ustar rootrootGIF89a ÷ÿÿÿÄÌÈùúúøùùö÷÷õööòóóñòòåè瞦£ÏÔÒW`\ÅÎʸ¿¼®µ²FUNHWP[jc]lecrks‚{ƒ’‹‰^idjup–¥ž€‡«¸²›–˜“Ÿª¥½Èñ¼·AQI9G@LE=KDJZRAOHO_WESLDRKP`XFTMVf^YiaLZSO]VQ_XaqiSaZeumWe^Vd]Zhak{s^le`ng_mfcqjbpiu…}iwphvoguny‰kyrp~wo}vuƒ|r€yeqkcoizˆw…~ˆ€Ž‡~Œ…‡•Ž…“Œƒ‘Šsy`je‹™’akf“¡šž—–Žœ•z†€•£œ‰••¡››•©£™¥Ÿ‹†§³­¥±«£¯©¡­§­¹³¬¸²ª¶°©µ¯š•Ž˜“…‰ºÄ¿¹Ã¾¸Â½·Á¼¶À»µ¿º´¾¹³½¸®¸³ÉÓÎÃÍÈÁËÆÀÊÅ¿ÉľÈýǼÆÁ»ÅÀÏ×ÓÌÔÐÊÒÎÆÎÊÅÍÉÍÓÐËÑÎÊÐÍÄÊǼ¿ÝáßÚÞÜÕÙ×ÒÖÔðòñëíì6G>;LC5B;ETLIXPUf]M\TP_WFSLSbZUd\IVOXg_\kcdskgvnfumZg`l{sixpo~vn}um|ttƒ{q€xx‡ކ|‹ƒ{Š‚kxq‚‘‰x…~w„}…’‹„‘Ч´­£°©3>8oztkvpr}wz…w‚|¢­§›¦ ¯º´¬·±»ÆÀµÀº²½·™¢— ›–Ÿš¥®©¶¿º©²­ÈÑÌÇÐËÄÍÈÃÌÇÂËÆÀÉļÅÀºÃ¾ÉÒÍ8H?,81CSJSaYJVOiun‡•r~w›“‹„ƒˆ‘–ÀÇúÁ½¹À¼¶½¹+5/U_Ygqk±»µÈÍÊ¿ÄÁ×ÜÙÕÚ×ÑÖÓ°¸³ÆÎÉìïíèëéçêèâåãàãáßâàÚÝÛîðîëíëþÿþûüûõöõîïîþþþýýýüüüûûûøøøÿÿÿ!ùÿ, ÿHp >}üÞ!P°¡Ã†íÔÓÅÇ(7éô=Üè^£gl”D˜1© 'ÖxÓ¸±à»3dŒÀÉS5MEl€é5h£–ùA»PÊÓ&ž,d¡5§Y´A„Ž­*ð]©TÁˆ”:%†¡dÊÀŒY²€Ú»&BÓ63i)SÖlO3x™í‰ÖMP|ÒJœJ2'Y¡e{þô¹›—O3 €Š´i‚Ž0 5óÈÞ¼}úšµ¯%1I:hLÐÖ@@b?Œóþy£Ìƒö²QBÕ䆑>…øøÙó¯38t–…I°±ß ¨Xá€a‡Ÿ=ÌŠo–#ŒÏGý]ÿêT•¨f’é‰w `¾€­1¶‘^%£ðPÑMÙ²ŸíñF¾ÄAG÷<” Ð0 –ÌâŸ^Íd'Ü¡1 ˜ð<šH°É ÐÀÄ díaW3}À‚/h£ÇòB$ÁI <Dìèá|ô!ÌjøpÐlÃC„ÂÄ $á _$ÓÌŠ )Œt0&ȆŒ ŠœœpÊ'AAHbpÜgžá%È °D¤DQM GÈ Š €ðÿÈs<£Ç2Ëò!Ø2OC÷¡ 2‘‰›tÓu„@ÇpÍTà ÈŒóHAüpñE*AT€ƒ¯pÇ!ü‚F€ø‘(qÒ9ø4Œ«`ËK¨.x”CFk Ìo8ª‚Ü‘D<…£EX´"F ´hÃ, q†d¨†/ÎÎñ‡]‚ü±9ÐE²`cF Cc… ^0SÆf¨QK´Ð‚†0€äQ78-72ESLGUNVf^Ue]O]VN\UR`YcskVd]KWQ[ibowm}uaoh`ng_mfR^XWc]Ua[iwplzskyr]icszeqkzˆy‡€w…~gsmkwq„’‹‚‰q}w›”‹™’ˆ–x„~“¡šœª£ƒ‰¡¯¨™“r|w” š“Ÿ™©£œ¨¢š¦ „މ‚Œ‡§³­±½·¯»µ¬¸²‘›–™”·Ã½¬¶±«µ°©³®¨²­¢¬§¹Ã¾·Á¼µ¿º­·²¿ÉÄ»ÅÀ¢ª¦¦®ªµ½¹³»·‹‘ŽÖÞÚÕÝÙÒÚÖÊÒÎÉÑÍÈÐÌÇÏËÆÎÊÅÍÉ£©¦´º·²¸µ®´±ÄÊǽÃÀÆÊÈØÜÚöø÷ðòñíïîéëêæèç#.&3@9GXO>MEBQI9F?CRJ;HA(H¤“Gkɇf¾¶¹áóG):BËÁÉ0 €ì ŒÅ¦jÍNQ(öM¹NTblAa]ͽ®$#¥©… e}(Bª’“ œ axpÄESB&½c ` `ܲÿy§C7PhºT* !’ž•H’j›ªä D0éÜ<>é°QE ÀìѸhÓÆ}S/ÐA&M€¡Åñ¢Á1ᄃ‡-0ˆámSŒ8„‘áÔÑC3<“FD€2hã…5™¸p2À€F]àbÆ*¦ˆ³†V ‰\R? ØðÂ(@aÌ0¿ŒÁ 6%˜ K\è± "„0 %âP<ÃÇ~ÄÑ Êü±AÐg ™LcÉ#ad‘Cà°‡1~$2|ŒHÌ ü MÝtRK0`XÑ#õƒ0mÀQBü¡êP bÎ2—hÁpË8Çä2‹ýž<É4H|’>åt!Ã%‹h|Ò©ðPÉ"kÄNN¤@GÊí#Ê-sFd(±L/¿ÝLP;—´R?>7tOƒ„lS@;nanoweb_2.2.9/www/icons/c2_hd.png0000644000000000000000000000066711023557654015402 0ustar rootroot‰PNG  IHDR*º†.tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ ªd: pHYs ð ðB¬4˜gAMA± üa IDATxÚcLèêc °¼þŒ‰™…‹™‰‰ RfÖßîž9õäê•·ïóðñ±qó0âÐÀ|ûæÍÀ€s“ §NžÚ³ûß§Œlì\|üŒŒŒhJÿÿÿa}úôiûöí³fϾ|劾“‹´¾!šñ¥ðíÛ·… 657›yx ªk"«fA³…‹‹+-- ȪÖùñÙlt¥ ç33CT×76² ‰*(bwüúõ+&6öÁ‹—šž>LÌÌ@œÉÆÆ–•õôîÏÏŸADð…¹¥¥¥••Õ­“ÇÿýûG@)Ðà¨ÈÈ÷/^üþñ€R ÐÒÒú÷û÷·OŸ+ýýû÷ß¿À^˜IgÙFœf¾IEND®B`‚nanoweb_2.2.9/www/icons/c2_hg.png0000644000000000000000000000062611023557654015400 0ustar rootroot‰PNG  IHDR*º†.tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ / é1 pHYs ð ðB¬4˜gAMA± üaëIDATxÚcLèêc °à—þ÷ïßß_¿¾}úôïïœJÿýýûùù³['y÷îÏÏ‚BBX”þÿ÷ïÍ£‡¯®\ºså²®ŽN{oªªª”” ¦º§Ï_Ü·¨hú´ižžž|||XÜ T÷þæõ+ö5Ö×ÇÇÇsqqa÷Ä< ººÚÚ´´4fff4 ™à, û€öâR‡P ô/ÐööÉÉÉXÕ!”ÃåéÝ;ÙYYlll¸‚ ÎÀð³²²²´´Ä ¥¿|ÿâETd$#¡JAñöû·––þH»õÿÿ¿ÿüþý¿R+mzÛmñÆ&IEND®B`‚nanoweb_2.2.9/www/icons/c2_bd.png0000644000000000000000000000064511023557654015370 0ustar rootroot‰PNG  IHDR*º†.tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ ~ÁÌú pHYs ð ðB¬4˜gAMA± üaúIDATxÚcüÿÿ?npåÊ'«¨XAI)&¼€•••™™…‘È& ôÚµkL¬¬\||”þúõkÙò催œ”?~üرcjæ–LLLø”œ:mš´² ¯¤D»Ò¿ÿÎ;÷ÀÁƒb:zLÌÌ8•ÕÍš5«©¹YßÉEDN.΂¦îÛ·o .ª3óðT×ddb¢ôÓ§OÛ·oŸ5{öå+W€æ¡©Æ?>{öìöíÛ===@E*:º@÷íESRªc`ðþÝ;v!!`¸ý ÷`QvtabfÆ3¾`f„AwFN ,³`GIEND®B`‚nanoweb_2.2.9/www/icons/c2_bg.png0000644000000000000000000000066511023557654015375 0ustar rootroot‰PNG  IHDR*º†.tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ ér pHYs ð ðB¬4˜gAMA± üa IDATxÚcHèêó/,¿|ùò¼€‰™™YXYYðR.>>&VÖk×®VÊÊÁ)(!±lùò_¿~PÊÄĤfnyìØ±ãÇP ¼’RÒÊ*S§MÃc0³«;ÈcLLŒlìG·oãçã322ÚƒS)Øsü\\\«-äááÁª¡”‘‘‘W\BXPpÙ¼¹@ÕÚÚÚhÁ‡P QÍ!,ÂÉɹbÁü½{÷r°³ËÉɱ³³cQ 7[PZæý‹ç‹çƒ4ˆˆˆ£Š±XýûïïßÏÏŸÝ:yüË»w~þbÁŠÌÌü2²ÆRÒýúöéÓ¿¿p*…j~ Àk’m¸,IEND®B`‚nanoweb_2.2.9/www/icons/c2_d.png0000644000000000000000000000030611023557654015220 0ustar rootroot‰PNG  IHDRa|S.tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ  ;zÛ‹ò pHYs ð ðB¬4˜gAMA± üaIDATxÚcüÿÿ?npåÊ'«¨XAI)¡Žz‰_KIEND®B`‚nanoweb_2.2.9/www/icons/c2_g.png0000644000000000000000000000030311023557654015220 0ustar rootroot‰PNG  IHDRa|S.tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ  /`_ pHYs ð ðB¬4˜gAMA± üaIDATxÚcHèêó/,¿|ùò¼‘\#KyÂ-lIEND®B`‚nanoweb_2.2.9/www/icons/c2_h.png0000644000000000000000000000031611023557654015225 0ustar rootroot‰PNG  IHDRa!á .tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ  µak pHYs ð ðB¬4˜gAMA± üa#IDATxÚcHèêczÿü3ëo ?~døÿÿ?! ~ jZvÎIEND®B`‚nanoweb_2.2.9/www/icons/c2_b.png0000644000000000000000000000031411023557654015215 0ustar rootroot‰PNG  IHDRa!á .tEXtCreation Timemer. 12 mars 2003 16:21:51 +0100ÁÄtIMEÓ  ̽¦Ï pHYs ð ðB¬4˜gAMA± üa!IDATxÚcøÿÿ?AüéÓ'&eG&AI)ÕÌdOMœIEND®B`‚nanoweb_2.2.9/www/icons/nanoweb.png0000644000000000000000000001017711023557654016051 0ustar rootroot‰PNG  IHDRÈ<…£ýPLTE=E@GCJDKELENFMGNHOGPIPIRJQKRKRIPKTLSLSMTMUNUNUOVOVOUPWPWPWQXRYPWQX RY QX SY SZ T[SZ T[ U\U\V]W^U[W]W^V]X_X_Y_Y`Za[b\c\c]d^d_e_f`fagbh!ci#dk$bh$ek&gm'hn(gm(hm)ho+io*jo*jp,kq-lq/mr1ot4qv6rx8ty:uz;u{=w|?x}@y~AzByBzC{€D|F|‚I„K…M‚‡OƒˆQ…ŠU‡ŒVˆW‰ŽYŠŽZ‹[Œ‘\Œ‘]’]Ž’^Ž’`“a•b‘•c‘–c’–e’—f”—f“˜g”˜h•™i•šj–šj–›k—›k—œl—œm™p›Ÿsœ¡u u¢tž¡už¢wŸ£w ¤x ¤y¡¥z¢¥{¢¦|£¦}¤¨~¥¨¥©€¦©¦ª‚§ªƒ¨«„¨¬…©­†ª­‡«®‡¬¯‰¬¯‹®±¯²Ž°³‘±´‘²µ’²µ“³¶“´·”³·”´·•µ¸–µ¸—¶¹˜·¹˜·ºš¸»›¹¼¹½º½ž»½Ÿ»¾ ¼¾¡½¿¢¾Á¤¿Â§ÁÄ©Âūį¬ÅǯÇɰÇʱÈ˳ÊÌ´Ê̶ËζÌθÍϹÎлÏѽÑÓ¿ÒÔÀÓÕÂÔÖÄÕ×Å×ØÇØÙÉÙÛËÛÜÌÛÝÍÜÝÏÝßÏÞßÐÞßÑßàÓáâÕâã×ãäØãäÙäåÙåæÚåçÛæçÜæçÛæèÜæèÝçèÞèéßéêàéêáëëâëëâëìäìíåíîèïïéïðêðñëñòíòóîóóîóôïôôðôõñõöòööó÷÷ô÷÷ô÷øôø÷õøøöùù÷ùúøúúùûûúûûúûüúüûûüüüýýüýþýþýþþþþÿÿÿÿÿLðbKGDþÒÂS IDATxÚíš \TUÀÍæ½™÷Xžï½¹Û»Ž …RëB*IºbË"Jë'øU™±êb~¤¸•âj™•_hfk¹êª hš_¡ø-¥¸f†ˆ¡¦¤¹‚ä2 Þ_çÞyófÆDù»cýöüüù›{æÞûÎÿÜ{î9÷ -ÈÏDZøÚ€ÿH]Ýu_ÛØ< ¤Þñ“ iÄÖ:_âk#› ¤jæ_[Ù< dyÜA_›Ù< 'Sâ |mg³€‰¿;ïkC›¤pIRšÃ×–6È·Ës-cj}mj3€¹›ûÞ½Öצ6HΚõ|Û]¤Þ×Ö6äÓ¹Ÿw6?uG‡Iã@¾YxùiɺÜׯ6„¬úvC0ŸRçkk›²¹ü«81h›¯­m:HA)$ OÕøÚÜ&ƒ|r”LPø~_›ÛdÒ“d±¬É+}mn“A.–“Â4qÈîqÔ’ÂhÅœôµ½M¤~ª›¬Ý»Ã×ö6È¥x~àk{,ˆ£ÜxóPž kÜ¢ù˜kW*++¯þ7kµÛ€äõ;£‘òd s¯B¹2müdŒlWà—eN¤ŠÉcóÜã¶d@;×9òäú¬!}z<ßkДեslüÄÉ'{¼ÒØ›ñ"tÿ›[Qÿ6Œ1cò 2zÙ2ÚS1aÚÚÃÕ©ŸÚAÌÖ?’s}$ly™µ-ýÍ wßwTïuàž»©ÂÜòAwš™u—¿ù®‘ð¡jQߎ’™D«Å_èÔw)ýmK³Kì©-Øð2CqúÁ–fó/îaò!3ZxiLa‰¹·ÉLM”bËœäDœ‚…i„ 3c*Èš£÷*l¯0 önŒ|S@˜Ï‹R8NAØMá¸Qd8±9Óè\Ù]¤ªÛ ÍÇa[§$ {‹é¯dŽÙ[…T‹°à6 5sÇ, Gh£Þ܉°ðùöqxªbKFy‚Ø@£Dºd~K @œÉßÿ¸h)Âæ\ ¦Jªvu. V©I¼;—ðöfu€¿×Š0Vz›©,¨º%Hý’¬ÊÁV»®·× M“ß!›TpVtG„ÕнnÔ!æ4=È×q@mS†Œ™üÒK“G§þÞ½ÌCJ£e¬ÞkP¯Øšñ©Æ…g°k¼ °pjòŸF24(‰é¬9jhO #m8ÿ– f“÷µQ9ìlÏacä4|0u<Ãïe7ˆ55Ü'?Tâ ²Ù°-dñeלÿÊJ]O÷0’6¸´`]ªpZig +=V{[õ:ôågºZŽy0ŸÆ/¼HÁ¢j2T mƒÕÅNÅ µÉ? î—¶/å4lÑï' $eu¶ðŒ7H<Ç2ÐãÝñijbÈÞ‰`Žy¶®+ë*afǧ?‰ä¿øDM:YqéFóROXrnÊ-@*6œ#ù‘öà ,9cÁ1×þèVØÞJDÙ¡+Q%ˆ˜t¢L©¢}^ sy ›ÆyLëècÅHÌYeE†HL) ˆ²aÓH½×;„¹Tò|C ÓÜíèIoÄqè9“ ÛƒìXéu…ÔדӃ/»TŒ‡=eFÈ3x0Û‘º”¯€§c~¬È8ò‚zÍóœxŠ?Ö¬¯ï¨`5x—n Øk[‘,b1±Š)®§Á65¿FF5d€ð3¹ SÎæ0Ñb>£§ïƆyH†àú˜ð)—f€ÈѧÊ"eØêÒ‡nñ$ÿ¯òœxž8"­¶—§õc‘äGÏŒã þ ™æp}ÈNòÜíAêÐ^ß0H-·íU bG÷ïÇÓ×®€½"ö¨$¤ˆ.CìWÈÃÅdšEƒý:Ð 2á j9ÏsâÅ&\¶?æ†2M)ø†B–Ñíä ›÷a°ÔíŠäƒ‚˜_5š»ïW±Ð¥œÜ"Ø/‚MÔ¦ €} G¢UŒÚí +i_× ´€+Ö¸A>'%ÑÀÔÐÝȤÊDvÍGžÓ¾mÖ°L3‡°L²JD÷6Ù¦ÐÜr•jå`BA4ùÙÕï¹äÝ•Õ DLÛ’»zéT8''Wƒ £üqk Òºµ¸@‰È.'é/²{" !©Ê„L¡ÉÊ<Ä r©;œtê&ÏiW@ªC4HÂèï.ŽöÑr¢=réQ5‰î»™ ’ŸÕÓ}çViÁ#оÖz8·nC +á(i‚íÛ-ó ùŽ9¤ä®‡ãTŒ;G;Q!^÷{‚eK²× ˆÕ ¯Ÿ$ÖX)ˆƒÀÞÖ,Ô•ŸÁù'G•‘º=·Á oC;u¤"Fè Ha¢BnFÁÓ.Ü dW;(;”ØøßÎeA¨ÃÂKIWÆÐ"ÉjU¯È²Ü„,¦QbíWí²×ËAt!“¯‘·`oY{Â~$ÃILWq8É< >dÃX~Å@4dˆqÞ ¢ëdIàlXŽù{à 'âauQ`îl‚L'’áƒ0«î XYßóï±d÷O³ÝDZMnò öZ‘%4Fž¬!›Á3ÊoŠ™ÁƒéB”@®zV‘êÞÎ× ÀÌ]Û]²-ÿ;"Œ(`íë×M W1ÿë ”Ï#4,Ãìülð¬ÏߨÁQ§œhÁ¤Dy‚ù<=¸à0X"R‹4FÐæƒÝšâ G`G!u ©é+`ùzé©}R€ )"ÇiéÆö;µnø€Z3Ýí¹Ôcý € õÃvdyìk²üfçÞ­Œ „ðË$é¯ÒI½¤žVvHÈõ9ÞFIȲœ‚L¬J‚S^Ýè9õ|šGàDºÚ¾â–‘cõ–~ìê8ì–7²^ ùÄr›„¸/T…•ýçMA*Fùª4lô%²DÓ  Ê cTñ%,Xé> …Iÿ(¾árá BæÓšÏ"ï‹,!ºÏh—¼b‚©ÆS‹ ZƒÑÛ `ý'±¯V€sÍ Èr"=+ r´möÜ äê³~È`[~=»Œdƒw´½l·v*"y¬ÜV\§¡6"öyT'Yh{`µÈJ” ïô2Ьôâñi[ ÃÚlNsE]q,ÎEƳ1±¡í7YÈA?¸ŽÜýdz Âpíi-Fn!d,dC, †Ð œyùÔ„dsô^2åC…ošõüé’ó1ˆÍ,Õ "V#Š`·J1—Øw4H”¨ƒ4úU§1 {akÙ´?©=ß…¦çyäÏ`zkÈ%R{(¡Ê•°Ö:¡w/]zǃ͖§È!OD–º¿ßÖFA6@6’cv¹§_ ;I~¸”~„+3 ]ÚMÆÜ ýËñ Q2c¡–N¼l€Ü$ØùYîökVzÅÛÿCgMÈæ÷ä úñô\ǨáÜ’E¯7[i.‰9K®éB i E?â BhµØ0¶"‡!kb%øéÜ‚¢’’¢‚ D”½» ¾ˆ=1aÓ+úÐ`?ª]ÛB¤ #.iÊŽ-†lú„Ý…áù¬¹uý²T:¡õå e©­pÏŒrÖ¨ÛV–"RK;VeLçœ%!×úÀÔò&=IÝ 5¤7mú:‚ÞÙSyZQXZwèÝ18€VúØ/‹uÜCoêðφòõ¡%´2€ÈÓ¸….ïŒhJ'o0ÞVE6¡‰r{ö÷—üc×9õ¤²4N±£S{½QÞà c^÷ìOÓ‹ØsgGO’ÇéoM(Èvk!U‘eÅÆÎ ?¸P©ˆs¾$±ö¬p Î1ºÇ ¢ÙÜâqéèröû¼Aês"Í–Sϸ5ù6YT²œõ°Š—kÇ"OJ ¼´³U±v6@*“xg)d¢—¬“~ÉKP1ªŠ•è ™T“³›;½­2ÉTÃ'T²æ3~Š·˜ž'snÐÉk{/å)Îù)yÚ/>9ïŠ+z”ðpeŒ×N,o×6½kXxhÌ1C[NEÍ ­ªÍi±mƒõŸ=4"1s¿ñª$K¢½Ú†¸æž6RÕoþéJ¸·¨cɲ—¦]TòBg ¸@®¯z¬EÐs;þíúßU?¶]/;V\|ì‚÷÷§AW|ª¤¸ø‹÷¯rõ¥T Ï:ÛuçŠölß²uëÖ‚ƒ%ßx ¾àìV\ehjN|Á~ålžÕ;_”{ë¾8íz®²»ÿ]Ì # directives which are commented out in the distributed config # files shouldn't be listed here, as they are set to 0 if one # pushes [Save] without noticing this ## $FORCE_LANG = "en"; #-- init vars $PHP_SELF = $HTTP_SERVER_VARS["SCRIPT_NAME"]; $_REQUEST = array_merge($_REQUEST, $HTTP_GET_VARS, $HTTP_POST_VARS); $DOS_HOST = stristr(php_uname(), "Windows"); #-- error_reporting(E_ALL); error_reporting(0); set_magic_quotes_runtime(0); #-- no running nanoweb -> php (only?) $page = @$_REQUEST["page"]; if (empty($page)) { if (strstr(@$HTTP_SERVER_VARS["SERVER_SOFTWARE"], "nanoweb") === false) { $page = "PHP/PHP"; } else { $page = "NW/nanoweb"; } } @list($which, $config_page) = explode("/", $page, 2); $T = array( "NW" => array( "CONFIG_DIR" => search_dir(array("/etc/nanoweb", "/usr/etc/nanoweb", "/usr/local/etc/nanoweb", "C:/nanoweb", "C:/Program Files/nanoweb")), "CONFIG_FILE" => "nanoweb.conf", "DEFAULT_SECTION" => "global", "DOCDIR" => ($uu="/doc/nanoweb/html"), "DOC" => "$uu/index.html", "DOCREF" => "$uu/core.html#" ), "PHP" => array( "CONFIG_DIR" => search_dir(array(dirname(get_cfg_var("cfg_file_path")), "/etc/php4/cli", "/etc/php4/cgi", "/etc/php4/nanoweb", "/etc/php4/apache", "/etc/php/cgi", "/etc/php4", "/etc/php", "/usr/local/etc/php4", "C:/PHP", "C:/PHP4", "C:/Program Files/PHP")), "CONFIG_FILE" => "php.ini", "DEFAULT_SECTION" => "PHP", "DOC" => "http://www.php.net/manual/en/", "DOCREF" => "http://www.php.net/manual/en/configuration.php#ini." ) ); $DEFAULT_SECTION = $T[$which]["DEFAULT_SECTION"]; # lang-specific output $D_BOOLEAN["boolean"] = array("No", "Yes"); $D_BOOLEAN["boolvalue"] = array("False", "True"); $D_BOOLEAN["boolpower"] = array("Off", "On"); $D_BOOLEAN["boolstate"] = array("Disabled", "Enabled"); # # following arrays hold the structure of the configuration pages # $configuration_pages["NW"] = array( "nanoweb" => array( "html_empty" => "" ), "-General" => array( "ServerName" => "string", "ServerAlias" => "multiple", "ServerAdmin" => "string", "DocumentRoot", "DirectoryIndex", "DefaultContentType", "SingleProcessMode" => "boolean", "ServerMode" => "standalone|inetd|", "User" => "string", "Group" => "string", ), "-Technical" => array( "ListenInterface" => "string", "ListenPort" => "string", "ListenQueue" => "string", "KeepAlive" => "string", "RequestTimeout" => "string", "ChildLifeTime" => "string", "MaxServers" => "string", "TempDir" => "string", "StaticBufferSize" => "string" ), "-Access Control" => array( "ACPolicy" => "|allow|deny", "ACAllowIP" => "multiple", "ACAllowHost" => "multiple", "ACDenyIP" => "multiple", "ACDenyHost" => "multiple", "ACBlockError" => "string", "ACBlockMessage" => "string", ), "-.nwaccess" => array( "AccessFile" => "string", "AccessPolicy" => "override|merge|block", "AccessOverride" => "multiple", "AccessMerge" => "multiple", "AccessBlock" => "multiple" ), "-Mime Types" => array( "MimeTypes" => "string", "AddType" => "multiple", "DisableMimeMagic" => "boolvalue" ), "-Logging" => array( "Log" => "string", "LogDir" => "string", "ServerLog" => "multiple", "HostnameLookups" => "boolstate", "HostnameLookupsBy" => "server|logger|", "PidFile" => "string", "LogHitsToConsole" => "boolean", "LogHitsToServerLog" => "boolean" ), "-CGI Setup" => array( "ParseExt" => "multiple", "AllowPathInfo" => "boolean", "PathInfoTryExt" => "multiple", "CGIScriptsDir" => "multiple", "CGIScriptNoExec" => "|error|raw", "CGIFilterPathInfo" => "boolean", "FCGIFilterPathInfo" => "boolean" ), "-Security" => array( "AllowSymlinkTo" => "multiple", "IgnoreDotFiles" => "boolean" ), "-Miscellaneous" => array( "ConfigDir" => "string", "Alias" => "multiple", "UserDir" => "string", "ErrorDocument" => "multiple", "AddHeader" => "multiple", "AddServerVar" => "multiple", "ServerSignature" => "full|os|php|prod|min|off|fake", "ServerFakeSignature" => "string", /* "Include" => "multiple" */ ), "-Themes" => array( "ServerTheme" => "string", "LoadTheme" => "multiple" ), "Modules" => array( "LoadModule" => "multiple", "ModulesDir" => "string", ), "-FileBrowser" => array( "FileBrowser" => "boolstate", "FBSortOrder" => "name|size|date|name desc|size desc|date desc", "FBWelcomeFile" => "string", "FBDescFile" => "string", "FBIconDirectory" => "string", "FBIconByType" => "multiple", "FBIconDefault" => "string" ), "-Gzip Encoding" => array( "GzipEnable" => "boolean", "GzipLevel" => "string", "GzipMaxRatio" => "string" ), "-Authentication" => array( "html_hr1" => "

    ", "AuthSimpleUserPass" => "multiple", "html_hr2" => "


    ", "AuthNwauthFilename" => "string", "html_hr3" => "


    ", "AuthHtpasswdFilename" => "string", "html_hr4" => "


    ", "AuthMysqlHost" => "string", "AuthMysqlUser" => "string", "AuthMysqlPass" => "string", "AuthMysqlDB" => "string", "AuthMysqlTable" => "string", "AuthMysqlLoginColumn" => "string", "AuthMysqlPassColumn" => "string", "AuthMysqlPassType" => "plain|crypt|md5|mysql", "html_hr5" => "


    ", "AuthPgsqlHost" => "string", "AuthPgsqlUser" => "string", "AuthPgsqlPass" => "string", "AuthPgsqlDB" => "string", "AuthPgsqlTable" => "string", "AuthPgsqlLoginColumn" => "string", "AuthPgsqlPassColumn" => "string", "AuthPgsqlPassType" => "plain|md5|", "html_hr6" => "


    ", "AuthLDAPServer" => "string", "AuthLDAPBindDN" => "string", "AuthLDAPMatchfilter" => "string", "html_last_hr" => "


    " ), "-Mispell" => array( "MispellAction" => "|advice|redirect" ), "-MultiViews" => array( "LanguagePriority" => "string", "OtherPriority" => "multiple", "ReflectRewriting" => "boolean" ), "-Status" => array( "StatusAllowHost" => "multiple" ), "-StdoutLog" => array( "LogHitsToConsole" => "boolean", "LogHitsToServerLog" => "boolean" ), "-MySQL Logging" => array( "MySQLLogHost" => "string", "MySQLLogDatabase" => "string", "MySQLLogUser" => "string", "MySQLLogPassword" => "string" ), "-Proxy" => array( "ProxyAllowIP" => "multiple", "ProxyAccessLog" => "string", "ProxyCacheDir" => "string", "ProxyCacheMaxAge" => "string", "ProxyDenySite" => "string", "ProxyDenyPopup" => "string", "ProxyDenyPup" => "string" ), "-LoadLimit" => array( "LoadLimit" => "string", "LoadLimitError" => "string", "LoadLimitErrorMessage" => "string", "LoadLimitAction" => "|error|redir", "LoadLimitRedirect" => "string" ), "-Brainfuck" => array( "BSPAllowSource" => "boolean", ), "-DoS Evasive" => array( "DosEvasiveTimer" => "string", "DosEvasiveMaxReqs" => "string", "DosEvasiveError" => "string" ), "Virtual Hosts" => array( "html_empty" => "" ) ); $configuration_pages["PHP"] = array( "PHP" => array( "engine" => "magic", "expose_php" => "magic", "short_open_tag" => "auto", "asp_tags" => "auto", "default_mimetype" => "string", "default_charset" => "string" ), "-Files/Paths" => array( "include_path" => "string", "auto_prepend_file" => "string", "auto_append_file" => "string", "allow_url_fopen", "doc_root" => "string", "user_dir" => "string", "extension_dir" => "string" ), "-Variables" => array( "register_globals" => "auto", "variables_order" => "string", "register_argc_argv" => "auto", "precision" => "string", "magic_quotes_gpc" => "magic", "magic_quotes_runtime" => "magic", "magic_quotes_sybase" => "magic" ), "-Output" => array( "output_buffering" => "Off|On|1024|2048|4096|8192|16384|32768", "output_handler" => "string", "zlib.output_compression" => "boolpower", "implicit_flush" => "auto" ), "-Safe Mode" => array( "safe_mode" => "auto", "safe_mode_gid" => "auto", "safe_mode_include_dir" => "string", "safe_mode_exec_dir" => "string", "safe_mode_allowed_env_vars" => "string", "safe_mode_protected_env_vars" => "string", "disable_functions" => "string", "enable_dl" => "auto" ), "-Errors/Log" => array( "error_reporting" => "string", "display_errors" => "auto", "display_startup_errors" => "auto", "html_errors" => "auto", "log_errors" => "auto", "track_errors" => "auto", "error_log" => "string", "warn_plus_overloading" => "auto", "allow_call_time_pass_reference" => "auto" ), "-CGI" => array( "cgi.force_redirect" => "boolean", "cgi.fix_pathinfo" => "boolean", "cgi.rfc2616_headers" => "boolean" ), "-Misc" => array( "memory_limit" => "string", "max_execution_time" => "string", "post_max_size" => "string", "file_uploads", "upload_max_filesize", "from", "y2k_compliance" ), "Extensions" => array( "extension" => "multiple", "extension_dir" => "string" ) ); #### #### ########### #### ############ #### #### ########### #### ############# #### #### #### #### #### #### #### #### #### #### #### #### ############ ######## #### ############# ############ ######## #### ############ #### #### #### #### #### #### #### #### #### #### #### #### ########### ########## #### #### #### ########### ########## #### #-- load directive descriptions (in other languages) include("nanoconfig-en.php"); if (empty($directive_descriptions)) { echo "ERROR: 'nanoconfig-en.php' not found!
    \n"; } if (($langs = @$FORCE_LANG) || ($langs = @$HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]) || ($langs = getenv("LANG"))) { $lpref = array(); $qadj = 0.001; #==> arsort() orders langs randomly if we don't help it foreach (explode(",", $langs) as $langq) { preg_match('/^\s*(\w\w).*?[\s;]+qs?=([.\d]+)/', $langq . "; q=1", $uu); $lpref[strtolower($uu[1])] = $uu[2] - ($qadj *= 1.17); } arsort($lpref); foreach ($lpref as $LANG => $uu) { if ($LANG == "en") { continue; } if (file_exists($lfile = "nanoconfig-$LANG.php")) { $old_desc = $directive_descriptions; include($lfile); foreach ($directive_descriptions as $where=>$uu) { $directive_descriptions[$where] = array_merge( $old_desc[$where], $directive_descriptions[$where] ); } break; } } } # == ini files - read and write ======== $directive = @$_REQUEST['directive']; # new directive values #-- echo "
    ";print_r($directive);echo "
    "; # ===================================================================== # == lock action ============ # ===================================================================== if (@$_REQUEST["lock"]) { if (! $DOS_HOST) { $cdir = opendir($T[$which]["CONFIG_DIR"]); while ($cfile = readdir($cdir)) { if ($cfile[0] != ".") { chmod($T[$which]["CONFIG_DIR"] . "/" . $cfile, 0644); @$_MESSAGE .= "$cfile "; } } closedir($cdir); $_MESSAGE = "Set $_MESSAGE to not-writable.

    "; } else { $_MESSAGE = "Your operating system supports no file permissions, so the config files cannot be locked.

    "; } } # ===================================================================== # == apply action ============= # ===================================================================== elseif (@$_REQUEST["apply"]) { if (! $DOS_HOST) { @exec("/usr/bin/killall -HUP nanoweb.php"); $_MESSAGE = "You need to restart nanoweb for the changed configuration to take effect.

    "; } else { #-- @exec("C:/nanoweb/nanoctl restart"); #-???- } } ########## ########### #### #### ########## ############## ############ #### #### ########## ##### #### ##### #### #### #### #### ##### #### #### #### #### #### ###### #### #### #### #### #### ######### #### #### #### #### ######## ######### ############ #### #### ######## ###### ############ #### #### #### ##### #### #### #### #### #### #### ##### #### #### ####### #### ############## #### #### ##### ########## ########## #### #### ##### ########## # ===================================================================== # == read and update config files ==================================== # ===================================================================== # == strip empty "new" directives remove_empty_nodes($directive); $cf[$DEFAULT_SECTION]["include"] = array($T[$which]["CONFIG_DIR"] . "/" . $T[$which]["CONFIG_FILE"]); $cf_section = $DEFAULT_SECTION; $cf_already = array(); function next_config_file() { global $cf_already, $cf, $cf_section, $DEFAULT_SECTION, $T, $which; foreach ($cf[$DEFAULT_SECTION]["include"] as $cf_file) { if (!strstr($cf_file,"/") && !strstr($cf_file,DIRECTORY_SEPARATOR)) { $cf_file = $T[$which]["CONFIG_DIR"] . "/" . $cf_file; } if (empty($cf_already[$cf_file])) { $cf_already[$cf_file] = 1; return($cf_file); } } } function search_dir($dirs) { foreach ($dirs as $d) { if (file_exists($d) && is_dir($d)) { return($d); } } return($dirs[0]); } function add_missing_directives($last_cf_directive = "[]") { global $cf_section, $directive, $new, $cf; if (isset($directive[$cf_section])) foreach ($directive[$cf_section] as $dname => $darray) { if (($last_cf_directive === "[]") || (strtolower($dname) == $last_cf_directive)) { #--echo "adding lost directive [$cf_section] $dname / '$last_cf_directive'
    "; foreach($darray as $di => $dval) { $new[] = "{$dname} = {$dval}\n"; @$cf[$cf_section][strtolower($dname)][] = $dval; } unset($directive[$cf_section][$dname]); } } } function remove_empty_nodes(& $array) { if (! empty($array)) foreach ($array as $id => $sub) { if (is_string($sub) && (empty($sub)) && ($sub !== "0")) { unset($array[$id]); } elseif (is_array($sub)) { remove_empty_nodes($array[$id]); } } } /* do once */ { $cf_already = array(); # reread from first configuration file $cf_section = "global"; while ($cf_file = next_config_file()) if ($old_configuration_file = @file($cf_file)) { $new = array(); $last_cf_directive = "#"; foreach ($old_configuration_file as $line) { if (preg_match('/^\s*(\w[-_.:\w\d]*)\s*=?(.*?)$/', $line, $uu)) { $cf_directive = strtolower(trim($uu[1])); $cf_args = trim($uu[2]); #-- append new directive not found in current config file if ($cf_directive != $last_cf_directive) { add_missing_directives($last_cf_directive); $last_cf_directive = $cf_directive; } #-- replace config files` lines with submitted values if (isset($directive[$cf_section])) foreach ($directive[$cf_section] as $dname => $darray) { if (strtolower($dname) == $cf_directive) { $act_divs = count(@$cf[$cf_section][$cf_directive]); $dval = @$directive[$cf_section][$dname][$act_divs]; $line = ($dname . " = " . $dval . "\n"); $cf_args = $dval; unset($directive[$cf_section][$dname][$act_divs]); remove_empty_nodes($directive[$cf_section]); #-- echo "last] $cf_section :: $cf_directive [$act_divs] ?= $dval
    "; } } #-- save values in config array $cf[$cf_section][$cf_directive] = @array_merge( $cf[$cf_section][$cf_directive], array( $cf_args ) ); } else { if (preg_match('/^\s*\[([-_. \w\d]+)\]\s*$/', $line, $uu)) { if ($cf_section != $uu[1]) { #--echo "add missing directives of section $cf_section
    "; add_missing_directives(); } $cf_section = $uu[1]; } else { if (trim($line) == "") { #--echo "add missing directives before blank line
    "; add_missing_directives($last_cf_directive); } } } $new[] = $line; } #-- new vhost section if (($add_vhost = @$_REQUEST["add_vhost"]) && ($which == "NW")) { if (strpos($cf_file, "vhosts") >= 1) { $docroot = @$HTTP_SERVER_VARS["DOCUMENT_ROOT"]; $docroot = getcwd(); $new[] = "\n[" . $add_vhost . "]\n" . "DocumentRoot = " . $docroot . "\n[/" . $add_vhost . "]\n\n"; $cf[$add_vhost]["documentroot"][0] = $docroot; $config_page = "-" . $add_vhost; } } #-- save if ((@$_REQUEST["save"])) { if (is_writeable($cf_file) && ($f_cf = fopen($cf_file, "w"))) { echo "writing $cf_file..."; fwrite($f_cf, implode("", $new)); fclose($f_cf); #-$o .= implode("", $new); } else { @$_MESSAGE .= "'$cf_file' is not writeable!

    "; } } } add_missing_directives(); } ############ #### #### ############ #### #### #### #### ############ #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### ############ ############ #### # -- add [vhosts] (temporarily) as configuration pages --------------- $configuration_pages["ADD"] = array(); foreach ($cf as $section => $divs) { if ($section != $DEFAULT_SECTION) { $configuration_pages["ADD"]["-$section"] = $configuration_pages_add_section[$which]; foreach ($divs as $dname => $dcont) { if (! preg_match("/^log|servername|serveralias|documentroot$/i", $dname)) { $configuration_pages["ADD"]["-$section"][$dname] = "magic"; } } } } #-- which pages to list if (file_exists($T["NW"]["CONFIG_DIR"])) { $page_order = array("NW"); } switch ($which) { case "PHP": $page_order[] = "PHP"; $page_order[] = "ADD"; break; case "NW": $page_order[] = "ADD"; $page_order[] = "PHP"; break; default: $page_order[] = "PHP"; $page_order[] = "$which"; break; } #-- echo "
    "; print_r($directive); #print_r($cf); print_r($configuration_pages); echo "
    "; ?> nanoweb online configuration
    nanoweb online configuration
    $uu) { if ($sub == "ADD") { $sub = $which; } $title = $directive_descriptions[$sub]["%$id"] or $title = $id; if ($title[0] == "-") { $title = '· ' . ltrim($title, "-"); } else { $title = "$title"; } echo ''; echo '' . $title . ""; echo "\n"; } } ?> ";print_r($cf);echo ""; #-- output config page if (!($def = @$configuration_pages[$which][$config_page]) && !($def = @$configuration_pages["ADD"][$config_page])) { echo "internal script error
    "; } else { #-- submit form echo "
    \n"; echo " \n"; #-- page help $help = @$directive_descriptions[$which]; if ($page_intro = @$help["@" . $config_page]) { echo $page_intro . "

    \n"; } #-- go thru directive names on this config page foreach ($def as $directive => $ddesc) { #-- super-simple auto directive names if (strlen($directive) == 1) { $directive = $ddesc; $ddesc = "magic"; } #-- print help if ($dir_help = @$help[$directive]) { echo $dir_help . "
    \n"; } #-- print html help text or directive name, link if ((strpos($directive, "html") === 0) && ($directive !== "html_errors")) { echo $ddesc; continue; } else { $link = $T[$which]["DOCREF"] . $directive; switch ($which) { case "NW": break; case "PHP": $link = $T[$which]["DOCREF"] . strtr($directive, "_", "-"); break; default: $link = "http://www.google.com/search?q={$which}+{$directive}"; } echo "$directive:
    "; } #-- values array $value = @$cf[$cf_section][strtolower($directive)]; #-- determine type for "auto" if (($ddesc == "auto") || ($ddesc == "magic") || ($ddesc == "*") || ($ddesc === "")) { if (is_array($value) && (count($value) >= 2)) { $ddesc == "multiple"; } else { foreach (array("On|Off", "true|false", "Yes|No", "1|0", "enabled|disabled") as $ddesc) { if (preg_match("/^{$ddesc}$/i", @$value[0])) { $ddesc .= "|"; break; } $ddesc = "string"; } if ($ddesc == "1|0|") { $ddesc = "boolean"; } } } #-- first value (from array) $value = htmlentities(@$value[0]); #-- print input boxes depending on type if (($D_BOOLEAN[$ddesc]) || (strpos($ddesc, "|") !== false)) { #-- yes/no selection echo " \n"; } #-- input list elseif ($ddesc == "multiple") { $index = -1; if (count(@$cf[$cf_section][strtolower($directive)])) foreach (@$cf[$cf_section][strtolower($directive)] as $index => $dval) { $dval = htmlentities($dval); echo " "; echo "
    \n"; } $index++; echo " "; echo "\n"; } #-- single field else { #-- just a string input field echo " \n"; } echo "

    \n"; } #-- [save] button echo " \n"; echo "
    \n"; } ?>
    nanoweb_2.2.9/www/nanoconfig/nanoconfig-de.php0000644000000000000000000006622511023557654020145 0ustar rootroot # translations for "Yes" / "No" variables $D_BOOLEAN["boolean"] = array("Nein", "Ja"); $D_BOOLEAN["boolvalue"] = array("Falsch", "Richtig"); $D_BOOLEAN["boolpower"] = array("Aus", "Ein"); $D_BOOLEAN["boolstate"] = array("Deaktiviert", "Aktiviert"); # the percent sign can now be used to # translate the menu entries # # the @ says that description entry is the # very first thing to get printed on the # according page # #-- translated descriptions $directive_descriptions["NW"] = array( "%-General" => "-Allgemein", "%-Technical" => "-Technisches", "%-Access Control" => "-Zugriffskontrolle", "%-Mime Types" => "-MIME Typen", "%-Logging" => "-Logbuch", "%-CGI Setup" => "-CGI Einstellungen", "%-Security" => "-Sicherheit", "%-Miscellaneous" => "-Verschiedens", "%Modules" => "Module", "%-FileBrowser" => "-Datei-Browser", "%-Gzip Encoding" => "-Komprimierung", "%-Authentication" => "-Authentifizierung", "%Virtual Hosts" => "Virtuelle Server", "@nanoweb" => 'nanoweb logo'." Dieses Programm dient einer schnellen Erstkonfiguration von nanoweb. In aller Regel ist es jedoch einfacher die Konfigurationsdateien von Hand zu editieren (sehr gut dokumentiert und einfache Struktur). Übrigens sind nicht alle Einstellmöglichkeiten in diese Oberfläche integriert, so daß spätestens fürs Fein-tuning ein Editor nötig ist.

    Damit dieses Werkzeug die Konfigurationsdateien auch geändert abspeichern kann müssen unter Linux/UNIX zunächst die Schreibrechte gelockert werden (unter Windows nicht notwendig):
    chmod a+rw {$T[$which]['CONFIG_FILE']}

    Diese Schreibrechte können nach Abschluß aller Einstellungen mit [Lock Config] wieder korrigiert werden.

    [Save] muß auf jeder Seite angeklickt werden wenn Du etwas geändert hast.

    \n", "@-General" => "Der Server benötigt einen Standard-Domainnamen, den er an alle Browser zurücksenden kann, die diesen noch nicht kennen. Es reicht nicht aus sich hier einfach einen Namen auszudenken, dem Betriebssystem muß dieser auch bekannt gemacht werden, damit er tatsächlich verwendet werden kann (siehe hierzu /etc/hosts oder C:\\winnt\\hosts).", "DocumentRoot" => "Das Dokument-Wurzelverzeichnis beherbergt alle Dateien und Ordner die durch nanoweb (also als WWW-Seiten über http://) bereitgestellt werden sollen:", "DirectoryIndex" => "Sobald eine der im folgenden aufgelisteten Dateien in einem Ordner vorhanden ist, wird diese statt einer automatisch generierten Verzeichnisliste ausgeliefert (auch bekannt als »Startdatei«):", "DefaultContentType" => "Wenn nanoweb den Typ einer Datei nicht feststellen kann, soll von diesem Standard-Dateityp ausgegangen werden:", "SingleProcessMode" => "Windows™ unterstützt kein Prozess-»forking« (wie Linux/UNIX), daher startet nanoweb dort in dem etwas langsameren ", "ServerMode" => "Bitte unbedingt einen Blick in die READMEs werfen, vor Änderung des ", "User" => "Da nanoweb nicht mit den Privilegien des SuperUsers laufen sollte, bitte das voreingestellte »www-data« belassen.", "ListenInterface" => "nanoweb muß zumindest eine IP Schnittstelle und einen TCP Port (80 ist Standard für Webserver) überwachen, um Verbindungen annehmen zu können.", "ListenQueue" => "Eine Zahl von ankommenden Anfragen kann auf eine Abarbeitungsliste gesetzt werden (wenn der Server gerade beschäftigt ist), ", "KeepAlive" => "Moderne Browser können mehrere Dateien mit nur einem geöffneten TCP/IP Kanal abrufen. Wenn Du keine Unterstützung dafür möchtest, setzt Du einfach den folgenden Wert auf 0:", "RequestTimeout" => "Einige Anfragen von Browsern werden nicht ordnungsgemäß beendet (Netzstörungen, Absturz), so daß Verbindungen offen bleiben. Damit ordnungsgemäße Anfragen durch diese Fälle nicht behindert werden sollte eine maximale Wartezeit zur Vervollständigung von Anfragen festgelegt werden:", "ChildLifeTime" => "Von Zeit zu Zeit können Kind-Prozesse hängen bleiben (Endlosschleifen, etc.), so daß alle Serverprozesse nach einer bestimmten Zeitspanne neugestartet werden sollten.", "MaxServers" => "Begrenzt die Anzahl maximal gestarteter Server (Kindprozesse).", "StaticBufferSize" => "mod_static lädt gewöhnliche Dateien bis zu einer maximalen Größe in den Speicher, um die Übertragung zu beschleunigen:", "TempDir" => "Ordner für temporäre Dateien:", "@-.nwaccess" => "Die Dateinamen für die Verzeichnis-spezifischen Konfigurationsdateien sind frei einstellbar:", "AuthFile" => "Diese Dateien enthalten die Authentifizierungs-Daten (Paßwörter) für den HTTP Auth. Mechanismus:", "ACPolicy" => "Nanoweb gewährt standardmäßig allen anfragenden Rechnern Zugriff; für Intranet-webserver bietet es sich hingegen an zunächst alle eingehenden Anfragen abzuwürgen.", "ACAllowIP" => "Rechner die Zugriff auf den Datenbestand erhalten sollen können mit Hostnamen oder IP Adresse angegeben werdeb, wobei Platzhalter-zeichen erlaubt sind.", "ACDenyIP" => "Wenn ACPolicy mit 'allow' allen Rechnern Zugriff erlaubt, können hier einige angegeben werden, für die diese allgemeine Erlaubnis nicht zutrifft.", "ACBlockError" => "Für abgeblockte Rechner kann hier eine nette Fehlermeldung angegeben werden:", "AccessFile" => "Um die Verzeichnis-config-dateien vom »apache« weiter zu verwenden, könntest Du den Namen für eben diese Dateien einfach in ».htaccess« ändern:", "AccessPolicy" => "Standardmäßig überschreiben Einstellungen in .nwaccess Dateien die ursprünglichen Konfigurationswerte des Servers. Dieses Verhalten läßt sich aber anpassen:", "AccessOverride" => "Für einzelne Direktiven kann eine abweichende Vorgehensweise konfiguriert werden.", "MimeTypes" => "nanoweb holt sich die MIME-Typ Zuordnungen (Dateiendung => Typ) aus der entsprechenden Konfigurationsdatei deines Systems (in jeder aktuellen Linux Distribution enthalten), so daß Du dich darum eigentlich nicht sorgen solltest. (MIME steht übrigens für »Mehrzweck Internet Mail Erweiterungen«)", "@-Logging" => "nanoweb unterstützt verschiedene Methoden alle Aktivitäten zu vermerken (engl. logging). Ein Erweiterungsmodul ermöglicht es z.B. die Vermerke in eine MySQL Datenbank zu schreiben.", "Log" => "Jeder virtuelle Server (und damit auch der Hauptserver) kann ein eigenes Logbuch mit allen Zugriffen speichern.", "ServerLog" => "Nanowebs Logbuch Meldungen sind in Klassen unterteilt. Der zweite Parameter zu dem Dateinamen eines ServerLogbuches bestimmt diese und filtert damit die Nachrichten. Eine Liste der möglichen Fehlertypen findet sich im Handbuch.", "HostnameLookups" => "Die DNS-Namensauflösung (Domainnamen statt IP-Nummern) verlangsamt den Server:", "HostnameLookupsBy" => "Der Host-Name kann auch erst während der Erstellung des Logbuchs herausgesucht werden, so daß sich der Server nicht damit aufhalten muß; hierzu »logger« wählen:", "PidFile" => "Die Pid-Datei enthält die »Prozeß id« auf Linux/UNIX Maschienen, was es nanoctl erleichtert den Server zu beenden.", "LoggerProcess" => "LoggerProcess, LoggerUser/Group können nur in der Konfigurationsdatei gesetzt werden.", "LogHitsToConsole" => "Wenn Du das Log auf der Standard-Ausgabe - also der Konsole (oder Fenster) sehen möchtest, muß das Modul mod_stdlog. geladen werden.", "ParseExt" => "Die ParseExt Direktive definiert welcher CGI Interpreter bei welcher Dateinamenserweiterung verwendet werden soll.", "AllowPathInfo" => "»pathinfo« ist ein zusätzlicher Informationsträger neben dem »query string« (GET) oder den POST Variablen. Er wird oft gegenüber den GET Variablen bevorzugt, weil URLs wie \"script.php?a=x&b=1&cd=234\" nahezu alle Suchmaschinen verschrecken.", "PathInfoTryExt" => "Sehr warscheinlich möchtest Du jede CGI Erweiterung hier auch auflisten, um die Erweiterung später auslassen zu können wenn Du ein CGI in einer HTML-Datei referenzierst (also /script/ statt /script.php/):", "CGIScriptsDir" => "Dateien die in einem dieser Ordner (/cgi-bin/) das Ausführbar-Flag gesetzt haben werden unabhängig von ihrer Dateiendung als CGIs behandelt. Wenn hier aber schlicht / eingetragen wird, dürfen diese CGIs überall vorkommen.", "CGIScriptNoExec" => "Falls eines der Scripte aus /cgi-bin/ das »Ausführbar«-Flag nicht gesetzt hat, kann nanoweb eine Fehlermeldung an den Client zurücksenden (error), oder das Script wie eine gewöhnliche Datei ausliefern (raw).", "CGIFilterPathInfo" => "Der PHP Interpreter hat immer noch einen Fehler, der die \$PHP_SELF Variable bei einer vorhanden \$PATH_INFO Variable unbrauchbar macht. Wenn diese Direktiven aktiviert werden, wird also kein PATH_INFO übertragen, bleiben sie unaktiviert kann immernoch SCRIPT_NAME an stelle von PHP_SELF verwendet werden:", "ConfigDir" => "Das Verzeichnis, daß alle Konfigurations- und Themendateien von Nanoweb enthält:", "AllowSymlinkTo" => "Webserver sollten nur Zugang zu Dateien erlauben die innerhalb des Dokument-Wurzelverzeichnisses liegen. Falls jedoch Dateien außerhalb dieses Bereiches verlinkt werden (nur »symlinks« unter Linux/UNIX, Windows-Verweise sind Bastelkram), sind diese nur zugänglich wenn das Zielverzeichnis mit folgender Direktive freigeschaltet wird:", "IgnoreDotFiles" => "Dateien deren Namen mit einem Punkt beginnen werden von vielen UNIX-Programmen als unsichtbar behandlet; nanoweb's Verzeichnis-config-Dateien fallen z.B. in diese Kategorie. Daher möchtest Du normalerweise nicht, daß diese Dateien übertragen werden können:", "Alias" => "Mit der Alias Direktive können beliebigen Ordnern von der Festplatte virtuelle Verzeichnisnamen innerhalb von nanoweb zugeordnet werden. Diese virtuellen Verzeichnisse können auch in jedem der virtuellen Server verwendet werden, unabhängig von sonstigen Einstellungen:", "ServerSignature" => "Nanoweb gibt anfragenden Browsern normalerweise einige Details über sich im 'Server:'-Feld einer jeden HTTP-Antwort preis. Der Umfang der Infos kann jedoch begrenzt werden; aus Sicherheitsgründen könnte sogar eine völlig falsche Angabe (fake) gemacht werden.", "ErrorDocument" => "Für jeden auftretenden Fehler kann eine individuelle Fehlerseite angezeigt werden (an Stelle der Standard-Meldungen von nanoweb):", "AddHeader" => "Diese Direktive erlaubt das Mitsenden von beliebigen HTTP Kopfzeilen:", "UserDir" => "Private Webseiten eines System-Benutzers werden via http://server/~user zugänglich, wenn der entsprechende Benutzer folgendes Unterverzeichnis in seinem Heimatverzeichnis anlegt:", "@Modules" => "Folgende Erweiterungs-module werden momentan beim Starten in den Server geladen. Hinweis: Einträge die in der Konfigurationsdatei auskommentiert sind können momentan noch nicht von nanoconfig angezeigt werden. Ein Blick in das Handbuch verrät welche Module derzeit für nanoweb verfügbar sind.", "GzipEnable" => "Nahezu alle modernen Browser unterstützen das Standard-Komprimierungsverfahren »gzip« (auch bekannt als »zlib Format«). Die Verwendung von gzip beschleunigt die Übertragung (der Zeitaufwand die Seiten zu Komprimieren ist sehr gering) weil zum einen weniger TCP/IP-Pakete verloren gehen können weil weniger davon übertragen werden müssen, und zum anderen bechleunigt diese komprimierte Übertragung das Herunterladen über die immernoch häufig verwendeten Modems.", "GzipMaxRatio" => "Die Dateien sollten nur komprimiert übertragen werden, falls diese nicht schon komprimiert sein sollten:", "FileBrowser" => "Das Erweiterungsmodul »FileBrowser« generiert die Verzeichnislistings für nanoweb, wenn keine »Start-Datei« (index.html) in einem Ordner vorgefunden wird. Die Ausgabe kann vielfältig verschönert werden:", "FBIconDirectory" => "Das /icons/ Verzeichnis ist eines der voreingestellten Alias-Verzeichnisse, und ermöglicht damit einen einfachen Zugriff auf die Bildchen die jedem Dateityp zugeordnet werden können:", "MispellAction" => "Dieses Modul korrigiert falsch eingegebene URLs; wahlweise kann ein Hinweis (advice) auf die richtige Addresse ausgegeben werden, oder eine automatische Weiterleitung (redirect) erfolgen:", "@-MultiViews" => "Das Multiviews-Modul (TCN) erweitert nanoweb um automatische Inhalts-selektion (d.h. die richtige Datei aus einer Menge von vorhandenen Varianten an Hand der vom Browser unterstützten oder gewünschten Dateitypen und Lieblingssprachen des Benutzers auszuwählen). Unterstützt teilweise RVSA/1.0", "LanguagePriority" => "Die primär verwendeten Sprachen auf ihrem Server:", "OtherPriority" => "Zusätzliche Server-seitige Präferenzen, die verwendet werden, wenn der Browser keine Angaben über unterstützte Dateitypen macht.", "ReflectRewriting" => "Diese Direktive beeinflußt auch mod_rewrite:", "@-Status" => "mod_status erlaubt es einige Informationen über den laufenden Server online einzusehen. Im Handbuch findet sich eine Beschreibung über die vorhanden Info-Seiten.", "StatusAllowHost" => "Aus Sicherheitsgründen solltest Du nur lokalen Rechnern Zugang zu den Status-Seiten gewähren. Unvollständige IP-Angaben werden als Vergleichsmuster ausgewertet:", "@-StdoutLog" => "Das Modul mod_stdlog gibt das Logbuch auf die Konsole aus. Das funktioniert natürlich nur, wenn nanoweb.php direkt (ohne nanoctl) von dort gestartet wurde.", "@-MySQL Logging" => "mod_mysqllog schreibt das Server-Logbuch in eine Datenbank (nanoweb benutzt ansonsten eine ganz gewöhnliche Datei dafür). Die entsprechende Tabelle wird beim ersten Start automatisch erstellt, wenn alle Einstellungen richtig sind:", "@Virtual Hosts" => "Ein »virtual host« (oder »virtueller Server«) besitzt einen Domain-namen und ein Wurzelverzeichnis, die sich von dem des Hauptservers unterscheiden. Viele der Direktiven die in der Hauptkonfiguration verwendet werden können, sind auch hier erlaubt.

    " .'DNS-Name für den neuen virtuellen Server:
    ' ); #-- PHP Dokumentation $T["PHP"]["DOC"] = "http://www.php.net/manual/de/"; $T["PHP"]["DOCREF"] = "http://www.php.net/manual/de/configuration.php#ini."; #-- added [sections] $configuration_pages_add_section["NW"] = array( "html" => "Direktiven für einen »virtuellen Server« dürfen von den Einstellungen des Hauptservers abweichen. ", "html_2" => "Ohne einen seperaten Verzeichnisbaum für dessen Dateien, wäre ein virtueller Server absolut blödsinnig:

    ", "DocumentRoot" => "string", "html_3" => "Vergleichsmuster für zusätzliche Domain-Namen,
    ", "ServerAlias" => "multiple", "html_4" => "Wenn Du ein eigenständiges Logbuch für diesen virtuellen Server möchtest, dann trage bitte hier den entsprechenden Dateinamen ein.
    ", "Log" => "string" ); $configuration_pages_add_section["PHP"] = array( "html_seedoc" => "Bitte wirf' einen Blick in das Handbuch für Informationen zu folgenden Konfigurations­einstellungen.

    " ); #-- PHP-Seiten $directive_descriptions["PHP"] = array( "@PHP" => "PHP Hypertext Processor \"PHP Es war ursprünglich nicht geplant PHP auch mit nanoconfig einstellen zu können (wenngleich beide Konfigurationsdateien einen ähnlichen Aufbau haben); also bitte keine Wunder erwarten!

    Natürlich muß auch die php.ini wieder für dieses Tool beschreibbar gemacht werden (nicht nötig für Windows, weil es dort ja keinen Schreibschutz gibt):
    chmod a+rw php.ini", "engine" => "PHP kann in den einzelnen Unterverzeichnissen aktiviert und deaktiviert werden;", "expose_php" => "Wegen Sicherheitsbedenken möchten einige Leute nicht verraten, daß PHP benutzt wird... Diese Option zu setzen, macht natürlich nur Sinn, wenn man nicht anhand der Dateinamen ohnehin ablesen kann, daß PHP verwendet wird (mit ParseExt oder mod_rewrite, mod_multiviews könnte man dies jedoch verschleiern).", "short_open_tag" => "PHP-code wird in das XML-Tag <?php ... ?> eingeschlossen, normalerweise möchte man aber auch die Kurzform (ohne das »php« nach dem Fragezeichen) verwenden <?...?> ", "asp_tags" => "ASP-ähnliche Tags werden eher selten verwendet <%...%> ", "include_path" => "Eine Liste mit Ordnern in denen nach include() Dateien gesucht werden soll (Ordner mit Doppelpunkten trennen; bzw. Semikolon unter Windows)", "auto_prepend_file" => "Die folgenden Dateien sollen automatisch am Anfang und am Ende jedes PHP-Scriptes eingefügt werden (nützlich um allgemeine Server-spezifische Laufzeit-Einstellungen vorzunehmen).", "allow_url_fopen" => "PHP erlaubt es mit den normalen Datei- Ein-/Ausgabefunktionen auch auf entfernte Dateien mit http:// and ftp:// (lesend) zuzugreifen. Sehr nützlich, aber u.U. ein Sicherheitsloch bei schlecht durchdachten Scripten.", "doc_root" => "Die folgenden Einstellungen dienen hauptsächlich der Kompatibilität. Wer nanoweb verwendet, sollte sich hierum nicht kümmern müssen.", "@-Variables" => "PHP war ursprünglich als die einfachste und für die Webentwicklung schnellste Scriptsprache ersonnen worden, allerdings wurden aus Sicherheitsgründen einige Änderungen im Verhalten der Sprache eingeführt. Mit folgenden Optionen kann jedoch die Kompatibilität mit früheren Versionen wieder hergestellt werden:", "register_globals" => "Wenn Du alle GET, POST und COOKIE Variablen automatisch im globalen Namensraum verfügbar haben möchtest (andernfalls sind die Variablen über \$_REQUEST[] oder \$_GET[] erreichbar), solltest Du folgende Option aktivieren,", "varialbes_order" => "Vorzugsreihenfolge für Get-, Post-, Cookie-, Session- und Umgebungs-variablen:", "register_argc_argv" => "\$argc und \$argv sind eigenlich nur in eigenständigen (nicht-www) Scripten nützlich (CLI):", "precision" => "Gleitkommagenauigkeit", "magic_quotes_gpc" => "Atkivierte »magic quotes« führen dazu, daß Meta-Zeichen (Anführungszeichen, Backslash) in allen Variablen, die von \"außen\" kommen oder die nach außen wandern, automatisch geschützt werden (durch vorangestellten Backslash):", "@-Output" => "Alle Ausgaben (also alle nicht-PHP-Bereiche oder echo()-Aufrufe) können zwischengespeichert (gepuffert) werden und/oder durch eine spezielle Bearbeitungsfkt. gesendet werden.", "output_buffering" => "Du kannst die Puffergröße zur Ausgabeverzögerung selber festlegen (»On« steht für 4096 Byte). Ein solcher Zwischenspeicher erlaubt es u.a. weitere header() zu senden obwohl bereits Ausgaben gemacht wurden.", "zlib.output_compression" => "An Stelle einer der allgemeinen Ausgaberoutinen (das Feld hierüber) kann auch die oft bevorzugte komprimierte Übertragung der HTML-Seite aktiviert werden:", "implicit_flush" => "Wenn ein Ausgabebehandler aktiviert ist, soll der Puffer automatisch nach jeden echo() geleert werden?", "safe_mode" => "Der »Sichere Modus« von PHP erlaubt es die Verfügbarkeit von bestimmten Systemfunktionen zu beschränken und auch den Zugriff auf nicht-eigene Dateien zu verhindern.", "safe_mode_gid" => "Neben dem Eigentümer soll beim Zugriff auf eine Datei auch die Gruppenzugehörigkeit überprüft werden (GID - »group id« unter Linux/UNIX).", "safe_mode_include_dir" => "Eigentümer/Gruppe wird für folgende Ordner ignoriert:", "disable_functions" => "Die folgende Einstellung funktioniert unabhängig von »Safe Mode«:", "enable_dl" => "Die dl() Funktion erlaubt es Erweiterungsmodule noch während der Laufzeit nachzuladen:", "@-Errors/Log" => "Fehlermeldungen werden unterdrückt oder umgeleitet abhängig von folgenden Einstellungen:", "error_reporting" => "Dieser Wert kann später auch in jedem Script mit error_reporting() übergangen werden. Einige Fehler treten jedoch bereits beim Laden auf (z.B. Parser-Fehler), und werden daher immer angezeigt, wenn sie hier nicht deaktiviert sind. E_ALL, E_ERROR, E_WARNING, E_PARSE, E_NOTICE, E_COMPILE_ERROR, E_CORE_ERROR sind nur einige der Optionen die hier mit | oder + kombiniert werden können:", "display_errors" => "Die Fehlermeldungen gleich in die erstellten Seiten mitauszugeben ist sehr hilfreich bei der Entwicklung, aber nicht empfohlen auf fertigen Internetpräsenzen:", "html_errors" => "Fehler mit HTML Auszeichnungen hervorheben (in aller Regel roter Text, was aber in der php.ini eingestellt werden kann).", "error_log" => "Fehler-Logbuch soll ins »syslog« (gibt es auch unter NT, nicht jedoch im Windows) oder in die hier angegebene Datei geschrieben werden:", "memory_limit" => "Der Ausführung von Scripten können im Speicherverbrauch und der benötigten Ausführungszeit Grenzen gesetzt werden.", "post_max_size" => "Zu große POST Anfragen können den Server zum Absturz bringen, und führen relativ häufig zu einer erheblichen Verlangsamung der Ausführung.", "from" => "Anonyme FTP Übertragungen erfordern die Angabe einer EMail-Adresse an Stelle eines Paßwortes:", "y2k_compliance" => "(nicht wirklich nützlich) ", "extension" => "Viele der PHP Erweiterungen sind inzwischen direkt in den Interpreter einkompiliert, so daß nur noch einige wenige expilizit geladen werden müssen." ); ?>nanoweb_2.2.9/www/nanoconfig/nanoconfig-fr.php0000644000000000000000000002273211023557654020157 0ustar rootroot 'nanoweb logo'." Cet outil permet une configuration rapide de nanoweb. Il est souvent plus facile et plus rapide d'éditer les fichiers de configuration, et il est en fait impossible d'acceder à toutes les options à partir de cette interface. Un éditeur texte est donc necessaire pour les configurations plus subtiles.

    Pour que cet outil fonctionne correctement, vous devez rendre les fichiers de configuration accessibles en écriture. Pour celà sous Linux/UNIX :
    chmod a+rw {$T[$which]['CONFIG_FILE']}

    Ce droit peut etre révoqué par un clic sur le bouton 'Lock Config' sur cette page une fois votre configuration terminée.

    Vous devez selectionner 'Save' sur chaque page sur laquelle vous avez effectué des changements.

    ", "@-General" => "Le serveur a besoin d'un nom de host pour reconstruire des URL absolues. Vous devez utiliser ici un nom existant (voir /etc/hosts ou C:\winnt\hosts).", "DocumentRoot" => "La racine des documents est le repertoire de base de tous les fichiers qui sont accessibles à partir de nanoweb:", "DirectoryIndex" => "Ce fichier, si il existe, est envoyé à la place de la liste des fichiers du repertoire. Plusieurs noms de fichiers peuvent etre donnés si ils sont séparés par des espaces:", "DefaultContentType" => "Le header Content-type renvoyé par nanoweb quand celui ci n'a pas pu reconnaitre le type du contenu:", "SingleProcessMode" => "Le mode single process est un mode de fonctionnement dégradé dans lequel un seul processus prend en charge toutes les requetes HTTP. Ceci est necessaire sous windows par exemple, qui ne supporte pas la fonction fork():", "ServerMode" => "Une bonne connaissance des fichiers README est necessaire avant de changer cette option:", "User" => "Si vous ne voulez pas faire tourner nanoweb en tant que super utilisateur, laissez cette option sur sa valeur par défaut : www-data", "ListenInterface" => "nanoweb a besoin de se lier à une adresse IP et à un port pour pouvoir accepter des connexions entrantes.", "ListenQueue" => "Définit le nombre de connexions que nanoweb pourra garder en file d'attente.", "KeepAlive" => "Support des connexions HTTP persistantes. Mettez cette valeur à zero pour désactiver les connexions persistantes, ou un autre nombre pour définir le nombre maximum de requetes servies par session keep-alive :", "RequestTimeout" => "Certains navigateurs peuvent de temps en temps se déconnecter du serveur sans avoir envoyé de requete ou en ayant envoyé une requete incomplete. Cette option permet de limiter le temps d'attente maximum du serveur:", "ChildLifeTime" => "Cette option permet de donner un temps de vie maximum aux processus enfants (serveurs).", "TempDir" => "Repertoire temporaire, nanoweb doit avoir le droit d'écrire dans ce repertoire.:", "@-.nwaccess" => "Les noms des fichiers de controle d'access (access files) peut etre défini dans cette section:", "AccessFile" => "si vous voulez réutiliser les fichiers de controle d'acces de Apache par exemple, vous pouvez changer la valeur de cette option en ».htaccess« :", "MimeTypes" => "Nanoweb se base sur un fichier de types MIME pour déterminer le type de contenu qu'il doit annoncer au navigateur", "@-Logging" => "nanoweb propose plusieurs façons de journaliser tous les types d'activité. Si vous désirez utiliser pour cela une base de données MySQL, veuillez consulter le manuel.", "ServerLog" => "Le ServerLog recoit toutes les informations (y compris les hits):", "HostnameLookups" => "Désactivez cette fonction pour gagner un peu de performances, ou si votre analyseur de logs permet la résolution inverse des noms d'hotes:", "PidFile" => "Le fichier PID contient sous UNIX l'identifiant du processus.", "LoggerProcess" => "LoggerProcess, LoggerUser/Group ne peuvent etre déclarés que dans le fichier de configuration.", "LogHitsToConsole" => "Si vous désirez activer l'envoi des informations de log vers la console, mod_stdlog doit etre chargé.", "ParseExt" => "La directive ParseExt définit quel type de parser sera utiliser pour des certaines extensions.", "AllowPathInfo" => "»pathinfo« Activation du support path_info. Ceci vous permet d'utiliser des URL de type \"http://www.example.com/script/arg1/arg2\" au lieu de \"script.php?arg1=x&arg2=y\".", "PathInfoTryExt" => "Liste des extensions que nanoweb essayera en cas de demande d'un script avec path_ingo (permet d'utiliser /script/ au lieu de /script.php/):", "CGIFilterPathInfo" => "Un bug dans PHP-CGI empeche le fonctionnement optimal de scripts PHP sous nanoweb utilisant la variable path_info, cette directive permet de la filtrer:", "AllowExtSymlinks" => "Nanoweb ne permet pas l'access à des fichiers situés en dehors de la racine du site (voir DocumentRoot). Cette directive permet de passer outre cette limite pour les liens symboliques:", "IgnoreDotFiles" => "Les fichiers dont le nom commence par un point sont traités comme invisibles par la plupart des applications Unix.:", "Alias" => "Utilisez la directive Alias pour assigner des noms de repertoires virtuels à des repertoires existants.:", "ErrorDocument" => "Une page d'erreur personalisée peut etre renvoyée à la place du message d'erreur standard de nanoweb:", "AddHeader" => "Cette directive permet d'envoyer des entetes HTTP personalisées au client:", "UserDir" => "Les repertoires utilisateurs sont accessibles via http://www.example.com/~user/ si l'utilisateur en question a créé le repertoire suivant dans son home:", "@Modules" => "Les modules d'extensions suivants sont chargés au démarrage de nanoweb. Reportez vous au manuel pour une vue d'ensemble des modules disponibles pour nanoweb.", "GzipEnable" => "Les transferts HTTP peuvent etre accélérés par l'utilisation de la méthode standard de compression »gzip« (aussi appelée »format zlib«). Cette compression est supportée par tous les navigateurs recents.", "GzipMaxRatio" => "Ne compresser les données que si le ratio de compression est assez avantageux:", "FileBrowser" => "Le module file browser genere un listing du repertoire quand aucun fichier par defaut (voir DirectoryIndex) n'a été trouvé. La liste peut etre personalisée par plusieurs options:", "FBIconDirectory" => "Les repertoire /icons/ est un repertoire virtuel (voir Alias):", "MispellAction" => "Corrige les fautes de frappes dans les URL demandées. Peut effectuer une redirection vers la page correcte, ou simplement donner un lien vers celle-ci dans la page d'erreur:", "@-MultiViews" => "Le module multiviews ajoute à nanoweb le support transparent de la négociation de contenu.", "LanguagePriority" => "Le langage primaire de votre site web:", "OtherPriority" => "Liste des priorités serveur, celles ci sont utilisées quand le client n'envoie pas de demandes de priorités particulieres.", "ReflectRewriting" => "Egalement utilisé par mod_rewrite:", "@-Status" => "mod_status permet de consulter quelques informations sur l'état du serveur en temps reel. Consultez le manuel pour une liste des options supportées par mod_status.", "StatusAllowHost" => "Liste des addresses IP autorisées à consulter mod_status:", "@-StdoutLog" => "Cette option permet d'envoyer les lignes de log de chaque hit vers la sortie standard (console).", "@-MySQL Logging" => "mod_mysqllog écrit le journal d'activité du serveur dans une base de données MySQL. La table correspondate est automatiquement créée si elle n'existe pas:", "@Virtual Hosts" => "Un »virtual host« (ou serveur virtuel) a un nom de serveur et un repertoire racine different du serveur principal (ou serveur par defaut).
    La plupart des directives utilisées plus haut pour le serveur principal sont aussi utilisables pour les virtual hosts.

    ". 'Nom DNS du nouveau virtual host:

    ' ); ?>nanoweb_2.2.9/www/nanoconfig/.nwaccess0000644000000000000000000000035411023557654016523 0ustar rootrootACPolicy = deny ACAllowIP = 127.0.0.1 ACBlockMessage = Sorry, access is only allowed from trusted hosts # Uncomment the following to allow access from a local network #ACAllowIP = 10.0.0.* #ACAllowIP = 192.168.0.* nanoweb_2.2.9/www/nanoconfig/nanoconfig-en.php0000644000000000000000000006653111023557654020157 0ustar rootroot 'nanoweb logo ' ."This tool is intended for quick initial setup of nanoweb. It is often much easier and faster to edit the well documented configuration files and it is in fact impossible to configure each and every option through this interface, so an editor is necessary for fine-tuning.

    In order to be able to use this tool you must make the config files writeable on Linux/UNIX machines (not Windows):
    chmod a+rw {$T[$which]['CONFIG_FILE']}

    This can be revoked by pushing 'Lock Config' on this page after you have finished setup.

    You need to select [Save] on every page if you did changes to it.

    \n", "@-General" => "The main server needs a default DNS name which gets send back if a client doesn't know it yet. An alias name may contain asterisks. You cannot just invent names here without telling your operating system (see /etc/hosts or C:\winnt\hosts).", "@-.nwaccess" => "The name of the per-directory configuration files is not hardcoded, it's up to your choice how they are called.", "@-Logging" => "nanoweb supports various ways to log nearly all activities. If you want to enable logging to a MySQL database, please refer to the manual on how to setup the according extension module.", "@Modules" => "Following extension modules are currently set to be loaded on nanoweb startup. Note that entries, which are commented out, don't get shown here (yet). Have a look in the manual for an overview of all available modules.", "@-Authentication" => 'There are currently 6 different authentication modules available for nanoweb, which can be activated with the AuthRequire directive.', "@-Multiviews" => "The multiviews module extends nanoweb with transparent content negotiation (this means serving a file out of a bunch of variants that best matches the clients preferences).
    It partially helps with RVSA/1.0.", "@-Status" => "mod_status allows you to view some informations about the running server online.
    Please refer to the manual for the available info pages.", "@-StdoutLog" => "The module mod_stdlog prints the log to the console nanoweb.php was run from. This only works if you didn't used nanoctl to start the server.", "@-MySQL Logging" => "mod_mysqllog writes the server log into a database (instead of to some file, which the standard logging functions do).
    The according table is automagically created if everything is set up correctly:", "@-Proxy" => "mod_proxy is an internal proxy for nanoweb. Proxy servers are often used to be able to overcross a firewall, the nanoweb proxy is primarily a caching one.", "@-LoadLimit" => "mod_load_limit stops nanoweb from further serving pages if the server gets too slow.", "@-Brainfuck" => "Brainfuck server pages (.bsp) module.
    Please refer to the manual, READMEs and Google for further informations.", "@-DoS Evasive" => "This module prevents your server from going down due to »Denial of Service« attacks.", "@Virtual Hosts" => "A »virtual host« always has a server name and a docroot different from the main server. Many of the directives that can be used within the main server configuration section are allowed for virtual hosts too.

    " . 'DNS name for the new virtual host:
    ', "DocumentRoot" => "The document root is the base directory of all files which are available (via http://) through the nanoweb server:", "DirectoryIndex" => "The file that gets delivered in favour of a directory listing can be set using the DirectoryIndex directive. Multiple file names may be given here separated by spaces:", "DefaultContentType" => "When nanoweb cannot determine which type a file is of, it will use following value to tell the client (browser):", "SingleProcessMode" => "Because Windows™ doesn't support process forking like UNIX, nanoweb must run on this platform in the somewhat slower ", "ServerMode" => "You're strongly encouraged to have a look into the READMEs before changing the ", "User" => "If you don't want nanoweb to run with superuser privileges keep the default »www-data« as ", "ListenInterface" => "nanoweb needs to bind to at least one IP address and a TCP port (80 is the default for webservers) to listen for incoming connections.", "ListenQueue" => "A number of incoming requests can be delayed (until they are processed) depending on the size of the ", "KeepAlive" => "Modern HTTP clients can request different files without opening that much TCP/IP connections. This feature can be disabled by setting this directive to 0:", "RequestTimeout" => "Some browsers crash from time to time and thus cannot complete their requests after they already established and prepared a connection. To prevent nanoweb from waiting neverendless for unfinished requests this directive sets a timeout for these cases:", "ChildLifeTime" => "From time to time child processes need to be restarted because they may already be trapped in some neverending loop. Give an amount of seconds after which every child shall be recreated.", "MaxServers" => "Limits the number of child servers Nanoweb may create.", "TempDir" => "Set this to where nanoweb is allowed to saves some files temporarily:", "StaticBufferSize" => "mod_static handles all plain files, but loads big files into memory for faster output until following limit:", "ACPolicy" => "Nanoweb per default accepts requests from any host, but it can also be configured to allow only a few ones to access the server content.", "ACAllowIP" => "Hosts that should be granted access regardless of the default setting above may be given with names or IP numbers containing wildcards.", "ACDenyIP" => "If ACPolicy defaults to 'allow', you can still prevent some hosts from accessing your server:", "ACBlockError" => "You can customize the error response for blocked hosts.", "AccessFile" => "If you want to reuse the per-directory configuration files of apache for example you may want to change this to ».htaccess«:", "AccessPolicy" => "Per default config settings of per-directory configuration files override the values from the main server configuration; but this behaviour can be changed:", "AccessOverride" => "You can set the desired behaviour for individual directives independently from the default configuration settings overriding policy.", "MimeTypes" => "nanoweb initially fetches it's mime types from the system wide mime registry file found on all recent Linux systems, so there's actually no need to care about file extension mappings.", "DisableMimeMagic" => "If a files mime type cannot be determined by its extension nanoweb will let PHP (CVS or version 4.3 or later) guess the mime type by using the 'magic data' file. If you fear this is too slow (usually not the case) you could disable this.", "ServerLog" => "Nanoweb can create multiple ServerLogs. The second argument to the filename tells which message class should be written to the specified log. See the manual for a list of server message types.", "Log" => "Every virtual host (and so the main server) can log the access hits to a separate file.", "LogDir" => "Set a default directory for log files, so you can shorten the file path within the Log and ServerLog directives.", "HostnameLookups" => "You may want to keep the DNS lookups (for hostnames instead of IP addresses in server logs) disabled, as this slows down nanoweb a bit:", "HostnameLookupsBy" => "The actual lookup can be delayed, as the DNS query is only required for the server logs; select »logger« to speed up the main server / delivery:", "PidFile" => "The PidFile holds the »process id« on Linux/UNIX machines, which eases killing the server for nanoctl.", "LoggerProcess" => "LoggerProcess, LoggerUser/Group can only be set in the config file.", "LogHitsToConsole" => "If you want the log to be printed to the console (window) the module mod_stdlog must be loaded.", "ParseExt" => "The ParseExt directive defines which CGI interpreter shall be invoked for which file extension.", "AllowPathInfo" => "The pathinfo is an additional information holder besides the query string (GET) or the POST variables. It is often used in favour of GET variables because urls like \"script.php?a=x&b=1&cd=234\" frighten nearly all search engines, while the pathinfo is harmless.", "PathInfoTryExt" => "You probably want to note every CGI extension in here too, as this enables you to leave out extensions when referring to a CGI with an incomplete URI and without the need for mod_multiviews:", "CGIScriptsDir" => "Files in a (/cgi-bin/) directory specified here are treaten as CGIs if they have the executeable flag set (without dependency on file extension). If you just set this to / your exec-flag CGIs may be located anywhere.", "CGIScriptNoExec" => "If one of the scripts in your /cgi-bin/ has the executable flag not set, the server should normally send an error response to the requesing client (error), but may otherwise deliver this one as ordinary file (raw).", "CGIFilterPathInfo" => "The PHP interpreter still has a bug, which makes it trash the \$PHP_SELF variable if one passes a \$PATH_INFO. If this directive is enabled you won't be able to use PATH_INFO, if disabled you still can use SCRIPT_NAME in favour of PHP_SELF:", "ConfigDir" => "Specify the directory where all the configuration files of nanoweb and the theme files are kept:", "AllowSymlinkTo" => "Webservers only should allow access to files below the docroot (or the docroot of a virtual hosts). You may however allow nanoweb to serve files if you list the symlinks destination directory here:", "IgnoreDotFiles" => "Files whose name starts with a dot are treaten invisible by most UNIX applications; nanoweb for example keeps per-directory configuration and password data in files of this kind. You probably don't want anybody to be able to retrieve such files:", "Alias" => "Use the Alias directive to assign virtual directory names to absolute paths. These aliased directories can be accessed from any virtual host independent from any following configuration directives:", "ErrorDocument" => "A custom info page may be shown instead of nanoweb's built-in error messages:", "AddHeader" => "This directive allows you to send arbitrary HTTP headers to the client:", "UserDir" => "User directories are accessible via http://server/~user if the user created following subdirectory in his homedir.", "ServerSignature" => "You can control how much information about your server Nanoweb reports to clients, you could even report your server software with a faked free form string (useful for security reasons).", "Include" => "The Include directive allows to split the configuration into different files; nanoweb.conf, modules.conf and vhosts.conf are the default ones, and you probably don't want much more of these!", "ModulesDir" => "You don't need of course to give full path names for every module, if you specified a default directory for them:", "GzipEnable" => "Nearly all HTTP transfers can be accelerated if the requested content is encoded using the internet standard compression method »gzip« (also known as »zlib format«) as all recent browsers support transparent compression. This speeds up the transfer as there is usually less packet loss due to usually less tcp/ip packages, and most important: many users still use slow modem dialup connections.", "GzipLevel" => "You can force the compression library to spend more time on getting better results with a value of 9, but of course as speed is often more important, you should set this to some smaller value (5 is default):", "GzipMaxRatio" => "Only transfer compressed if it doesn't seems to be already compressed:", "FileBrowser" => "The filebrowser extension module generates directory listings where no default file (see DirectoryIndex) is available. The output may be tweaked by various options:", "FBIconDirectory" => "The /icons/ directory is an aliased one which can be reached from every vhost, that way it is much easier for mod_filebrowser to map icons to file types:", "AuthSimpleUserPass" => "mod_auth_simple allows you to specify all usernames and passwords within one of the configuration files with just this directive (enter login and password seperated with a space here):
    ", "AuthNwauthFilename" => "mod_auth_nwauth keeps the login/password pairs in the nanoweb authentication files:
    ", "AuthHtpasswdFilename" => "mod_auth_htpasswd allows you to use apache style authentication files:
    ", "AuthMysqlHost" => "with mod_auth_mysql you can use login/password pairs from an already existing MySQL user database:
    ", "AuthMysqlTable" => "Give here the table and column names that contain the user authentication records; and specify how the password field was encoded:
    ", "AuthPgsqlHost" => "with mod_auth_pgsql you can use login/password pairs from an already existing PostgreSQL database:
    ", "AuthLDAPServer" => "mod_auth_ldap fetches authentication data via LDAP:
    ", "MispellAction" => "Correct misspelled URLs automagically (internal redirect) or present an error page with correct URL:", "LanguagePriority" => "You may want to set the language that is the primary one on your web page:", "OtherPriority" => "Additional server-side preferences come into use, when the client is unwillingly to state which file types it supports:", "ReflectRewriting" => "Following directive is also used by mod_rewrite:", "StatusAllowHost" => "For security reasons you only should allow local users access to these status pages. An incomplete IP address is treaten as match pattern:", "ProxyCacheDir" => "Cache directory which will be filled with all requested files:", "ProxyAllowIP" => "Only specified hosts (or ranges when incomplete IP given here) are allowed to access other servers using the proxy:", "ProxyAccesLog" => "A seperate server log,", "ProxyDenySite" => "Sites which shall not be available through the server must be listed in this text file (one server name per line):", "LoadLimitErrorMessage" => "You can define a custom error message for blocked requests,", "LoadLimitAction" => "Nanoweb can block requests or redirect clients to 'fallback server' when the load limit is reached.", "LoadLimitRedirect" => "fallback server " ); $directive_descriptions["PHP"] = array( "@PHP" => "The PHP Hypertext Processor.\"PHP
    It wasn't originally planned to make PHP configurable with nanoconfig, so don't expect any miracles!

    You have to make the php.ini writeable as you did with the nanoweb configuration files (chmod a+rw php.ini) to be able to adjust the directives.", "engine" => "PHP can be enabled or disabled on a per directory basis, that's what this flag is for:", "expose_php" => "For security concerns some people don't want to tell the world that they're actually using PHP. Setting this flag only makes sense if none of the scripts is referred with the default trailing .php (add a ParseExt or use mod_rewrite to hide it effectively):", "short_open_tag" => "PHP code is enclosed in the XML-style <?php ... ?> tag, but most people want to leave out the »php« after the question mark
    <?...?> ", "asp_tags" => " ASP tags are rather unusual
    <%...%> ", "include_path" => "Give a list of colon separated directories to search for included files:", "auto_prepend_file" => "Following files are automagically included into every executed script (useful for setup of site specific runtime defaults):", "allow_url_fopen" => "PHP allows you to use the standard file access function calls to retrieve http:// and ftp:// resources (reading only). This is a very powerful feature, but can lead easily to security holes.", "doc_root" => "The following directives are compatibility ones. Just don't care if you use nanoweb.", "@-Variables" => "PHP once was known to be an ease to web development. For security reasons some of its behaviour has changed through the last versions. You can however gain compatibility with older versions with some of these options:", "register_globals" => "If you want all GET, POST and COOKIE variables to be automagically accessible in global name space (else these variables are accessible through \$_REQUEST[] or \$_GET[]), you probably want to enable ", "variables_order" => "Precedence order for Get, Post, Cookie, Session and Environment variables:", "register_argc_argv" => "\$argc and \$argv are only useful to standalone non-www scripts (CLI):", "precision" => "length of floating point variables", "magic_quotes_gpc" => "Enabling »magic quotes« will lead to escaped meta characters in variables that come from outside or are to be send out:", "@-Output" => "Every piece of output that comes from non-script areas or echo() may be buffered or feed through output handlers.", "output_buffering" => "You may set a buffer size (default for »on« is 4096 bytes) which allows you to send headers() even if something already has been printed out.", "zlib.output_compression" => "Instead of specifying one of the generic output handlers above you may want to auto compress your pages with the »zlib« output handler (this is what mod_gzip does for static pages):", "implicit_flush" => "If a output handler is active, flush the buffer after every echo() and non-php-script page part?", "safe_mode" => "The PHP »Safe Mode« allows to restrict availability of functions or access to not owned files and directories.", "safe_mode_gid" => "Check script's GID (»group id« on Linux/UNIX) also against accessed file, additionally to the standard UID (»user id«) test.", "safe_mode_include_dir" => "The uid/gid doesn't need to match for following two directories:", "disable_functions" => "This directive is also in effect, when safe mode is not enabled:", "enable_dl" => "The dl() function allows to load binary extension modules at runtime:", "@-Errors/Log" => "Errors may be suppressed or redirected determined by following config directives,", "error_reporting" => "Following value may be changed in each script by using the error_reporting() function call; however some errors are produced in load stage (parsing errors for example) and thus cannot be affected later. E_ALL, E_ERROR, E_WARNING, E_PARSE, E_NOTICE, E_COMPILE_ERROR, E_CORE_ERROR are only some of the available bits which may be combined with the »binary OR«: |", "display_errors" => "Mixing error messages into standard output (web page) is very handy for development but discouraged for production web sites:", "html_errors" => "Display errors using HTML markup (red color for example). You may want to set the error output enhancements in the php.ini after enabling this:", "error_log" => "Log errors to »syslog« (also available for NT but not in Windows 4.x) or to the file specified here:", "@-CGI" => "These are some legacy options to tweak behaviour of the CGI version of the PHP interpreter.", "cgi.force_redirect" => "Should really be disabled for Nanoweb:", "cgi.fix_pathinfo" => "If enabled PHP garbages the \$_SERVER[\"PATH_INFO\"] and some other CGI vars. Used for some stupid security reasons with Apache, and should be disabled here.", "cgi.rfc2616_headers" => "Apache does not use the CGI/1.1 specification headers corrrectly, while Nanoweb does and therefor the RFC2616 (HTTP/1.1) compliant headers should be used:", "memory_limit" => "Execution of scripts can be restricted in time and memory usage.", "post_max_size" => "Too huge POST requests may trash the server or slow down your scripts considerably, and thus are often used to fault webservers.", "file_uploads" => "HTML Forms allow to upload files with the HTTP POST method.", "from" => "Anonymous FTP connections require an email address to be send instead of a password:", "y2k_compliance" => "not really useful ", "extension" => "Many of the PHP extensions are now built-in; however some of them must be explicitly loaded and registered within the PHP core." ); $configuration_pages_add_section["NW"] = array( "html" => "Directives in a virtual host section may override values from the main server configuration.
    ", "html_2" => "Without a separate directory tree a virtual host section would be completely senseless:

    ", "DocumentRoot" => "string", "html_3" => "Match pattern for additional server names,
    ", "ServerAlias" => "multiple", "html_4" => "If you would like to have a separate server log for this virtual host, just give a different filename here.
    ", "Log" => "string" ); $configuration_pages_add_section["PHP"] = array( "html_seedoc" => "Please have a look at the online manual for informations on these configuration directives.

    " ); ?>nanoweb_2.2.9/install.bat0000644000000000000000000000224611023557654014107 0ustar rootroot@ECHO OFF ECHO ******************************************** ECHO * aEGiS nanoweb installer v1.0 for Windows * ECHO ******************************************** ECHO. SET INSTROOT=c:\nanoweb ECHO Installing in %INSTROOT% ECHO. mkdir %INSTROOT% mkdir %INSTROOT%\modules mkdir %INSTROOT%\www mkdir %INSTROOT%\log mkdir %INSTROOT%\tmp ECHO Installing nanoweb.php copy src\nanoweb.php %INSTROOT% /Y ECHO Installing modules xcopy modules %INSTROOT%\modules /E /Q /Y ECHO Installing default configuration copy conf\nanoweb-win.conf %INSTROOT%\nanoweb.conf /-Y copy conf\modules-win.conf %INSTROOT%\modules.conf /-Y copy conf\vhosts-win.conf %INSTROOT%\vhosts.conf /-Y copy conf\mime.types %INSTROOT%\mime.types /-Y copy conf\default.theme %INSTROOT%\default.theme /-Y copy conf\fancy.theme %INSTROOT%\fancy.theme /-Y copy conf\nanoweb.theme %INSTROOT%\nanoweb.theme /-Y ECHO Installing default WWW root xcopy www %INSTROOT%\www /E /Q copy docs\* %INSTROOT%\www\manual /Y ECHO. ECHO @ECHO OFF > %INSTROOT%\nanostart.bat ECHO c:\php\php-cli.exe %INSTROOT%\nanoweb.php --config=%INSTROOT%\nanoweb.conf >> %INSTROOT%\nanostart.bat ECHO Done nanoweb_2.2.9/contrib/0000755000000000000000000000000011023557654013405 5ustar rootrootnanoweb_2.2.9/contrib/cgi-nanoweb-wrapper.php0000755000000000000000000001723711023557654020002 0ustar rootroot$value) { $nww_request_head .= $name.": ".$value."\n"; } } else { if (empty($_SERVER["HTTP_HOST"])) { $nww_request_head .= "Host: ".$nww_server_hostname."\n"; } foreach ($_SERVER as $id=>$value) { if ((strpos($id,"HTTP_") === 0) && (strpos($value,"\n")===false)) { $name = substr($id, 5); $name = str_replace("_", " ", $name); $name = strtolower($name); $name = ucwords($name); $name = str_replace(" ", "-", $name); $nww_request_head .= $name.": ".$value."\n"; } } if (!empty($nww_request_body)) { $nww_request_head .= "Content-Length: ".$_SERVER["CONTENT_LENGTH"]."\n"; $nww_request_head .= "Content-Type: ".$_SERVER["CONTENT_TYPE"]."\n"; } } $nww_request_head .= "\n"; #-- fetch POST/PUT requests` body $nww_request_body_data = ""; if (strlen($nww_request_body)) { if (!empty($nww_request_body_data)) { #-- any other ideas? } #-- requires 4.3.0 elseif ($fp = fopen("php://input", "r")) { $nww_request_body_data = fread($fp, 0x0100000); fclose($fp); } #-- probably guessworking elseif ((1+php_ini_set("always_populate_raw_post_data", "1")) && isset($HTTP_RAW_POST_DATA)) { $nww_request_body_data = $HTTP_RAW_POST_DATA; } #-- outch elseif (strpos($_SERVER["CONTENT_TYPE"],"form-data")) { #-- ok, let's reconstruct it $boundary = $_SERVER["CONTENT_TYPE"]; $boundary = substr($boundary, strpos("boundary=",$boundary)+9); $boundary = trim($boundary, '"'); $nww_request_body_data .= "--$boundary"; foreach ($_POST as $name=>$value) { $nww_request_body_data .= "\n"; $nww_request_body_data .= "Content-Disposition: form-data; name=\"$name\"\n"; $nww_request_body_data .= "\n$value\n"; $nww_request_body_data .= "--$boundary"; } foreach ($_FILES as $name => $fa) { $nww_request_body_data .= "\n"; $nww_request_body_data .= "Content-Disposition: form-data; name=\"$name\" filename=\"".$fa["name"]."\"\n"; $nww_request_body_data .= "Content-Type: ".$fa["type"]."\n"; $value = "" . @implode("", @file($fa["tmp_name"])); $nww_request_body_data .= "\n$value\n"; $nww_request_body_data .= "--$boundary"; } $nww_request_body_data .= "--\n"; } elseif (strpos($_SERVER["CONTENT_TYPE"],"www-url-encoded")) { foreach ($_POST as $name=>$value) { $nww_request_body_data .= (strlen($nww_request_body_data)?"&":"") . $name . "=" . url_encode($value); } } else { ex("HTTP/1.1 500 Request Body Unavailable For Subserver"); } } #-- setup nanoweb.php inetd environment putenv("INETD_REMOTE_IP=".$_SERVER["REMOTE_ADDR"]); putenv("INETD_REMOTE_PORT=".$_SERVER["REMOTE_PORT"]); foreach ($_SERVER as $var=>$uu) { putenv($var); } #-- prepare nanoweb.php cmdline args: $_SERVER["argv"] = array( $NANOWEB_BINARY, "--quiet", "--set-option=SERVERMODE=inetd", "--set-option=SINGLEPROCESSMODE=1", "--set-option=MAXSERVERS=1", "--set-option=LOGGERPROCESS=0", "--set-option=KEEPALIVE=", "--set-option=LOGTOCONSOLE=0", "--set-option=PIDFILE=", "--set-option='SERVERNAME=$nww_server_hostname'", "--set-option='DOCUMENTROOT=$nww_server_docroot'", "--set-option='SERVERADMIN=$nww_server_admin'", "--set-option='LISTENINTERFACE=$nww_server_addr'", // "--add-option='ADDHEADER=X-Subserver-Wrapper: cgi-nanoweb/2.0.1-dev'", // "--set-option=ACCESSFILE=.nwaccess", ); $_SERVER["argc"] = count($_SERVER["argv"]); #-- "start" nanoweb.php, using eval() if ($FAST_INLINE_NANOWEB) { #-- define dummy socket ext functions if (!function_exists("socket_create")) { function socket_create($d,$t,$p) { return(false); } function socket_shutdown($s,$h=0) { return(false); } function socket_close($s) { return(false); } } #-- read nanoweb.php »binary« if ($fp = fopen($NANOWEB_BINARY, "r")) { $nwbin = fread($fp, 0x0100000); fclose($fp); } if (empty($nwbin)) { ex("HTTP/1.1 500 Subserver Misconfiguration"); } #-- patches: $REPLACEMENTS = array( # - - - - - - - - '$buf=read_request(' => '$buf=$nww_request_head; $dp=strpos($buf,"\n\n"); $pn=2; ## $buf=read_request(', # - - - - - - - - '$buf.=read_request(' => '$bug.=$nww_request_body_data; ## $buf.=read_request(', # - - - - - - - - '$hbuf=build_response_headers()' => '$hbuf=""; foreach (explode("\n",build_response_headers()) as $hline) { if (!$nww_nph) if (strpos($hline,"Server:")===0) { $hline = "X-".$hline; } header($hline); if ($nww_apache_headers) if (strpos($line, "HTTP/")===0) { header("Status:".substr($line,strpos($line," "))); } } ## $hbuf=build_response_headers()' # - - - - - - - - ); #-- apply foreach ($REPLACEMENTS as $orig => $new) { $nwbin = str_replace($orig, $new, $nwbin); } #-- strip first two lines, and the '?''>' at the bottom: list($uu, $uu, $nwbin) = explode("\n", $nwbin, 3); $nwbin = substr($nwbin, 0, strlen($nwbin) - 2); #-- remove ' from $argv foreach ($_SERVER["argv"] as $i=>$v) { $_SERVER["argv"][$i] = str_replace("'", "", $v); } #-- "execute" patched nanoweb.php eval($nwbin); } #-- this is the "SLOW" innovocation part, using exec() else { if ($fp=fopen($tmp_request_file=$TEMP_DIR.DIRECTORY_SEPARATOR."cgi-nanoweb-wrapper-http-request.".base_convert(time(),10,36).".".getmypid(), "w")) { fwrite($fp, $nww_request_head.$nww_request_body_data); fclose($fp); } else { ex("HTTP/1.1 500 Subserver Wrapping File I/O Error"); } $nww_pipe = popen( $PHP_BINARY . // " -c /home/www/www.example.com/nanoweb/my-php.ini " . " -f " . implode(" ", $_SERVER["argv"]) . " " . " < $tmp_request_file", "r" ); if ($nww_pipe) { if (PHP_SAPI != "CLI") { while (!feof($nww_pipe) && ($line=trim(fgets($nww_pipe)))) { if (!$nww_nph) if (strpos($line, "Server: ")===0) { $line = "X-".$line; } header($line); if ($nww_apache_headers) if (strpos($line, "HTTP/")===0) { header("Status:".substr($line, strpos($line, " "))); } if (empty($line)) break; } } while (!feof($nww_pipe)) { echo(fread($nww_pipe, 1024)); } pclose($nww_pipe); } unlink($tmp_request_file); } function ex($msg) { @header($msg); die($msg); } ?>nanoweb_2.2.9/contrib/mkhugenanoweb.php0000755000000000000000000001303111023557654016751 0ustar rootroot#!/usr/local/bin/php -q "/^-+h/i", "nwbin" => "/^-+n|-+b/", "config" => "/^-+c/", "modules" => "/^-+m/", "output" => "/^-+o/i", "auto" => "/^-+a/" )); if (($argc < 2) || (@$config["help"])) { echo <<< HELP_END This utility merges the nanoweb.php 2.1 »binary« with the pre-parsed configuration data and all the activated modules into one big standalone »binary« suitable (a bit faster) for inetd-mode operation. mkhugenanoweb.php [--options...] --nanoweb -n /usr/sbin/nanoweb.php --config -c /etc/nanoweb/nanoweb.conf --auto -a will search for all the required files (nanoweb.php, config files and modules) --output -o this parameter says where to write the resulting »large nanoweb.php binary« to, otherwise you should redirect stdout --modules -m is optional and gives the directory where all the modules are located --help -h this help In a hurry, just invoke mkhugenanoweb.php with the -a switch. HELP_END ; } else { #-- opts if (@$config["auto"]) { if (empty($config["nwbin"])) $config["nwbin"] = exec("which nanoweb.php"); if (empty($config["config"])) $config["config"] = "/etc/nanoweb/nanoweb.conf"; if (empty($config["output"])) $config["output"] = "large-nanoweb.php"; } if (!is_dir(@$config["modules"])) $config["modules"]=""; #-- read nanoweb binary if (!($f_nwbin = fopen($fn=$config["nwbin"], "r"))) die("could not open binary '$fn'!\n"); $nwbin = fread($f_nwbin, 524288); fclose($f_nwbin); #-- activate parts of the nanoweb binary $reduced = $nwbin; $p0 = strpos($nwbin, "$uu) { foreach ($conf[$cfsect] as $cfname=>$uu) { foreach($conf[$cfsect][$cfname] as $cfindex=>$cfvalue) { if (is_scalar($cfvalue)) { $cfvalue=addslashes($cfvalue); $php_conf .= "\$conf[\"$cfsect\"][\"$cfname\"][\"$cfindex\"]='$cfvalue';\n"; } } } } foreach ($mime as $mi=>$mv) { $php_conf .= "\$mime[\"$mi\"]=\"$mv\";\n"; } $php_conf .= '$themes=' . array_export($themes) . ";\n"; $php_conf .= '$access_policy=' . array_export($access_policy) . ";\n"; $php_conf .= '$posix_av=is_callable("posix_setuid");' . "\n". '$pcntl_av=is_callable("pcntl_fork");' . "\n". '$gz_av=is_callable("gzencode");' . "\n"; $php_conf .= '$conf=cmdline_conf_upd($conf, $cmdline_conf_overrides, $cmdline_conf_adds);'."\n"; $php_conf .= "\$conf[\"_complete\"]=true;\n"; #-- copy modules` code $php_modules = ""; if (! ($md = $config["modules"])) $md = $conf["global"]["modulesdir"][0]; foreach ($conf["global"]["loadmodule"] as $mod) { $f = fopen($md."/".$mod, "r"); $modc = fread($f, 262144); fclose($f); $modc = preg_replace('/^<[?].*?\n/', '', $modc); $modc = preg_replace('/[?]>.*?$/', '', $modc); $php_modules .= $modc; } $php_modules .= '$modules=load_modules($conf);' . "\n" . 'modules_init();' . "\n"; strip_comments($php_modules); #-- patch binary strip_comments($nwbin); $nwbin = str_replace('@include_once(', '## @include_once(', $nwbin); $nwbin = str_replace('$nload=(!class_exists(', '$nload=true; ##(!class_exists(', $nwbin); $nwbin = preg_replace('/\n(if [(]!is_readable[(][$]conf.{10,200}nanoweb_init[^\n]+\n)/ims', "\n/* ##\n\$1\n*/\n##", $nwbin); $nwbin = str_replace("##", "\n\n" . "##\n" . $php_conf . "##\n" . "\n" . "##\n" . $php_modules . "##\n" . "\n\n", $nwbin ); #-- finally: new "huge" nanoweb.php binary to stdout if ($fn=$config["output"]) { $f=fopen($fn, "w"); fwrite($f,$nwbin); fclose($f); echo "large nanoweb binary written to »{$fn}«\n"; } else { echo $nwbin; } } #-- we'll accept these commandline arguments: ----------------------- $regex_options = array( ); function regex_getopts($regexopts) { if (empty($_SERVER)) { $_SERVER = $GLOBALS["HTTP_SERVER_VARS"]; } if (!empty($GLOBALS["argc"])) { $_SERVER["argc"] = $GLOBALS["argc"]; $_SERVER["argv"] = $GLOBALS["argv"]; } $opts = array(); for ($n = 1; $n < $_SERVER["argc"]; $n++) { foreach ($regexopts as $opts_id => $optsregex) { if (preg_match($optsregex, $_SERVER["argv"][$n])) { $value = 1; if (($next = @$_SERVER['argv'][$n+1]) && ($next[0] != "-")) { $value = $next; $n++; } $opts[$opts_id] = $value; break; } } } return($opts); } function strip_comments(&$s) { $s = preg_replace('#\n\s*[/][*]\s.+?[*][/]#ms', "\n", $s); $s = preg_replace('#\n\s*[/][/]\s[^\n]+?\n#ms', "\n", $s); $s = preg_replace('/\n\s*[#]\s[^\n]+?\n/ms', "\n", $s); } function array_export($var, $indent = "", $output = "") { if (is_array($var)) { foreach ($var as $id => $next) { if ($output) $output .= ", "; else $output = "array("; $output .= "\"$id\"=>" . array_export($next, ""); } if (empty($output)) $output = "array("; $output .= ")"; } else { $output = "'" . preg_replace("/([\\\\\'])/", '\\\\$1', $var) . "'"; } if ($indent == " ") $output .= ";"; return($output); } ?> nanoweb_2.2.9/contrib/apache2nwconf0000755000000000000000000000562611023557654016062 0ustar rootroot#!/usr/local/bin/php -q "DocumentRoot", "servername" => "ServerName", "directoryindex" => "DirectoryIndex", "alias" => "Alias", "languagepriority" => "LanguagePriority", "servertype" => "ServerMode", // "timeout" => "RequestTimeout", // "maxservers" => "MaxServers", // "maxkeepaliverequests" => "KeepAlive", "serveradmin" => "ServerAdmin", "user" => "User", "group" => "Group", "typesconfig" => "MimeTypes", "defaulttype" => "DefaultContentType", "addtype" => "AddType" ); $c_2 = array( "serveralias" => "ServerAlias", "bindaddress" => "ListenInterface", "port" => "ListenPort", ); #-- help $fa = @$argv[1]; if (($argc < 2) || eregi('^-+h|/[h?]', $fa)) { echo<< /etc/nanoweb/vhosts.conf apache2nwconf -a > nw-vhosts.conf Convertes apache httpd virtual host configuration for use with the nanoweb http server. Change the program source to tweak some conversion parameters. EOT ; } else { if (eregi('^-+a', $fa)) { $fa = "/etc/apache/httpd.conf"; } if (!($ac = file($fa))) { die("Could not read »$fa«\n"); } $sect = "global"; $conf = array(); $conf["global"]["ServerName"][0]="localhost"; foreach ($ac as $line) { $line = trim($line); if (empty($line) || ($line[0] == "#")) continue; if ($line[0] == "<") { if ($line[1] == "/") { $sect = "global"; } elseif (preg_match('/^\s]+)/', $line, $uu)) { $sect = $uu[1]; } } else { list($directive, $value) = preg_split('/\s+/', $line, 2); $directive = strtolower($directive); if ($directive == "servername") { if ($sect == "global") continue; ## echo "#'[$sect]'=>'[$value]'\n"; $conf[$value] = $conf[$sect]; unset($conf[$sect]); $sect = $value; } if ($newname = @$c_1[$directive]) { $conf[$sect][$newname][] = $value; } elseif ($newname = @$c_2[$directive]) { foreach (preg_split('/\s+/', $value) as $v) { $conf[$sect][$newname][] = $v; } } } } #-- print $conf array in nanoweb.conf style echo "# autoconverted from $fa by apache2nwconf\n# UTC(" . time() .")\n"; if ($CONVERT_GENERAL_SETTINGS && (@$conf["global"])) { echo "\n[/global]\n# general settings imported from Apache:\n# Note that this can be dangerous!\n"; foreach ($conf["global"] as $dir => $a) { foreach ($a as $value) { echo str_pad($dir, 16) . " = $value\n"; } } echo "\n"; } if (isset($conf["global"])) unset($conf["global"]); echo "\n# VirtualHost sections\n"; foreach ($conf as $sect => $directives) { echo "\n[$sect]\n"; foreach ($directives as $dir => $a) { foreach ($a as $value) { echo str_pad($dir, 16) . " = $value\n"; } } echo "[/$sect]\n"; } echo "\n"; } ?>