Annotation of win32/dist/config/auto.p, revision 1.2
1.1 misha 1: @conf[filespec][confdir;charsetsdir;sqldriversdir]
2:
3: $confdir[^file:dirname[$filespec]]
4: $charsetsdir[$confdir/charsets]
5: $sqldriversdir[$confdir/lib]
6:
7: $CHARSETS[
8: # $.cp866[$charsetsdir/cp866.cfg]
9: $.koi8-r[$charsetsdir/koi8-r.cfg]
10: # $.koi8-u[$charsetsdir/koi8-u.cfg]
11: # $.windows-1250[$charsetsdir/windows-1250.cfg]
12: $.windows-1251[$charsetsdir/windows-1251.cfg]
13: # $.windows-1254[$charsetsdir/windows-1254.cfg]
14: # $.windows-1257[$charsetsdir/windows-1257.cfg]
15: # $.x-mac-cyrillic[$charsetsdir/x-mac-cyrillic.cfg]
16: ]
17:
18: #change your client libraries paths to those on your system
19: $SQL[
20: $.drivers[^table::create{protocol driver client
21: #mysql $sqldriversdir/parser3mysql.dll $sqldriversdir/libmySQL.dll
22: sqlite $sqldriversdir/parser3sqlite.dll $sqldriversdir/sqlite3.dll
23: #pgsql $sqldriversdir/parser3pgsql.dll $sqldriversdir/libpq.dll
24: #odbc $sqldriversdir/parser3odbc.dll
25: #oracle $sqldriversdir/parser3oracle.dll c:\Oracle\Ora81\BIN\oci.dll?PATH+=^;C:\Oracle\Ora81\bin
26: }]
27: ]
28:
29: #for ^file::load[name;user-name] mime-type autodetection
30: $MIME-TYPES[^table::create{ext mime-type
31: 7z application/x-7z-compressed
32: avi video/x-msvideo
1.2 ! moko 33: bmp image/bmp
1.1 misha 34: css text/css
35: cvs text/csv
36: doc application/msword
37: docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
38: dtd application/xml-dtd
39: gif image/gif
40: gz application/x-gzip
41: htm text/html
42: html text/html
43: ico image/x-icon
44: jpeg image/jpeg
45: jpg image/jpeg
46: js application/javascript
47: json application/json
48: log text/plain
49: mov video/quicktime
50: mp3 audio/mpeg
1.2 ! moko 51: mp4 video/mp4
1.1 misha 52: mpg video/mpeg
53: mpeg video/mpeg
54: mts application/metastream
1.2 ! moko 55: otf font/otf
1.1 misha 56: pdf application/pdf
57: png image/png
58: ppt application/powerpoint
1.2 ! moko 59: rar application/vnd.rar
1.1 misha 60: rdf application/rdf+xml
61: rss application/rss+xml
62: rtf application/rtf
63: svg image/svg+xml
64: tar application/x-tar
65: tgz application/x-gzip
66: tif image/tiff
1.2 ! moko 67: tiff image/tiff
! 68: ttf font/ttf
1.1 misha 69: txt text/plain
70: wav audio/x-wav
71: xls application/vnd.ms-excel
72: xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
73: xml text/xml
74: xsl text/xml
1.2 ! moko 75: webm video/webm
! 76: webp image/webp
! 77: woff font/woff
! 78: woff2 font/woff2
1.1 misha 79: zip application/zip
80: }]
81:
82: $LIMITS[
83: $.post_max_size(10*0x400*0x400)
1.2 ! moko 84: ]
1.1 misha 85:
86: $MAIL[
87: $.SMTP[smtp.domain.ru]
88: ]
89:
90:
91: @fatal_error[title;subtitle;body]
92: $response:status(500)
93: $response:content-type[
94: $.value[text/html]
95: $.charset[$response:charset]
96: ]
97: <html>
98: <head><title>$title</title></head>
99: <body>
100: <h1>^if(def $subtitle){$subtitle;$title}</h1>
101: $body
102: #for [x] MSIE friendly
103: ^for[i](0;512/8){<!-- -->}
104: </body>
105: </html>
106:
107:
108: @unhandled_exception_debug[exception;stack]
109: ^fatal_error[Unhandled Exception^if(def $exception.type){ ($exception.type)};$exception.source;
110: <pre>^untaint[html]{$exception.comment}</pre>
111: ^if(def $exception.file){
1.2 ! moko 112: ^untaint[html]{<tt>$exception.file^(${exception.lineno}:$exception.colno^)</tt>}
1.1 misha 113: }
114: ^if($stack){
115: <hr/>
116: <table>
117: ^stack.menu{
118: <tr><td>$stack.name</td><td><tt>$stack.file^(${stack.lineno}:$stack.colno^)</tt></td></tr>
119: }
120: </table>
121: }
122: ]
123:
124:
125: @unhandled_exception_release[exception;stack]
126: ^fatal_error[Unhandled Exception;;
127:
1.2 ! moko 128: <p>The server encountered an unhandled exception and was unable to complete your request.</p>
! 129: <p>Please contact the server administrator, $env:SERVER_ADMIN and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p>
! 130: <p>More information about this error may be available in the Parser error log or in debug version of unhandled_exception.</p>
1.1 misha 131:
132: ]
133:
134:
135: @is_developer[]
136: #change mask to your ip address
137: $result(def $env:REMOTE_ADDR && ^env:REMOTE_ADDR.match[^^127\.0\.0\.1^$])
138:
139:
140: @unhandled_exception[exception;stack]
141: #developer? use debug version to see problem details
142: ^if(^is_developer[]){
143: ^unhandled_exception_debug[$exception;$stack]
144: }{
145: ^if($exception.type eq "file.missing"){
1.2 ! moko 146: # ^log404[]
! 147: # ^location[/404/]
1.1 misha 148: $response:status(404)
149: }{
150: ^unhandled_exception_release[$exception;$stack]
151: }
152: }
153:
154:
1.2 ! moko 155: @httpd-include[filename]
! 156: ^use[$filename; $.main(true) ]
! 157: ^main[]
! 158:
! 159: @httpd-index[dir][list]
! 160: ^fatal_error[Index of $dir;Index of $dir;
! 161: $list[^file:list[$dir]]
! 162: ^list.sort{^if($list.dir)[0;1] $list.name}
! 163: ^list.menu{
! 164: <a href="$list.name^if($list.dir){/}">^if($list.dir){/}$list.name</a><br/>
! 165: }
! 166: ]
! 167: $response:status(200)
! 168:
! 169: @httpd-option[option]
! 170: $result[^if($option is junction){^option[]}(^option.match[$httpd.parser]){^httpd-include[$option]}{$option}]
! 171:
! 172: @httpd-file[filename]
! 173: $result[^if(^filename.match[$httpd.parser]){^httpd-include[$filename]}{$response:body[ $.file[$filename] $.name[] ]}]
! 174:
! 175: @httpd-log[filename;detail][now;line]
! 176: $now[^date::now[]]
! 177: $line[$env:REMOTE_ADDR [^now.sql-string[]] "$request:method $request:uri"$detail^#0A]
! 178: ^line.save[append;$filename]
! 179:
! 180: @httpd-404[]
! 181: $response:status[404]
! 182: The requested URL was not found on this server.
! 183:
! 184:
! 185: @httpd-main[][uri;basic]
! 186:
! 187: $httpd[
! 188: $.parser[(\.html^$)]
! 189: $.index[index.html]
! 190: # $.autoindex(true)
! 191: $.404[$httpd-404]
! 192: # $.404[/_doc.html]
! 193: $.auth[ $.url[^^/\.?admin/] $.login[admin] $.password[test] $.realm[site administration] ]
! 194: $.deny[(/\.ht[^^/]+|\.p|\.cfg)^$]
! 195: $.403[Permission denied]
! 196: $.memory(64000)
! 197: $.log[/access.log]
! 198: ]
! 199:
! 200: $response:server[Parser$env:PARSER_VERSION]
! 201: $response:date[^date::now[]]
! 202: $response:connection[close]
! 203: $uri[^request:uri.match[\?.*][]{}]
! 204: $uri[^string:unescape[uri;$uri; $.charset[UTF-8] ]]
! 205:
! 206: ^if(def $httpd.log){
! 207: ^httpd-log[$httpd.log]
! 208: }
! 209: ^if(def $httpd.memory && $status:memory.ever_allocated_since_compact > $httpd.memory){
! 210: ^memory:compact[]
! 211: }
! 212:
! 213: ^if(def $httpd.auth.url && ^uri.match[$httpd.auth.url]){
! 214: $basic[$httpd.auth.login:$httpd.auth.password]
! 215: ^if($env:HTTP_AUTHORIZATION ne "Basic ^basic.base64[]"){
! 216: $response:WWW-Authenticate[Basic realm="$httpd.auth.realm"]
! 217: ^return[$response:status[401]]
! 218: }
! 219: $env:REMOTE_USER[$httpd.auth.login]
! 220: }
! 221:
! 222: ^if(def $httpd.deny && ^uri.match[$httpd.deny]){
! 223: $response:status[403]
! 224: $result[^httpd-option[$httpd.403]]
! 225: }(def $httpd.index && -f "$uri/$httpd.index"){
! 226: $result[^httpd-file[$uri/$httpd.index]]
! 227: }($httpd.autoindex && -d "$uri"){
! 228: $result[^httpd-index[$uri]]
! 229: }(-f $uri){
! 230: $result[^httpd-file[$uri]]
! 231: }{
! 232: # $form:request[^uri.mid(1)]
! 233: $result[^httpd-option[$httpd.404]]
! 234: }
! 235:
! 236:
1.1 misha 237: @auto[]
238: #source/client charsets
1.2 ! moko 239: $request:charset[utf-8]
! 240: $response:charset[utf-8]
1.1 misha 241:
242: $response:content-type[
243: $.value[text/html]
244: $.charset[$response:charset]
245: ]
246:
1.2 ! moko 247: #$SQL.connect-string[mysql://user:pass@host/db?charset=utf8]
! 248: #$SQL.connect-string[sqlite://db]
! 249: #$SQL.connect-string[pgsql://user:pass@host/db]
1.1 misha 250: #$SQL.connect-string[odbc://DSN=datasource^;UID=user^;PWD=password]
E-mail: