Ignore:
Timestamp:
Jan 9, 2013, 11:52:44 PM (11 years ago)
Author:
djay
Message:

Fix asynchronous support on windows platform, fix storage of responseDocument and add a sample service in Python language using the ZOO-API. Update makefile.vc and nmake.opt to remove unneeded cgic linkage. Fix for headers section to display only if needed.

File:
1 edited

Legend:

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

    r383 r384  
    7878
    7979void updateStatus(maps *conf){
    80         fprintf(stderr,"OK Final 1 \n");
    81         fflush(stderr);
    82         LPWSTR lpszTmp;
    83         BOOL fInit;
    84         char *s=NULL;
    85         map *tmpMap=getMapFromMaps(conf,"lenv","sid");
    86         fprintf(stderr,"OK Final 11 \n");
    87         fflush(stderr);
    88         if(hMapObjectG==NULL)
    89         hMapObjectG = CreateFileMapping(
    90                 INVALID_HANDLE_VALUE,   // use paging file
    91                 NULL,                   // default security attributes
    92                 PAGE_READWRITE,         // read/write access
    93                 0,                      // size: high 32-bits
    94                 SHMEMSIZE,              // size: low 32-bits
    95                 TEXT(tmpMap->value));   // name of map object
    96         if (hMapObjectG == NULL){
    97                 fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value);
    98                 return ;
    99         }
    100         fprintf(stderr,"OK Final 2 \n");
    101         fflush(stderr);
    102         fInit = (GetLastError() != ERROR_ALREADY_EXISTS);
    103         if(lpvMemG==NULL)
    104         lpvMemG = MapViewOfFile(
    105                 hMapObjectG,     // object to map view of
    106                 FILE_MAP_WRITE, // read/write access
    107                 0,              // high offset:  map from
    108                 0,              // low offset:   beginning
    109                 0);             // default: map entire file
    110         if (lpvMemG == NULL){
    111                 fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value);
    112                 return ;
    113         }
    114         fprintf(stderr,"OK Final 3 \n");
    115         fflush(stderr);
    116         if (fInit)
    117                 memset(lpvMemG, '\0', SHMEMSIZE);
    118         fprintf(stderr,"OK Final 4 \n");
    119         fflush(stderr);
    120         tmpMap=getMapFromMaps(conf,"lenv","status");
    121         lpszTmp = (LPWSTR) lpvMemG;
    122         for(s=tmpMap->value;*s!=NULL;s++)
    123                 *lpszTmp++ = *s;
    124         *lpszTmp = '\0';
     80  LPWSTR lpszTmp;
     81  BOOL fInit;
     82  char *s=NULL;
     83  map *tmpMap=getMapFromMaps(conf,"lenv","sid");
     84  if(hMapObjectG==NULL)
     85    hMapObjectG = CreateFileMapping(
     86                                    INVALID_HANDLE_VALUE,   // use paging file
     87                                    NULL,                   // default security attributes
     88                                    PAGE_READWRITE,         // read/write access
     89                                    0,                      // size: high 32-bits
     90                                    SHMEMSIZE,              // size: low 32-bits
     91                                    TEXT(tmpMap->value));   // name of map object
     92  if (hMapObjectG == NULL){
     93    fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value);
     94    return ;
     95  }
     96  fInit = (GetLastError() != ERROR_ALREADY_EXISTS);
     97  if(lpvMemG==NULL)
     98    lpvMemG = MapViewOfFile(
     99                            hMapObjectG,     // object to map view of
     100                            FILE_MAP_WRITE, // read/write access
     101                            0,              // high offset:  map from
     102                            0,              // low offset:   beginning
     103                            0);             // default: map entire file
     104  if (lpvMemG == NULL){
     105    fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value);
     106    return ;
     107  }
     108  if (fInit)
     109    memset(lpvMemG, '\0', SHMEMSIZE);
     110  tmpMap=getMapFromMaps(conf,"lenv","status");
     111  lpszTmp = (LPWSTR) lpvMemG;
     112  for(s=tmpMap->value;*s!=NULL;s++)
     113    *lpszTmp++ = *s;
     114  *lpszTmp = '\0';
    125115}
    126116
     
    159149    return "-1";
    160150  lpszTmp = (LPWSTR) lpvMem;
    161   while (*lpszTmp!=NULL)
    162     *lpszBuf++ = *lpszTmp++;
    163   *lpszBuf = '\0';
    164   fIgnore = UnmapViewOfFile(lpvMem);
    165   fIgnore = CloseHandle(hMapObject);
    166   return (char*)lpszBuf;
     151  return (char*)lpszTmp;
    167152}
    168153
     
    13911376  char *encoding=getEncoding(m);
    13921377  if(pid==getpid()){
     1378    printHeaders(m);
    13931379    printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
    13941380  }
     
    17451731  xmlNodePtr n;
    17461732
    1747   printHeaders(m);
    17481733  doc = xmlNewDoc(BAD_CAST "1.0");
    17491734  maps* tmpMap=getMaps(m,"main");
     
    17521737    map *tmpSid=getMapFromMaps(m,"lenv","sid");
    17531738    if(tmpSid!=NULL){
    1754       if( getpid()==atoi(tmpSid->value) )
     1739      if( getpid()==atoi(tmpSid->value) ){
     1740        printHeaders(m);
    17551741        printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
    1756     }
    1757     else
     1742      }
     1743    }
     1744    else{
     1745      printHeaders(m);
    17581746      printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
     1747    }
    17591748  }else
    17601749    printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
     
    18621851  }
    18631852 
    1864   printHeaders(m);
    1865 
    18661853  if(asRaw==0){
    18671854#ifdef DEBUG
     
    20071994        if(rs!=NULL)
    20081995          printf("Content-Length: %s\r\n",rs->value);
    2009 
     1996        printHeaders(m);
    20101997        char mime[1024];
    20111998        map* mi=getMap(tmpI->content,"mimeType");
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