Ignore:
Timestamp:
Jun 24, 2015, 1:58:17 AM (9 years ago)
Author:
djay
Message:

Various fixes for Windows support: generate uuid using UuidCreate?, pass usid to the created process, call TerminateProcess? on dismiss request.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r676 r680  
    5656#include "request_parser.h"
    5757#include "sqlapi.h"
     58#ifdef WIN32
     59#include "caching.h"
     60#endif
    5861
    5962#ifdef USE_PYTHON
     
    707710  fprintf (stderr, "DATAOUTPUTSKVP %s\n", dataOutputsKVP);
    708711#endif
    709   map *sid = getMapFromMaps (m, "lenv", "sid");
     712  map *sid = getMapFromMaps (m, "lenv", "osid");
     713  map *usid = getMapFromMaps (m, "lenv", "usid");
    710714  map *r_inputs = getMapFromMaps (m, "main", "tmpPath");
    711715  map *r_inputs1 = getMap (request_inputs, "metapath");
     
    725729 
    726730  if(r_inputs2 != NULL && tmpReq != NULL) {
    727         const char key[] = "rfile=";
    728         char* kvp = (char*) malloc((FILENAME_MAX + strlen(key))*sizeof(char));
    729         char* filepath = kvp + strlen(key);
    730         strncpy(kvp, key, strlen(key));
    731         addToCache(m, tmpReq->value, tmpReq->value, "text/xml", strlen(tmpReq->value),
    732                    filepath, FILENAME_MAX);                               
     731    const char key[] = "rfile=";
     732    char* kvp = (char*) malloc((FILENAME_MAX + strlen(key))*sizeof(char));
     733    char* filepath = kvp + strlen(key);
     734    strncpy(kvp, key, strlen(key));
     735    addToCache(m, tmpReq->value, tmpReq->value, "text/xml", strlen(tmpReq->value),
     736               filepath, FILENAME_MAX);                           
    733737    if (filepath == NULL) {
    734         errorException( m, _("Unable to cache HTTP POST Execute request."), "InternalError", NULL); 
    735                 return;
     738      errorException( m, _("Unable to cache HTTP POST Execute request."), "InternalError", NULL); 
     739      return;
    736740    }   
    737         sprintf(tmp,"\"metapath=%s&%s&cgiSid=%s",
    738                 r_inputs1->value,kvp,sid->value);
     741    sprintf(tmp,"\"metapath=%s&%s&cgiSid=%s&usid=%s\"",
     742            r_inputs1->value,kvp,sid->value,usid->value);
    739743    sprintf(tmpq,"metapath=%s&%s",
    740                 r_inputs1->value,kvp);
    741         free(kvp);             
     744            r_inputs1->value,kvp);
     745    free(kvp); 
    742746  }
    743747  else if (r_inputs2 != NULL)
    744748    {
    745749      sprintf (tmp,
    746                "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s&cgiSid=%s",
     750               "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s&cgiSid=%s&usid=%s\"",
    747751               r_inputs1->value, req->value, id->value, dataInputsKVP,
    748                r_inputs2->name, dataOutputsKVP, sid->value);
     752               r_inputs2->name, dataOutputsKVP, sid->value, usid->value);
    749753      sprintf (tmpq,
    750754               "metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&%s=%s",
     
    755759    {
    756760      sprintf (tmp,
    757                "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&cgiSid=%s",
     761               "\"metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s&cgiSid=%s&usid=%s\"",
    758762               r_inputs1->value, req->value, id->value, dataInputsKVP,
    759                sid->value);
     763               sid->value, usid->value);
    760764      sprintf (tmpq,
    761765               "metapath=%s&request=%s&service=WPS&version=1.0.0&Identifier=%s&DataInputs=%s",
     
    777781#endif
    778782
    779   map* usid = getMapFromMaps (m, "lenv", "usid");
     783  usid = getMapFromMaps (m, "lenv", "usid");
    780784  if (usid != NULL && usid->value != NULL) {
    781785    SetEnvironmentVariable("USID", TEXT (usid->value));
    782786  }
    783 
    784787  SetEnvironmentVariable ("CGISID", TEXT (sid->value));
    785788  SetEnvironmentVariable ("QUERY_STRING", TEXT (tmpq));
     
    911914    }
    912915
    913 
    914916  /**
    915917   * Manage our own error log file (usefull to separate standard apache debug
     
    991993      char tmpUrl[1024];
    992994       
    993       if ( getenv("HTTPS") != NULL && strncmp(getenv("HTTPS"), "on", 2) == 0 ) { // Knut: check if non-empty instead of "on"?           
     995      if ( getenv("HTTPS") != NULL && strncmp(getenv("HTTPS"), "on", 2) == 0 ) {
     996        // Knut: check if non-empty instead of "on"?           
    994997        if ( strncmp(cgiServerPort, "443", 3) == 0 ) {
    995998          sprintf(tmpUrl, "https://%s%s", cgiServerName, cgiScriptName);
     
    19271930
    19281931  map *test1 = getMap (request_inputs, "cgiSid");
    1929   if (test1 != NULL)
    1930     {
     1932  if (test1 != NULL){
    19311933      cgiSid = test1->value;
    19321934      addToMap (request_inputs, "storeExecuteResponse", "true");
     
    19351937      status = getMap (request_inputs, "status");
    19361938    }
     1939  test1 = getMap (request_inputs, "usid");
     1940  if (test1 != NULL){
     1941    setMapInMaps (m, "lenv", "usid", test1->value);
     1942    setMapInMaps (m, "lenv", "uusid", test1->value);
     1943  }
    19371944#endif
    19381945  char *fbkp, *fbkpid, *fbkpres, *fbkp1, *flog;
     
    19831990          pid = 0;
    19841991          cpid = atoi (cgiSid);
     1992          updateStatus(m,0,_("Initializing"));
    19851993        }
    19861994#endif
     
    20292037          sprintf (fbkpid, "%s/%s.pid", r_inputs->value, usid->value);
    20302038
    2031           f0 = freopen (fbkpid, "w+", stdout);
    2032           fprintf(stdout,"%d",getpid());
     2039          f0 = freopen (fbkpid, "w+",stdout);
     2040          printf("%d",getpid());
    20332041          fflush(stdout);
    20342042
     
    20392047                     strlen (usid->value) + 7) * sizeof (char));
    20402048          sprintf (fbkp, "%s/%s.sid", r_inputs->value, usid->value);
    2041 
    2042           FILE* f2 = fopen (fbkp, "w+");
    2043           fprintf(f2,"%s",tmpm->value);
     2049          FILE* f2 = freopen (fbkp, "w+",stdout);
     2050          printf("%s",tmpm->value);
    20442051          fflush(f2);
    2045           fclose(f2);
    20462052          free(fbkp);
    20472053
     
    20712077          fclose (stdin);
    20722078#endif
    2073           fprintf(stderr,"DEBUG START %s %d \n",__FILE__,__LINE__);
    20742079#ifdef RELY_ON_DB
    20752080          init_sql(m);
     
    21632168    {
    21642169      fclose (stdout);
    2165       //fclose (stderr);
     2170      fclose (stderr);
    21662171      /**
    21672172       * Dump back the final file fbkp1 to fbkp
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png