Changeset 682
- Timestamp:
- Jun 26, 2015, 2:07:46 PM (10 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/HISTORY.txt
r676 r682 1 1 Version 1.5.0-dev 2 * Fix asynchronous POST request on WIN32 platforms 2 3 * Add utils/registry service 3 4 * Initial support for WPS 2.0.0 including the Dismiss extension -
trunk/zoo-project/zoo-kernel/response_print.c
r680 r682 1745 1745 } 1746 1746 1747 if(vid==0 && hasStoredExecuteResponse==true && status!=SERVICE_STARTED && status!=SERVICE_ACCEPTED){ 1747 if(vid==0 && 1748 hasStoredExecuteResponse==true 1749 && status!=SERVICE_STARTED 1750 #ifndef WIN32 1751 && status!=SERVICE_ACCEPTED 1752 #endif 1753 ){ 1748 1754 #ifndef RELY_ON_DB 1749 1755 semid lid=acquireLock(m);//,1); … … 2334 2340 map* version=getMapFromMaps(m,"main","rversion"); 2335 2341 int vid=getVersionId(version->value); 2336 2342 2337 2343 maps* tmpSess=getMaps(m,"senv"); 2338 2344 if(tmpSess!=NULL){ … … 2375 2381 else{ 2376 2382 fclose(teste); 2377 dumpMapsToFile(tmpSess,session_file_path );2383 dumpMapsToFile(tmpSess,session_file_path,1); 2378 2384 } 2379 2385 } … … 2441 2447 elements* in=getElements(s->outputs,tmpI->name); 2442 2448 char *format=NULL; 2443 if(in!=NULL ){2444 format= strdup(in->format);2449 if(in!=NULL && in->format!=NULL){ 2450 format=zStrdup(in->format); 2445 2451 }else 2446 format= strdup("LiteralData");2452 format=zStrdup("LiteralData"); 2447 2453 if(strcasecmp(format,"BoundingBoxData")==0){ 2448 2454 addToMap(tmpI->content,"extension","xml"); … … 2466 2472 getFileExtension(mtype != NULL ? mtype->value : NULL, file_ext, 32); 2467 2473 } 2468 2474 2469 2475 file_name=(char*)malloc((strlen(s->name)+strlen(usid->value)+strlen(file_ext)+strlen(tmpI->name)+45)*sizeof(char)); 2470 2476 sprintf(file_name,"%s_%s_%s_%d.%s",s->name,tmpI->name,usid->value,itn,file_ext); … … 2472 2478 file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char)); 2473 2479 sprintf(file_path,"%s/%s",tmp1->value,file_name); 2474 2480 2475 2481 FILE *ofile=fopen(file_path,"wb"); 2476 2482 if(ofile==NULL){ … … 2498 2504 2499 2505 } 2506 2500 2507 map *tmp2=getMapFromMaps(m,"main","tmpUrl"); 2501 2508 map *tmp3=getMapFromMaps(m,"main","serverAddress"); … … 2509 2516 sprintf(file_url,"%s/%s/%s",tmp3->value,tmp2->value,file_name); 2510 2517 } 2518 2511 2519 addToMap(tmpI->content,"Reference",file_url); 2512 2520 free(format); 2513 2521 free(file_name); 2514 free(file_url); 2522 free(file_url); 2515 2523 2516 2524 } -
trunk/zoo-project/zoo-kernel/server_internal.c
r680 r682 72 72 #endif 73 73 sprintf(res,"%s",rest); 74 #ifdef WIN32 75 RpcStringFree(&rest); 76 #endif 74 77 return res; 75 78 } … … 895 898 if(result!=NULL){ 896 899 char *encoding=getEncoding(conf); 897 fprintf(stdout,"Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);898 fprintf(stdout,"%s",result);900 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 901 printf("%s",result); 899 902 fflush(stdout); 900 903 freeMap(&statusInfo); -
trunk/zoo-project/zoo-kernel/service.c
r680 r682 87 87 * @param file_path the full path to the file name to store the map 88 88 */ 89 void dumpMapsToFile(maps* m,char* file_path ){89 void dumpMapsToFile(maps* m,char* file_path,int limit){ 90 90 FILE* file=fopen(file_path,"w+"); 91 91 maps* tmp=m; 92 int cnt=0; 92 93 while(tmp!=NULL){ 93 94 fprintf(file,"[%s]\n",tmp->name); … … 95 96 fflush(file); 96 97 tmp=tmp->next; 98 cnt++; 99 if(limit>=0 && cnt==limit) 100 tmp=NULL; 97 101 } 98 102 fflush(file); -
trunk/zoo-project/zoo-kernel/service.h
r680 r682 271 271 ZOO_DLL_EXPORT void dumpMap(map*); 272 272 ZOO_DLL_EXPORT void dumpMaps(maps* m); 273 ZOO_DLL_EXPORT void dumpMapToFile(map*,FILE*); // Not required274 ZOO_DLL_EXPORT void dumpMapsToFile(maps*,char* );273 ZOO_DLL_EXPORT void dumpMapToFile(map*,FILE*); // (used only internally) 274 ZOO_DLL_EXPORT void dumpMapsToFile(maps*,char*,int); 275 275 ZOO_DLL_EXPORT map* createMap(const char*,const char*); 276 276 ZOO_DLL_EXPORT int count(map*); -
trunk/zoo-project/zoo-kernel/service_internal_python.c
r624 r682 523 523 maps* mapsFromPyDict(PyDictObject* t){ 524 524 maps* res=NULL; 525 maps* cursor= res;525 maps* cursor=NULL; 526 526 PyObject* list=PyDict_Keys((PyObject*)t); 527 527 int nb=PyList_Size(list); 528 528 int i; 529 PyObject* key; 530 PyObject* value; 529 531 for(i=0;i<nb;i++){ 530 532 #ifdef DEBUG 531 533 fprintf(stderr,">> parsing maps %d\n",i); 532 534 #endif 533 PyObject*key=PyList_GetItem(list,i);534 PyObject*value=PyDict_GetItem((PyObject*)t,key);535 key=PyList_GetItem(list,i); 536 value=PyDict_GetItem((PyObject*)t,key); 535 537 #ifdef DEBUG 536 538 fprintf(stderr,">> DEBUG VALUES : %s => %s\n", … … 538 540 #endif 539 541 cursor=(maps*)malloc(MAPS_SIZE); 540 cursor->name= PyString_AsString(key);542 cursor->name=zStrdup(PyString_AsString(key)); 541 543 cursor->content=mapFromPyDict((PyDictObject*)value); 542 544 #ifdef DEBUG … … 572 574 int nb=PyList_Size(list); 573 575 int i; 576 PyObject* key; 577 PyObject* value; 574 578 for(i=0;i<nb;i++){ 575 PyObject*key=PyList_GetItem(list,i);576 PyObject*value=PyDict_GetItem((PyObject*)t,key);579 key=PyList_GetItem(list,i); 580 value=PyDict_GetItem((PyObject*)t,key); 577 581 #ifdef DEBUG 578 582 fprintf(stderr,">> DEBUG VALUES : %s => %s\n", … … 584 588 Py_ssize_t size; 585 589 #if PY_MAJOR_VERSION >= 3 586 buffer=_PyUnicode_AsStringAndSize(value,&size); 590 if(PyBytes_Check(value)){ 591 size=PyBytes_Size(value); 592 buffer=PyBytes_AsString(value); 593 } 594 else 595 if(PyUnicode_Check(value) && PyUnicode_READY(value) == 0){ 596 buffer=PyUnicode_AsUTF8AndSize(value,&size); 597 } 598 else{ 599 fprintf(stderr,"Unsupported return value."); 600 return NULL; 601 } 587 602 #else 588 603 PyString_AsStringAndSize(value,&buffer,&size); -
trunk/zoo-project/zoo-kernel/zoo_loader.c
r680 r682 29 29 * Specific includes 30 30 */ 31 #ifndef WIN3232 31 #include "fcgio.h" 33 32 #include "fcgi_config.h" 34 33 #include "fcgi_stdio.h" 35 #endif36 34 #include <sys/types.h> 37 35 #include <unistd.h> 38 36 #include "service_internal.h" 39 37 #include "response_print.h" 40 41 42 #ifdef WIN3243 #include "windows.h"44 #define strtok_r strtok_s45 #endif46 38 47 39 extern "C" { … … 54 46 } 55 47 48 #ifdef WIN32 49 #include "windows.h" 50 #define strtok_r strtok_s 51 #endif 52 56 53 #include "service_internal.h" 57 54 #include "request_parser.h" 58 59 #ifdef WIN3260 #include "server_internal.h"61 #endif62 55 63 56 int runRequest(map**); … … 178 171 fprintf(stderr,"(( \n %s \n %s \n ))",*arrayStep,value); 179 172 #endif 180 #ifdef WIN32181 char* tmp = url_decode(value);182 if(tmpMap!=NULL)183 addToMap(tmpMap,*arrayStep,tmp);184 else185 tmpMap=createMap(*arrayStep,tmp);186 free(tmp);187 #else188 173 if(tmpMap!=NULL) 189 174 addToMap(tmpMap,*arrayStep,value); 190 175 else 191 176 tmpMap=createMap(*arrayStep,value); 192 #endif193 177 arrayStep++; 194 178 delete[]value; … … 206 190 char *buffer=(char*)malloc((flen+1)*sizeof(char)); 207 191 fread(buffer,flen,1,lf); 192 char *pchr=strrchr(buffer,'>'); 193 cgiContentLength=strlen(buffer)-strlen(pchr)+1; 194 buffer[cgiContentLength]=0; 208 195 fclose(lf); 209 196 addToMap(tmpMap,"request",buffer); 210 197 free(buffer); 211 cgiContentLength=flen+9;212 198 } 213 199 #endif … … 387 373 } 388 374 //addToMap(tmpMap,name,value); 389 /* knut: strtok(_r) ignores delimiter bytes at start and end of string; 390 * it will return non-empty string or NULL, e.g. "metapath=" yields value=NULL. 391 * This modification sets value="" instead of NULL. 392 */ 393 addToMap(tmpMap,name, value != NULL ? value : ""); 394 375 /* knut: strtok(_r) ignores delimiter bytes at start and end of string; 376 * it will return non-empty string or NULL, e.g. "metapath=" yields value=NULL. 377 * This modification sets value="" instead of NULL. 378 */ 379 addToMap(tmpMap,name, value != NULL ? value : ""); 395 380 free(name); 396 381 free(value); … … 412 397 free(strQuery); 413 398 414 415 399 runRequest(&tmpMap); 416 400 -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r680 r682 734 734 strncpy(kvp, key, strlen(key)); 735 735 addToCache(m, tmpReq->value, tmpReq->value, "text/xml", strlen(tmpReq->value), 736 filepath, FILENAME_MAX); 736 filepath, FILENAME_MAX); 737 737 if (filepath == NULL) { 738 738 errorException( m, _("Unable to cache HTTP POST Execute request."), "InternalError", NULL); … … 787 787 SetEnvironmentVariable ("CGISID", TEXT (sid->value)); 788 788 SetEnvironmentVariable ("QUERY_STRING", TEXT (tmpq)); 789 // knut: Prevent REQUEST_METHOD=POST in background process call to cgic:main (process hangs when reading cgiIn): 789 // knut: Prevent REQUEST_METHOD=POST in background process call to cgic:main 790 // (process hangs when reading cgiIn): 790 791 SetEnvironmentVariable("REQUEST_METHOD", "GET"); 792 SetEnvironmentVariable("CONTENT_TYPE", "text/plain"); 791 793 792 794 char clen[1000]; … … 794 796 SetEnvironmentVariable ("CONTENT_LENGTH", TEXT (clen)); 795 797 798 // ref. https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863%28v=vs.85%29.aspx 796 799 if (!CreateProcess (NULL, // No module name (use command line) 797 800 TEXT (tmp), // Command line … … 1798 1801 * Initialize the specific [lenv] section which contains runtime variables: 1799 1802 * 1800 * - usid : it is an unique identification number 1803 * - usid : it is an universally unique identifier 1804 * - osid : it is an idenfitication number 1801 1805 * - sid : it is the process idenfitication number (OS) 1802 * - uusid : it is an universally unique identifi cation number1806 * - uusid : it is an universally unique identifier 1803 1807 * - status : value between 0 and 100 to express the completude of 1804 1808 * the operations of the running service … … 1931 1935 map *test1 = getMap (request_inputs, "cgiSid"); 1932 1936 if (test1 != NULL){ 1933 cgiSid = test1->value;1934 1935 1936 setMapInMaps (m, "lenv", "sid", test1->value);1937 1938 1937 cgiSid = zStrdup(test1->value); 1938 addToMap (request_inputs, "storeExecuteResponse", "true"); 1939 addToMap (request_inputs, "status", "true"); 1940 setMapInMaps (m, "lenv", "osid", test1->value); 1941 status = getMap (request_inputs, "status"); 1942 } 1939 1943 test1 = getMap (request_inputs, "usid"); 1940 1944 if (test1 != NULL){ … … 2129 2133 &request_input_real_format, 2130 2134 &request_output_real_format, &eres); 2131 2132 2135 } 2133 2136 else … … 2182 2185 lockShm (lid); 2183 2186 #endif 2184 fclose(f0);2185 2187 FILE *f3 = fopen (fbkp, "wb+"); 2186 2188 free (fbkp); … … 2206 2208 } 2207 2209 #ifndef RELY_ON_DB 2208 dumpMapsToFile(bmap,fbkpres );2210 dumpMapsToFile(bmap,fbkpres,1); 2209 2211 removeShmLock (m, 1); 2210 2212 #else … … 2221 2223 free (fbkp1); 2222 2224 free (tmps1); 2225 if(cgiSid!=NULL) 2226 free(cgiSid); 2223 2227 } 2224 2228
Note: See TracChangeset
for help on using the changeset viewer.