Ignore:
Timestamp:
Dec 12, 2017, 4:09:47 PM (6 years ago)
Author:
djay
Message:

Add status_code key to the lenv section to support returning a specific HTTP error code from the service code. Fix callback invocation to support inputs arrays at step 1 and 2. Fix issue with cpu usage. Fix issue with mapserver publication when an input is optional. Fix callback invocation at step 7 in case the service has failed on the HPC side.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c

    r854 r860  
    22012201      int hasValidCookie = -1;
    22022202      char *tcook = originalCookie = zStrdup (cgiCookie);
    2203       //fprintf(stderr,">>>>> %s %d %s\n",__FILE__,__LINE__,tcook );
    2204       char *tmp = NULL;
    22052203      map *testing = getMapFromMaps (m, "main", "cookiePrefix");
    22062204      parseCookie(&m,originalCookie);
    2207       if (testing == NULL)
     2205      map *sessId=getMapFromMaps(m,"cookies",(testing==NULL?"ID":testing->value));
     2206      if (sessId!=NULL)
    22082207        {
    2209           tmp = zStrdup ("ID=");
    2210         }
    2211       else
    2212         {
    2213           tmp =
    2214             (char *) malloc ((strlen (testing->value) + 2) * sizeof (char));
    2215           sprintf (tmp, "%s=", testing->value);
    2216         }
    2217       if (strstr (cgiCookie, ";") != NULL)
    2218         {
    2219           char *token, *saveptr;
    2220           token = strtok_r (tcook, ";", &saveptr);
    2221           while (token != NULL)
    2222             {
    2223               if (strcasestr (token, tmp) != NULL)
    2224                 {
    2225                   if (tcook != NULL)
    2226                     free (tcook);
    2227                   tcook = zStrdup (token);
    2228                   hasValidCookie = 1;
    2229                 }
    2230               token = strtok_r (NULL, ";", &saveptr);
    2231             }
    2232         }
    2233       else
    2234         {
    2235           if (strstr (cgiCookie, "=") != NULL
    2236               && strcasestr (cgiCookie, tmp) != NULL)
    2237             {
    2238               tcook = zStrdup (cgiCookie);
    2239               hasValidCookie = 1;
    2240             }
    2241           if (tmp != NULL)
    2242             {
    2243               free (tmp);
    2244             }
    2245         }
    2246       if (hasValidCookie > 0)
    2247         {
    2248           addToMap (_tmpMaps->content, "sessid", strstr (tcook, "=") + 1);
     2208          addToMap (_tmpMaps->content, "sessid", sessId->value);
    22492209          char session_file_path[1024];
    22502210          map *tmpPath = getMapFromMaps (m, "main", "sessPath");
     
    22542214          if (tmp1 != NULL)
    22552215            sprintf (session_file_path, "%s/sess_%s.cfg", tmpPath->value,
    2256                      strstr (tmp1, "=") + 1);
     2216                     sessId->value);
    22572217          else
    22582218            sprintf (session_file_path, "%s/sess_%s.cfg", tmpPath->value,
    2259                      strstr (cgiCookie, "=") + 1);
     2219                     sessId->value);
    22602220          free (tcook);
    22612221          maps *tmpSess = (maps *) malloc (MAPS_SIZE);
     
    23512311  if (status == NULLMAP)
    23522312    {
    2353       /*        hInternet = InternetOpen (
    2354 #ifndef WIN32
    2355                                   (LPCTSTR)
    2356 #endif
    2357                                   "ZooWPSClient\0",
    2358                                   INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);*/
    23592313      if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){
    23602314        freeService (&s1);
     
    23782332      close_sql(m,0);     
    23792333#endif     
    2380 
    2381       /*#ifdef RELY_ON_DB
    2382       //close_sql(m,1);
    2383       //end_sql();
    2384       #endif*/
    23852334    }
    23862335  else
     
    24332382          setMapInMaps (m, "lenv", "async","true");
    24342383          map* r_inputs1 = createMap("ServiceName", s1->name);
    2435 
    2436           /*hInternet = InternetOpen (
    2437 #ifndef WIN32
    2438                                     (LPCTSTR)
    2439 #endif
    2440                                     "ZooWPSClient\0",
    2441                                     INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
    2442 #ifndef WIN32
    2443           if (!CHECK_INET_HANDLE (hInternet))
    2444             fprintf (stderr, "WARNING : hInternet handle failed to initialize");
    2445             #endif*/
    24462384
    24472385          // Create the filename for the result file (.res)
     
    25582496          invokeCallback(m,request_input_real_format,NULL,1,0);
    25592497          fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
    2560           dumpMaps(request_output_real_format);
     2498          //dumpMaps(request_output_real_format);
    25612499          if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){
    25622500            freeService (&s1);
     
    26002538            return -1;
    26012539          }
    2602           dumpMaps(request_output_real_format);
    2603           fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
    2604           invokeCallback(m,request_input_real_format,NULL,1,1);
    2605           fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
    26062540          if(getMapFromMaps(m,"lenv","mapError")!=NULL){
    26072541                setMapInMaps(m,"lenv","message",_("Issue with geographic data"));
     
    26342568  fprintf (stderr, "RUN IN BACKGROUND MODE %s %d \n",__FILE__,__LINE__);
    26352569#endif
    2636 fflush(stdout);
    2637 rewind(stdout);
     2570  fflush(stdout);
     2571  rewind(stdout);
     2572
    26382573  if (eres != -1)
    26392574    outputResponse (s1, request_input_real_format,
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