/*
*
* ProLinga-Web
*
* Copyright (C) 2002-2008 Xobas Software.
* All rights reserved.
*
* This file is part of ProLinga-Web.
*
* ProLinga-Web is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProLinga-Web is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProLinga-Web. If not, see .
*
* More information is available at the following addresses:
*
* Website : http://www.prolinga.org
*
* Email : prolinga-list@prolinga.org
*
*
*/
#include "WebCommon.h"
#include
#include
#include "WCWebCommand.hpp"
#include "WebProcess.hpp"
#include "GetCgiVars.hpp"
#include "WebService.hpp"
#if BUILD_RUN
#include
PlRunPtr runPtr = NULL;
#endif
int main(int argc, char *argv[])
{
xmlDocPtr docRes;
char **cgiVars;
xmlDocPtr docSvc;
/* Parse Services file */
docSvc = xmlParseFile(DEF_WEB_SERVICE_FILE);
if (docSvc == NULL)
{
printf("Content-type: text/plain\n\n");
printf("ProLinga-Web: Can not read services file %s.\n", DEF_WEB_SERVICE_FILE);
printf("\nVersion: %s\n", VERSION);
printf("Copyright © 2002-2008 The ProLinga Team.\n");
printf("All rights reserved.\n");
xmlFreeDoc(docSvc);
exit(0);
}
#if BUILD_RUN
/* Open Run environment */
runPtr = new PlRun;
runPtr->runOpen(NULL, argc, argv);
#endif
#if BUILD_FASTCGI
/* Start FastCGI loop */
while (FCGI_Accept() >= 0)
{
#endif
/* Get web variables and place into strings */
cgiVars = GetCgiVars();
/* Create/Send Request, Receive response */
docRes = WCWebCommand(cgiVars, docSvc);
/* Process Response and return result */
WebProcess(docRes);
/* Clean up */
xmlFreeDoc(docRes);
#if BUILD_FASTCGI
}
#endif
#if BUILD_RUN
/* Close Run environment */
runPtr->runClose();
#endif
/* Exit */
xmlFreeDoc(docSvc);
exit(0) ;
}