- Timestamp:
- Dec 12, 2017, 4:09:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c
r854 r860 2201 2201 int hasValidCookie = -1; 2202 2202 char *tcook = originalCookie = zStrdup (cgiCookie); 2203 //fprintf(stderr,">>>>> %s %d %s\n",__FILE__,__LINE__,tcook );2204 char *tmp = NULL;2205 2203 map *testing = getMapFromMaps (m, "main", "cookiePrefix"); 2206 2204 parseCookie(&m,originalCookie); 2207 if (testing == NULL) 2205 map *sessId=getMapFromMaps(m,"cookies",(testing==NULL?"ID":testing->value)); 2206 if (sessId!=NULL) 2208 2207 { 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); 2249 2209 char session_file_path[1024]; 2250 2210 map *tmpPath = getMapFromMaps (m, "main", "sessPath"); … … 2254 2214 if (tmp1 != NULL) 2255 2215 sprintf (session_file_path, "%s/sess_%s.cfg", tmpPath->value, 2256 s trstr (tmp1, "=") + 1);2216 sessId->value); 2257 2217 else 2258 2218 sprintf (session_file_path, "%s/sess_%s.cfg", tmpPath->value, 2259 s trstr (cgiCookie, "=") + 1);2219 sessId->value); 2260 2220 free (tcook); 2261 2221 maps *tmpSess = (maps *) malloc (MAPS_SIZE); … … 2351 2311 if (status == NULLMAP) 2352 2312 { 2353 /* hInternet = InternetOpen (2354 #ifndef WIN322355 (LPCTSTR)2356 #endif2357 "ZooWPSClient\0",2358 INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);*/2359 2313 if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){ 2360 2314 freeService (&s1); … … 2378 2332 close_sql(m,0); 2379 2333 #endif 2380 2381 /*#ifdef RELY_ON_DB2382 //close_sql(m,1);2383 //end_sql();2384 #endif*/2385 2334 } 2386 2335 else … … 2433 2382 setMapInMaps (m, "lenv", "async","true"); 2434 2383 map* r_inputs1 = createMap("ServiceName", s1->name); 2435 2436 /*hInternet = InternetOpen (2437 #ifndef WIN322438 (LPCTSTR)2439 #endif2440 "ZooWPSClient\0",2441 INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);2442 #ifndef WIN322443 if (!CHECK_INET_HANDLE (hInternet))2444 fprintf (stderr, "WARNING : hInternet handle failed to initialize");2445 #endif*/2446 2384 2447 2385 // Create the filename for the result file (.res) … … 2558 2496 invokeCallback(m,request_input_real_format,NULL,1,0); 2559 2497 fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__); 2560 dumpMaps(request_output_real_format);2498 //dumpMaps(request_output_real_format); 2561 2499 if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,&hInternet)<0){ 2562 2500 freeService (&s1); … … 2600 2538 return -1; 2601 2539 } 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__);2606 2540 if(getMapFromMaps(m,"lenv","mapError")!=NULL){ 2607 2541 setMapInMaps(m,"lenv","message",_("Issue with geographic data")); … … 2634 2568 fprintf (stderr, "RUN IN BACKGROUND MODE %s %d \n",__FILE__,__LINE__); 2635 2569 #endif 2636 fflush(stdout); 2637 rewind(stdout); 2570 fflush(stdout); 2571 rewind(stdout); 2572 2638 2573 if (eres != -1) 2639 2574 outputResponse (s1, request_input_real_format,
Note: See TracChangeset
for help on using the changeset viewer.