⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 devel.pi3

📁 mini http server,可以集成嵌入到程序中,实现简单的web功能
💻 PI3
📖 第 1 页 / 共 3 页
字号:
	#
	HostMap VirtualHosts

	#
	# Mapping virtual paths to example directory with 'DirListType' set
	#
	Mapping DirectoryMappings

	#
	# Default mappings
	#
	Mapping MapToErrorDocument \
		IgnoreStatus="0 200" \
		DefaultMessage="/errors/unknown.htm" \
		301="/errors/301.ssi" \
		304="/errors/304.htm" \
		400="/errors/400.htm" \
		401="/errors/401.ssi" \
		403="/errors/403.ssi" \
		404="/errors/404.ssi" \
		500="/errors/500.ssi" \
		501="/errors/501.htm"
	Mapping UserDirectory UserDirectoryRoot="/home/" \
		HTMLDirectory="/public_html"
	Mapping CGIMapper From="/cgi-bin/" To="cgi-bin/"
	Mapping WinCGIMapper From="/cgi-win/" To="cgi-win/"
	Mapping FCGIMapper From="/cgi-fcgi/" To="cgi-fcgi/"
	Mapping DocumentMapper From="/pidocs/" To="Pi3Docs/" 
	Mapping PathMapper From="/errors/" To="Fragment/" 
	Mapping PathMapper From="/icons/" To="Icons/" 
	Mapping PathMapper From="/logs/" To="Logs/" 
	Mapping AdminMapper From="/admin/" To="Logs/" 
	Mapping PathMapper From="/Pi3Expressions/" To="**internal**/" \
		Action="&dbreplace(response,string,ObjectMap,Pi3Expr)" \
		PathInfo="Yes"
	Mapping PathMapper From="/isapi/" To="Isapi/" \
		Action="&dbreplace(response,string,ObjectMap,ISAPI)" \
		PathInfo="Yes"

	#
	# Mapping specific to Host2
	#
	Mapping Host2Mappings

	#
	# Mapping specific to MainVirtualHostInformation
	#
	Mapping Host1Mappings
</Object>

# ---
#
# Default
#
#	Handle requests that other handlers have passed up
#
# ---
<Object>
	Name Default
	Class FlexibleHandlerClass
	CheckPath DirectoryExists IndexFile="index.html" \
		IndexFile="index.htm" IndexFile="Index.html" IndexFile="Index.htm"
	CheckPath RefuseFileByMask AllowFileMask="EF" RefuseStatus=404
	CheckPath RefuseFileByMask AllowFileMask="F" RefuseStatus=403
	CheckPath ReturnCode ReturnCode=COMPLETED
	CheckAuth BasicAuth Realm="Admin"
	CheckAuth ReturnCode ReturnCode=COMPLETED
	CheckAccess AccessByFile RequirePermissions="R"

	#
	# Cause a '501 Not Implemented' Message for requests that
	# are not 'GET' or 'HEAD', i.e.
	#	if !( Method=='GET' || Method=='HEAD' ) 
	#	then
	#		set status = 501
	#	endif
	#
	CheckType Condition="&not(&or(&cmpi($m,GET),&cmpi($m,HEAD)))" \
		StatusCode StatusCode="501"
	CheckType ConditionalGet
	CheckType CheckForDirectory SetType="internal/x-directory"

	#
	# Otherwise: Set the media type based on the file extension
	#
	CheckType MIMETypeByExtension 

	#
	# Return 'COMPLETED' so an internal error will not be raised
	#
	CheckType ReturnCode ReturnCode="COMPLETED"

	#
	# Most requests refer to a file, so put that first 
	#
	# Handle the request by sending a file if
	#	- The Value of ObjectMap in the response DB is ""
	#	AND
	#	- The Media type of the resource does not match internal/* 
	#
	Handle Condition="&and(&not(&dblookup(response,string,ObjectMap)),\
&not(&regexp('internal/*',$c)))" SendFile
	Handle Condition="&cmp($c,internal/x-directory)" DirectoryIndexes
	Handle Condition="&cmp($c,internal/x-server-parsed-html)" SendSSI \
		Exec=Yes ExecFileFixup="\
/* exec file="" maps to Standard CGI (Scripts) */\
&dbreplace(response,string,ObjectMap,Scripts)\
&dbreplace(response,rfc822,Content-Type,internal/x-cgi)"
	Handle Condition="&cmp($c,internal/x-imagemap)" ImageMap
	Handle Condition="&cmp($c,internal/x-server-parsed-php)" PHP4
	Handle SendFile
	Log AccessLogger File="Logs/access.txt"
	Log ReturnCode ReturnCode=COMPLETED
	Destroy DeleteTemporaryFiles
</Object>

# ---
#
# Documentation
#
#	Handler sequence for documentation.
#
# ---
<Object>
	Name Documentation
	Class FlexibleHandlerClass

	#
	# Only execute this sequence for the documentation (check for
	# the appropriate marker).
	#
	# Don't handle special resource types (internal/...)
	#
	Condition "&and(&cmp(&dblookup(response,string,ObjectMap),Pi3Docs),\
&not(&regexp('internal/*',$c)))"

	#
	# Check if file is a directory
	# 
	CheckType CheckForDirectory SetType="internal/x-directory"

	#
	# Lookup media type by extension
	#
	CheckType MIMETypeByExtension

	#
	# Force all non-internal media types to 'text/html'
	#
	CheckType Condition="&not(&regexp('internal/*',$c))" Action \
		Pi3Expression="&dbreplace(response,rfc822,Content-Type,text/html)"

	#
	# Return 'COMPLETED' so as not to fall into other cases
	#
	CheckType ReturnCode ReturnCode="COMPLETED"

	#
	# For documentation, Send documentation with header and footer
	#
	Handle SendFile HeaderPattern="<BODY BACKGROUND="/icons/\
&if(&cmpi($o,MainVirtualHostInformation),Pi3Tile.gif,H2Tile.gif)"/*background depends on vhost*/\
BGCOLOR="#FFFFFF">\n"
</Object>

# ---
#
# FastCGIIOObject
# 
# IOObject for communicating with fast CGI application servers. This
# one uses the TCP/IP transport.
#
# ---
<Object>
	Name FastCGIIOObject
	Class TCPIPIOClass
	Type Active

	# Timeouts. -1 specifies no timeout.
	RecvTimeout 20
	SendTimeout 20
</Object>

# ---
# 
# Scripts, WinScripts, ISAPI, FastCGIScripts, Pi3Expr
#
#	Handler sequences for resources which have mapped to these
# 	respective types
#
# ---
<Object>
	Name Scripts
	Class FlexibleHandlerClass
	Condition "&cmp(&dblookup(response,string,ObjectMap),Scripts)"
	CheckPath RefuseFileByMask AllowFileMask="EFD" RefuseStatus=404
	CheckPath RefuseFileByMask AllowFileMask="F" RefuseStatus=403
	CheckPath ReturnCode ReturnCode=COMPLETED
	CheckAccess AccessByFile RequirePermissions="X"
	CheckType ReturnCode ReturnCode=COMPLETED
	Handle StandardCGI
</Object>
<Object>
	Name WinScripts
	Class FlexibleHandlerClass
	Condition "&cmp(&dblookup(response,string,ObjectMap),WinScripts)"
	CheckPath RefuseFileByMask AllowFileMask="EFD" RefuseStatus=404
	CheckPath RefuseFileByMask AllowFileMask="F" RefuseStatus=403
	CheckPath ReturnCode ReturnCode=COMPLETED
	CheckAccess AccessByFile RequirePermissions="X"
	CheckType ReturnCode ReturnCode=COMPLETED
	Handle WindowsCGI
</Object>
<Object>
	Name ISAPI
	Class FlexibleHandlerClass
	Condition "&cmp(&dblookup(response,string,ObjectMap),ISAPI)"
	CheckPath RefuseFileByMask AllowFileMask="EFD" RefuseStatus=404
	CheckPath RefuseFileByMask AllowFileMask="F" RefuseStatus=403
	CheckPath ReturnCode ReturnCode=COMPLETED
	CheckAccess AccessByFile RequirePermissions="X"
	CheckType ReturnCode ReturnCode=COMPLETED
	Handle ISAPIExtensions
</Object>
<Object>
	Name ISAPIExtensions
	Class ISAPI20Class
	# These are the server variables that are sent to the
	# extension
	Variable "ALL_HTTP=%a"
	Variable "CONTENT_LENGTH=%l"
	Variable "AUTH_TYPE=$x"
	Variable "CONTENT_TYPE=$C"
	Variable "HTTPS=$g"
	Variable "GATEWAY_INTERFACE=CGI/1.1"
	Variable "PATH_INFO=$I"
	Variable "PATH_TRANSLATED=$Z"
	Variable "QUERY_STRING=$q"
	Variable "REMOTE_ADDR=$A"
	Variable "REMOTE_HOST=$h"
	Variable "REMOTE_IDENT=$i"
	Variable "REMOTE_USER=$u"
	Variable "REQUEST_METHOD=$m"
	Variable "SCRIPT_NAME=$z"
	Variable "SERVER_NAME=$v"
	Variable "SERVER_PORT=$p"
	Variable "SERVER_PROTOCOL=$H"
	Variable "SERVER_SOFTWARE=$S"
	ExtraHeaders Yes
	ExtraHeadersPrefix "HTTP_"
	ExtraHeadersIgnore "Content-Type Content-Length"
</Object>
<Object>
	Name FastCGIScripts
	Class FlexibleHandlerClass
	Condition "&cmp(&dblookup(response,string,ObjectMap),FastCGIScripts)"
	CheckPath RefuseFileByMask AllowFileMask="EFD" RefuseStatus=404
	CheckPath RefuseFileByMask AllowFileMask="F" RefuseStatus=403
	CheckPath ReturnCode ReturnCode="COMPLETED"
	CheckAccess ReturnCode ReturnCode="COMPLETED"
	CheckType ReturnCode ReturnCode="COMPLETED"
	Handle FastCGI \
		IOObject="FastCGIIOObject" \
		Variable="AUTH_TYPE=$x" \
		Variable="CONTENT_LENGTH=$Y" \
		Variable="CONTENT_TYPE=$C" \
		Variable="HTTPS=$g" \
		Variable="&if($K,HTTPS_KEYSIZE=$K,)" \
		Variable="&if($K,HTTPS_SECRETKEYSIZE=$G,)" \
		Variable="PATH_INFO=$I" \
		Variable="PATH_TRANSLATED=$Z" \
		Variable="QUERY_STRING=$q" \
		Variable="REMOTE_ADDR=$A" \
		Variable="REMOTE_HOST=$h" \
		Variable="REMOTE_IDENT=$i" \
		Variable="REMOTE_USER=$u" \
		Variable="REQUEST_METHOD=$m" \
		Variable="SCRIPT_NAME=$z" \
		Variable="SERVER_NAME=$v" \
		Variable="SERVER_PORT=$p" \
		Variable="SERVER_PROTOCOL=$H" \
		Variable="SERVER_SOFTWARE=$S"
</Object>
<Object>
	Name Pi3Expr
	Class FlexibleHandlerClass
	Condition "&cmp(&dblookup(response,string,ObjectMap),Pi3Expr)"
	CheckPath ReturnCode ReturnCode="COMPLETED"
	CheckAccess ReturnCode ReturnCode="COMPLETED"
	CheckType ReturnCode ReturnCode=COMPLETED
	Handle SendPi3Expression HTTPEquiv="Content-Type: text/html" \
		Pi3Expression="\
/*											 */\
/*											 */\
/* A Large Pi3Expression to send to the client */\
/*			  in one go					  */\
/*											 */\
/*   This will generate a dynamic HTML page	*/\
/*											 */\
<TITLE>Pi3Expressions - DB Dump</TITLE>\
<HTML><BODY BACKGROUND="/icons/Pi3Tile.gif">\
<CENTER><H2>Pi3Expressions - DB Dump</H2>\
<A NAME="index">$M\
<UL>$M\
<LI><A HREF="#connection">Connection DB</A>$M\
<LI><A HREF="#request">Request DB</A>$M\
<LI><A HREF="#response">Response DB</A>$M\
<LI><A HREF="#host">Host DB</A>$M\
</UL>$M\
<HR>$M\
<A NAME="connection">$M\
<H3>Dump of Connection DB <I>dblookup(connection,...)</I></H3>$M\
<TABLE BORDER=1 CELLPADDING=5><TH>Type<TH>Variable<TH>Value$M\
&dblookup(connection,string,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(connection,rfc822,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(connection,opaque,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
</TABLE>\
<A HREF="#index">Index</A>$M\
<HR>$M\
<A NAME="request">$M\
<H3>Dump of Request DB <I>dblookup(request,...)</I></H3>$M\
<TABLE BORDER=1 CELLPADDING=5><TH>Type<TH>Variable<TH>Value$M\
&dblookup(request,string,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(request,rfc822,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(request,opaque,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
</TABLE>\
<A HREF="#index">Index</A>$M\
<HR>$M\
<A NAME="response">$M\
<H3>Dump of Response DB <I>dblookup(response,...)</I></H3>$M\
<TABLE BORDER=1 CELLPADDING=5><TH>Type<TH>Variable<TH>Value$M\
&dblookup(response,string,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(response,rfc822,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(response,opaque,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
</TABLE>\
<A HREF="#index">Index</A>$M\
<HR>$M\
<A NAME="host">$M\
<H3>Dump of Host DB <I>dblookup(host,...)</I></H3>$M\
<TABLE BORDER=1 CELLPADDING=5><TH>Type<TH>Variable<TH>Value$M\
&dblookup(host,string,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(host,rfc822,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
&dblookup(host,opaque,,,<TR><TD><B>&_(2)</B><TD>&_(1)<TD>&_()$M)\
</TABLE>\
<A HREF="#index">Index</A>$M\
</CENTER><HR></BODY></HTML>"

</Object>

# ---
#
#	Virtual hosting handlers and configuration
#
# ---

#
# Host2 Virtual host object
<Object>
	Name Host2
	Class VirtualHostClass
	Administrator mr_web@Host2.dom
	HostName www.johnroy.com/host2
	ServerPort 80
</Object>

#
# Virtual host mappings
#
<Object>
	Name VirtualHosts
	Class FlexibleHandlerClass

	#
	# if the URL starts with '/host2/' assign to virtual host 2
	#
	HostMap VirtualHostByURL VirtualHostObject="Host2" URLPath="/host2/"

	#
	# Introduce a mapping
	Mapping Host2Mappings
</Object>

#
# Override some mappings for Host2 only
#
<Object>
	Name Host2Mappings
	Class FlexibleHandlerClass

	#
	# These mappings only apply to Host2
	#
	Condition "&cmp($o,Host2)"

	#
	# map to second document root
	#
	Mapping PathMapper From="/" To="WebRoot2/"
</Object>

#
# Host1 mappings
#
<Object>
	Name Host1Mappings
	Class FlexibleHandlerClass
	#
	# These mappings only apply to MainVirtualHostInformation
	#
	Condition "&cmp($o,MainVirtualHostInformation)"
	#
	# map to first document root
	#
	Mapping PathMapper From="/" To="WebRoot/"
</Object>

# ---
#
# HTTPLogicObject
#
# 	HTTP Logic object, dispatches requests to all other handlers
#
# ---
<Object>
	Name HTTPLogicObject
	Class HTTPDispatcherClass
	Handlers Start Scripts WinScripts FastCGIScripts Documentation Pi3Expr ISAPI Default
	KeepOpen On
	ServerRoot ./../
	ServerStamp Pi3Web/2.0.3
	DefaultHost MainVirtualHostInformation
	MIMEFile "Fragment/Mime.typ"
	DefaultMIMEType "application/octet-stream"
	ErrorLogFile "Logs/error.txt"

	# Specifying a file for DebugLogFile effectively turns on debugging
#	DebugLogFile "Logs/debug.txt"

	#
	# The following to directives specify expressions to be logged
	# before and after each handler execution respectively.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -