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

📄 features.pi3

📁 mini http server,可以集成嵌入到程序中,实现简单的web功能
💻 PI3
📖 第 1 页 / 共 3 页
字号:
# ---
#
#	Directory listing handlers and configuration
#
# ---
<Object>
	Name DirectoryMappings
	Class FlexibleHandlerClass

	#
	# 1..Simple HTML
	#
	# simple HTML, no icons or descriptions
	Mapping DocumentMapper From="/dir_SimpleHTML/" To="Pi3Docs/Features/" \
		Action="&dbreplace(response,string,DirListType,SimpleHTML)"

	#
	# 2..Simple DOS like format with alternate name
	# 
	Mapping DocumentMapper From="/dir_DOS/" To="Pi3Docs/Features/" \
		Action="&dbreplace(response,string,DirListType,DOS)"

	#
	# 3..Fixed pitch HTML with icons and descriptions
	# plain HTML
	Mapping DocumentMapper From="/dir_TableHTML/" \
		To="Pi3Docs/Features/" \
		Action="&dbreplace(response,string,DirListType,TableHTML)"

	#
	# 4..HTML with tables
	#
	# HTML with tables
	Mapping DocumentMapper From="/dir_PlainHTML/" To="Pi3Docs/Features/" \
		Action="&dbreplace(response,string,DirListType,PlainHTML)"

	# 
	# 5..Raw tab delimited text
	#
	# Tab delimited text
	Mapping DocumentMapper From="/dir_TDT/" To="Pi3Docs/Features/" \
		Action="&dbreplace(response,string,DirListType,TDT)"
</Object>


#
# Directory Indexes
#
<Object>
	Name DirectoryIndexes
	Class FlexibleHandlerClass

	# 1..Simple HTML
	Handle Condition="&cmp(&dblookup(response,string,DirListType),SimpleHTML)" \
		SimpleHTML

	# 2..Simple DOS format
	Handle Condition="&cmp(&dblookup(response,string,DirListType),DOS)" DOS

	# 3..Plain HTML
	Handle Condition="&cmp(&dblookup(response,string,DirListType),PlainHTML)" \
		PlainHTML 

	# 4..HTML with tables
	Handle Condition="&cmp(&dblookup(response,string,DirListType),TableHTML)" \
		 TableHTML 

	# 5..Raw tab delimited text
	Handle Condition="&cmp(&dblookup(response,string,DirListType),TDT)" TDT

	#
	# The default index type used for examples other than the
	# sample directory will be a table HTML index
	#
	Handle TableHTML
</Object>

# ---
#
# Simple HTML
#
# ---
<Object>
	Name SimpleHTML
	Class DirectoryIndexClass
	HeaderPattern "<HTML><TITLE>Simple index of %p</TITLE>\
<H2>Simple index of %p</H2>\n"
	ListTop "\
<PRE><B>\
&align(Name,23) \
&align(Size,6)  \
&align(Last Modified,18)\
\n<HR SIZE=1 NOSHADE></B>\n"
	FilePattern "\
<A HREF="%r">&align(&abbrev(%n,23,...)</A>,27) /*	link to file */\
&align(%s,6)  /*									size */\
&align(%l,18)/*										last modified date */\
\n"
	LastModifiedFormat "%d-%b-%y %H:%M"
	Include "*"
	SwapFileName ".. Parent Directory"
	ListBottom "</PRE>\n"
	FooterPattern "<HR SIZE=1 NOSHADE>\
Contact the hostmaster <A HREF="mailto:$a"<I>$a</I></A>.\
</HTML>"
	HeaderFile "HEADER"
	FooterFile "README"
	Exclude "."
	Exclude "~*"
	Exclude ".desc"
	Exclude "README"
	Exclude "HEADER"
	Options " Name | Size | RelPath "
</Object>

# ---
#
# Simple DOS formatted index
#
# ---
<Object>
	Name DOS
	Class DirectoryIndexClass
	HeaderPattern "<HTML><TITLE>DOS style index of %p - </TITLE>\
<H2>DOS style index of %p - </H2>\n\
"
	ListTop "<PRE>\
&align(Last Modified,24,left)\
&align(Size,14) \
&align('(8,3) Name',12) \
Name \n<HR SIZE=1 NOSHADE>"
	FilePattern "\
&align(%l,24)\
&if(%b,&align('&lt;DIR&gt;',18,left),&align(%s,14,right)) \
<A HREF="%r">&align(&abbrev(%a,12,...)</A>,16,left) \
<A HREF="%r">%n</A> \n"
	LastModifiedFormat "%d/%m/%y  %I:%M%p"
	Include "*"
	DescriptionFile ".desc"
	ListBottom "</PRE>\n"
	FooterPattern "<HR SIZE=1 NOSHADE>\
Contact the hostmaster <A HREF="mailto:$a"<I>$a</I></A>.\
</HTML>"
	HeaderFile "HEADER"
	FooterFile "README"
	Exclude "."
	Exclude "~*"
	Exclude ".desc"
	Exclude "README"
	Exclude "HEADER"
	Options " AltName | Name | FormatSize | RelPath "
</Object>

# ---
#
# Plain HTML directory listing with icons
#
# ---
<Object>
	Name PlainHTML
	Class DirectoryIndexClass
	HeaderPattern "<HTML><TITLE>Plain HTML index of %p</TITLE>\
<BODY BACKGROUND="/icons/\
&if(&cmpi($o,MainVirtualHostInformation),Pi3Tile.gif,H2Tile.gif)"/*background depends on vhost*/\
BGCOLOR="#FFFFFF">\
<H2>Plain HTML index of %p</H2>\n"
	ListTop "\
<PRE>\
<IMG SRC="/icons/blank.gif" BORDER=NONE ALT="  ">\
 &align(Name,23) &align(Last Modified,18)\
&align(Size,6)  Description\n<HR SIZE=1 NOSHADE>"
	FilePattern "\
<A HREF="%r"><IMG SRC="%i" BORDER=NONE ALT="[]"></A>/*icon is a link */\
 <A HREF="%r">&align(&abbrev(%n,23,...)</A>,27) /*	link to file */\
&align(%l,18)/*										last modified date */\
&align(%s,6)  /*									size */\
&if(%d,%d,<I>%c</I>)/*								description, or MIME */\
\n"
	LastModifiedFormat "%d-%b-%y %H:%M"
	Include "*"
	MIMEIcon "text/html /icons/layout.gif"
	MIMEIcon "text/x-code /icons/c.gif"
	MIMEIcon "text/x-perl /icons/p.gif"
	MIMEIcon "text/* /icons/text.gif"
	MIMEIcon "internal/x-directory /icons/folder.gif"
	MIMEIcon "audio/* /icons/sound2.gif"
	MIMEIcon "image/* /icons/image2.gif"
	MIMEIcon "application/x-uuencoded /icons/uuencoded.gif"
	MIMEIcon "application/x-tar /icons/compressed.gif"
	MIMEIcon "application/x-gzip /icons/compressed.gif"
	MIMEIcon "application/x-sh /icons/script.gif"
	MIMEIcon "application/* /icons/binary.gif"
	MIMEIcon "x-world/x-vrml /icons/burst.gif"
	MIMEIcon "*/* /icons/unknown.gif"
	DescriptionFile ".desc"
	SwapFileName ".. Parent Directory"
	ListBottom "</PRE>\n"
	FooterPattern "<HR SIZE=1 NOSHADE>\
Contact the hostmaster <A HREF="mailto:$a"<I>$a</I></A>.\
</BODY></HTML>"
	HeaderFile "HEADER"
	FooterFile "README"
	Exclude "."
	Exclude "~*"
	Exclude ".desc"
	Exclude "README"
	Exclude "HEADER"
	Options " Name | AbbrevSize | RelPath | Icon | MIMEType "
</Object>

# ---
#
# Enhanced sortable directory listing with HTML tables
#
# ---
<Object>
	Name TableHTML
	Class DirectoryIndexClass
	HeaderPattern "<HTML><META HTTP-EQUIV="expires" CONTENT="0"><TITLE>Index of %p</TITLE>\
<BODY BACKGROUND="/icons/\
&if(&cmpi($o,MainVirtualHostInformation),Pi3Tile.gif,H2Tile.gif)"/*background depends on vhost*/\
BGCOLOR="#FFFFFF">\
<H2>Index of %p</H2>\n"
	ListTop "<CENTER><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=100'%'>\
<TR>\
<TH NOWRAP ALIGN=LEFT></TH>\
<TH NOWARP ALIGN=LEFT><A HREF="%p?SortType=A">Type</A><BR>\&nbsp;\
<TH NOWRAP ALIGN=LEFT><A HREF="%p?SortName=A">Name</A><BR>\&nbsp;\
<TH NOWRAP ALIGN=LEFT><A HREF="%p?SortSize=A">Size</A><BR>\&nbsp;\
<TH NOWRAP ALIGN=LEFT><A HREF="%p?SortDate=A">Last Modified</A><BR>\&nbsp;\
<TH NOWRAP ALIGN=LEFT><A HREF="%p?SortDscr=A">Description</A><BR>\&nbsp;\n"
	FilePattern "<TR>\
<TD NOWRAP ALIGN=LEFT VALIGN=TOP>%m</TD><TD NOWRAP ALIGN=LEFT VALIGN=TOP>\
<A HREF="%r"><IMG SRC="%i" BORDER=NONE ALIGN=MIDDLE ALT=""></A>\
<TD NOWRAP ALIGN=LEFT VALIGN=TOP><A HREF="%r">&abbrev(%n,20,...)</A>\
<TD NOWRAP ALIGN=LEFT VALIGN=TOP>%s<TD NOWRAP ALIGN=LEFT VALIGN=TOP>%l\
<TD NOWRAP ALIGN=LEFT VALIGN=TOP>&if(%d,%d,<I>%c</I>)\n"
	ListBottom "</TABLE></CENTER>\n"
	LastModifiedFormat "%d-%b-%y %H:%M"
	Include "*"

	MIMEIcon "text/html /icons/layout.gif"
	MIMEIcon "text/x-code /icons/c.gif"
	MIMEIcon "text/x-perl /icons/p.gif"
	MIMEIcon "text/* /icons/text.gif"
	MIMEIcon "internal/x-directory /icons/folder.gif"
	MIMEIcon "audio/* /icons/sound2.gif"
	MIMEIcon "image/* /icons/image2.gif"
	MIMEIcon "application/x-uuencoded /icons/uuencoded.gif"
	MIMEIcon "application/x-tar /icons/compressed.gif"
	MIMEIcon "application/x-gzip /icons/compressed.gif"
	MIMEIcon "application/x-sh /icons/script.gif"
	MIMEIcon "application/* /icons/binary.gif"
	MIMEIcon "x-world/x-vrml /icons/burst.gif"
	MIMEIcon "*/* /icons/unknown.gif"
	DescriptionFile ".desc"
	SwapFileName ".. .."
	FooterPattern "<HR SIZE=1 NOSHADE>\
Contact the hostmaster <A HREF="mailto:$a"<I>$a</I></A>.\
</BODY></HTML>"
	HeaderFile "HEADER"
	FooterFile "README"
	Exclude "."
	Exclude "~*"
	Exclude ".desc"
	Exclude "README"
	Exclude "HEADER"
	NewPattern "<IMG SRC="/icons/new.gif">"
	NewTreshold 10
	Options " Name | AbbrevSize | RelPath | Icon | MIMEType | SortType | TagNew"
</Object>

# ---
#
# Raw tab delimited directory index. For input into other
# applications. This data could be cut and pasted into a 
# spreadsheet application.
#
# ---
<Object>
	Name TDT
	Class DirectoryIndexClass
	FilePattern "%r\t%n\t%l\t%s\t%c\n"
	LastModifiedFormat "%d-%b-%y %H:%M"
	Include "*"
	Exclude "."
	Exclude "~*"
	Exclude ".desc"
	Exclude "README"
	Exclude "HEADER"
	HTTPEquiv "Content-Type: text/plain"
	Options " Name | Size | RelPath "
</Object>

# ---
#
# CGIFileIOObject
# 	
#	IOObject used for communication between web browser and
#	server.
#
# ---
<Object>
	Name CGIFileIOObject
	Class PipeIOClass
	ReadTimeout -1
	WriteTimeout 10
	NoYield "Read"
</Object>


# ---
#
# StandardCGI
#
# Configuration for Standard CGI
#
# ---
<Object>
	Name StandardCGI
	Class CGIClass
	
	# Specify the IO object use to communicate with the CGI program
	FileIOObject CGIFileIOObject

	# Snoop IO objects can be instantiated in the IO chain with a line
	# like this. They log all IO traffic. This is useful for debugging.
#	FileIOObject SnoopIOObject IOObject="CGIFileIOObject" OutFile="cgi.dbg" 

	DefaultCommandLine "%p%q"
	CommandLineByExt .bat="cmd.exe /c %p%q"
	CommandLineByExt .cmd="cmd.exe /c %p%q"
	CommandLineByExt .pl="perl %p%q"
	IncludeParentsEnvironment Yes
	EnvironmentSize 8192
	
	# These are the environment variables that are sent to the
	# CGI program
	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 "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"
	SendCRLF Yes
</Object>

# ---
#
# WindowsCGI
#
# Handle windows CGI
#
# ---
<Object>
	Name WindowsCGI
	Class WinCGIClass
	FileIOObject CGIFileIOObject
	DefaultCommandLine "%p %d"
	ExtraHeaders Yes
	ExtraHeadersPrefix "HTTP_"
	ExtraHeadersIgnore "Content-Type Content-Length"

	# Generate windows CGI filenames by preappending the
	# process id to the unique identifier.
	ExternalPath "cgi-temp/"
	DataFile "cgi-temp/$P_%u.ini"
	StdinFile "cgi-temp/$P_%u.in"
	StdoutFile "cgi-temp/$P_%u.out"
	DataBlock "\[CGI]$M\
Request Protocol=$H$M\
Request Method=$m$M\
Executable Path=$f$M\
Logical Path=$I$M\
Physical Path=$Z$M\
Query String=$q$M\
Referer=&dblookup(request,rfc822,Referer)$M\
From=$i$M\
User Agent=&dblookup(request,rfc822,User-Agent)$M\
Content Type=$C$M\
Content Length=$Y$M\
Content File=%i$M\
Server Name=$v$M\
Server Admin=$a$M\
Server Port=$p$M\
Server Software=$S$M\
CGI Version=CGI/1.1 (Win)$M\
Remote Address=$A$M\
Remote Host=$h$M\
Authentication Method=$x$M\
Authenticated Username=$u$M\
Authenticated Password=&dblookup(response,string,AuthPass)$M\
Authentication Realm=&dblookup(response,string,AuthType)$M\
$M\
[Accept]$M\
%a$M\
[System]$M\
Output File=%o$M\
Content File=%i$M\
$M\
[Extra Headers]$M\
%h$M\
[Form Literal]$M\
%l$M\
[Form External]$M\
%e$M\
[Form File]$M\
%f$M\
[Form Huge]$M\
%g$M"
</Object>

⌨️ 快捷键说明

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