| 1134 | } |
| 1135 | #ifdef MS_ENABLE_CGI_CL_DEBUG_ARGS |
| 1136 | else if( iArg < argc-1 && strcmp(argv[iArg], "-tmpbase") == 0) { |
| 1137 | msForceTmpFileBase( argv[++iArg] ); |
| 1138 | } else if( iArg < argc-1 && strcmp(argv[iArg], "-t") == 0) { |
| 1139 | char **tokens; |
| 1140 | int numtokens=0; |
| 1141 | |
| 1142 | if((tokens=msTokenizeMap(argv[iArg+1], &numtokens)) != NULL) { |
| 1143 | int i; |
| 1144 | for(i=0; i<numtokens; i++) |
| 1145 | printf("%s\n", tokens[i]); |
| 1146 | msFreeCharArray(tokens, numtokens); |
| 1147 | } else { |
| 1148 | writeError(); |
| 1149 | } |
| 1150 | |
| 1151 | exit(0); |
| 1152 | } else if( strncmp(argv[iArg], "MS_ERRORFILE=", 13) == 0 ) { |
| 1153 | msSetErrorFile( argv[iArg] + 13, NULL ); |
| 1154 | } else if( strncmp(argv[iArg], "MS_DEBUGLEVEL=", 14) == 0) { |
| 1155 | msSetGlobalDebugLevel( atoi(argv[iArg] + 14) ); |
| 1156 | } |
| 1157 | #endif /* MS_ENABLE_CGI_CL_DEBUG_ARGS */ |
| 1158 | else { |
| 1159 | /* we don't produce a usage message as some web servers pass junk arguments */ |
| 1160 | } |
| 1161 | } |
| 1162 | |
| 1163 | /* -------------------------------------------------------------------- */ |
| 1164 | /* Setup cleanup magic, mainly for FastCGI case. */ |
| 1165 | /* -------------------------------------------------------------------- */ |
| 1166 | #ifndef WIN32 |
| 1167 | signal( SIGUSR1, msCleanupOnSignal ); |
| 1168 | signal( SIGTERM, msCleanupOnSignal ); |
| 1169 | #endif |
| 1170 | |
| 1171 | #ifdef USE_FASTCGI |
| 1172 | msIO_installFastCGIRedirect(); |
| 1173 | |
| 1174 | #ifdef WIN32 |
| 1175 | atexit( msCleanupOnExit ); |
| 1176 | #endif |
| 1177 | |
| 1178 | /* In FastCGI case we loop accepting multiple requests. In normal CGI */ |
| 1179 | /* use we only accept and process one request. */ |
| 1180 | while( FCGI_Accept() >= 0 ) { |
| 1181 | #endif /* def USE_FASTCGI */ |
| 1182 | |
| 1183 | /* -------------------------------------------------------------------- */ |
| 1184 | /* Process a request. */ |
| 1185 | /* -------------------------------------------------------------------- */ |
| 1186 | mapserv = msAllocMapServObj(); |
| 1187 | mapserv->sendheaders = sendheaders; /* override the default if necessary (via command line -nh switch) */ |
| 1188 | |
| 1189 | mapserv->request->NumParams = loadParams(mapserv->request, NULL, NULL, 0, NULL); |
| 1190 | if( mapserv->request->NumParams == -1 ) { |
| 1191 | #ifdef USE_FASTCGI |
| 1192 | /* FCGI_ --- return to top of loop */ |
| 1193 | msResetErrorList(); |
nothing calls this directly
no test coverage detected