1 # ===================================================================== 2 # prg: generic PRG processor. 3 # 4 # Copyright (c) 2007,2008,2009 Carlo Strozzi 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; version 2 dated June, 1991. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write to the Free Software 17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 # 19 # ===================================================================== 20 21 # ===================================================================== 22 # Local variables and functions 23 # ===================================================================== 24 25 cgi.prgurl = () 26 mime_header = () 27 28 # ===================================================================== 29 # Main program 30 # ===================================================================== 31 32 csaGetArgs GET 33 34 cgi.prgurl = $CSA_SESSION(5)^-prg 35 36 # Only TagURI format is acceptable in PRG file name. 37 38 if (!~ $'cgi.prgurl' tag:* || ~ $'cgi.prgurl' */*) { 39 ~ $TNS_PRG_RELOAD http://* https://* && 40 csaExit.location $TNS_PRG_RELOAD 41 csaExit.fault 1001 42 } 43 44 csaIsFullPath --exists $TMPDIR/$'cgi.prgurl' || { 45 ~ $TNS_PRG_RELOAD http://* https://* && 46 csaExit.location $TNS_PRG_RELOAD 47 csaExit.fault 1001 48 } 49 50 csaTrapFile $TMPDIR/$'cgi.prgurl' 51 52 # Note: I use '--has-header' to tell csaExit.bdata that the response 53 # already contains a minimal response header, namely Content-Length, 54 # Content-Type and possibly others. 55 56 csaExit.bdata --has-header $TMPDIR/$'cgi.prgurl' 57 58 # End of program.