Нашли или выдавили из себя код, который нельзя назвать нормальным,
на который без улыбки не взглянешь?
Не торопитесь его удалять или рефакторить, — запостите его на
говнокод.ру, посмеёмся вместе!
# Fallback static file handler, now with XSendfile support.
if not if(test -f $local_path) {
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader='X-Accel-Redirect'
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^'/'$local_path
}
if not
static_file $local_path
}
if not if(~ $req_path /pub/* && test -f .$req_path) {
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader='X-Accel-Redirect'
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^'/'$req_path
}
if not
static_file .$req_path
}
Более говновый вариант 🙂 cgilib.rc:
fn static_file {
echo 'Content-Type: '`{select_mime $1}
if(! ~ $#xsendfile 0)
;
if not {
echo
cat $1
exit
}
}
corehandlers.rc:
# Fallback static file handler, now with XSendfile support.
if not if(test -f $local_path) {
static_file $local_path
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader=$xsendfile_alternate
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^/$local_path
}
}
if not if(~ $req_path /pub/* && test -f .$req_path) {
static_file .$req_path
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader=$xsendfile_alternate
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^$req_path
}
}
initrc.local:
# Support for sending static data directly via server.
xsendfile=true
# Use 'X-Accel-Redirect' for Nginx
# 'X-LIGHTTPD-send-file' for Lighttpd v1.4
#xsendfile_alternate='X-Accel-Redirect'
xsendfile=true
# Use 'true' for Nginx
xsendfile_alternate=false
http://werc.cat-v.org/
http://hg.cat-v.org/werc/file/275899147886/bin/corehandlers.rc#l1
http://hg.cat-v.org/werc/file/275899147886/README#l1
http://sed-story.ru/blog/saitostroenie/21.html
cgilib.rc:
fn static_file {
echo 'Content-Type: '`{select_mime $1}
if(! ~ $#xsendfile 0)
;
if not {
echo
cat $1
exit
}
}
corehandlers.rc:
# Fallback static file handler, now with XSendfile support.
if not if(test -f $local_path) {
static_file $local_path
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader=$xsendfile_alternate
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^/$local_path
}
}
if not if(~ $req_path /pub/* && test -f .$req_path) {
static_file .$req_path
if(! ~ $#xsendfile 0) {
if(! ~ $#xsendfile_alternate 0)
XSendfileHeader=$xsendfile_alternate
if not
XSendfileHeader='X-Sendfile'
echo $XSendfileHeader': '`{pwd}^$req_path
}
}
initrc.local:
# Support for sending static data directly via server.
xsendfile=true
# Use 'X-Accel-Redirect' for Nginx
# 'X-LIGHTTPD-send-file' for Lighttpd v1.4
#xsendfile_alternate='X-Accel-Redirect'