Index: /trunk/zoo-project/zoo-kernel/nmake.opt
===================================================================
--- /trunk/zoo-project/zoo-kernel/nmake.opt	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/nmake.opt	(revision 375)
@@ -10,5 +10,5 @@
 
 !IFDEF MS_DIR
-MS_CFLAGS=-DUSE_MS -I$(MS_DIR) /DNEED_STRCASESTR 
+MS_CFLAGS=-DUSE_MS -I$(MS_DIR)
 MS_LDFLAGS=$(MS_DIR)/mapserver_i.lib
 MS_FILE=service_internal_ms.obj
@@ -36,5 +36,5 @@
 PYTHON_CPATH=$(ZOOK_DIR)\..\..\..\Python-2.7.3
 
-CFLAGS=$(CFLAGS1) /nologo /MD /W3 /EHsc /O2 /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
+CFLAGS=$(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF
 
 LDFLAGS=$(FCGI_LIBRARY) $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(TROOT)/../../thirds/cgic206/libcgic.lib $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) /machine:i386
Index: /trunk/zoo-project/zoo-kernel/service.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service.h	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/service.h	(revision 375)
@@ -29,7 +29,9 @@
 
 #ifdef WIN32
-#define strncasecmp strnicmp
-#define strcasecmp stricmp
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
+#ifndef snprintf
 #define snprintf sprintf_s
+#endif
 #endif 
 
@@ -63,4 +65,11 @@
 #define SHMSZ     27
 
+
+#ifdef DEBUG_STACK
+  void debugStack(const char* file,const int line){
+    int stack;
+    fprintf(stderr,"stack %p (%s: %d) \n",&stack,file,line);
+  }
+#endif
 
   /**
Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 375)
@@ -34,4 +34,15 @@
 #define FALSE -1
 #endif
+
+void printHeaders(maps* m){
+  maps *_tmp=getMaps(m,"headers");
+  if(_tmp!=NULL){
+    map* _tmp1=_tmp->content;
+    while(_tmp1!=NULL){
+      printf("%s: %s\r\n",_tmp1->name,_tmp1->value);
+      _tmp1=_tmp1->next;
+    }
+  }
+}
 
 void addLangAttr(xmlNodePtr n,maps *m){
@@ -1817,4 +1828,6 @@
   }
 
+  printHeaders(m);
+
   if(asRaw==0){
 #ifdef DEBUG
@@ -2478,6 +2491,7 @@
     int s=stat(cached, &f_status);
     if(s==0){
+      fprintf(stderr,"FILE SIZE (%d)\n",f_status.st_size/1024);
       fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
-      FILE* f=fopen(cached,"r");
+      FILE* f=fopen(cached,"rb");
       fread(fcontent,sizeof(char),f_status.st_size,f);
       fsize=f_status.st_size;
Index: /trunk/zoo-project/zoo-kernel/service_internal.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.h	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/service_internal.h	(revision 375)
@@ -59,5 +59,5 @@
 #include <openssl/buffer.h>
 
-#include "cgic.h"
+//#include "cgic.h"
 #include "ulinet.h"
 
@@ -85,4 +85,5 @@
   static int nbNs=0;
 
+  void printHeaders(maps*);
   void unhandleStatus(maps*);
   void updateStatus(maps*);
Index: /trunk/zoo-project/zoo-kernel/ulinet.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/ulinet.c	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/ulinet.c	(revision 375)
@@ -293,5 +293,5 @@
   else{
     memset(lpBuffer,0,hInternet.nDataLen+1);
-    memcpy( lpBuffer, hInternet.pabyData, hInternet.nDataLen );
+    memcpy(lpBuffer, hInternet.pabyData, hInternet.nDataLen );
     dwDataSize=hInternet.nDataLen;
     free( hInternet.pabyData );
Index: /trunk/zoo-project/zoo-kernel/zoo_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_loader.c	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/zoo_loader.c	(revision 375)
@@ -85,4 +85,5 @@
   if(strncmp(cgiContentType,"text/xml",8)==0 || 
      strncasecmp(cgiRequestMethod,"post",4)==0){
+    //fprintf(stderr,"length %d\n",cgiContentLength);
     if(cgiContentLength==NULL){
        cgiContentLength=0;
@@ -112,5 +113,5 @@
 	buffer[cgiContentLength]=0;
 	tmpMap=createMap("request",buffer);
-	fprintf(stderr,"%s\n",tmpMap->value);
+	//fprintf(stderr,"%s\n",tmpMap->value);
       }else{
 	buffer[0]=0;
Index: /trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 374)
+++ /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 375)
@@ -1838,9 +1838,11 @@
 
 #ifdef DEBUG
-  fprintf(stderr,"\n%i\n",i);
+  fprintf(stderr,"\n%d\n",__LINE__);
+  fflush(stderr);
   dumpMaps(request_input_real_format);
   dumpMaps(request_output_real_format);
   dumpMap(request_inputs);
-  fprintf(stderr,"\n%i\n",i);
+  fprintf(stderr,"\n%d\n",__LINE__);
+  fflush(stderr);
 #endif
 
@@ -1911,10 +1913,15 @@
 	  
 	  sprintf(storageNameOnServer,"%s/%s",path->value,fileNameOnServer);
+	  printf("\n\nName on server %s\n",storageNameOnServer);
+#ifdef DEBUG
 	  fprintf(stderr,"Name on server %s\n",storageNameOnServer);
 	  fprintf(stderr,"fileNameOnServer: %s\n",fileNameOnServer);
+#endif
 	  mode=S_IRWXU|S_IRGRP|S_IROTH;
 	  targetFile = open (storageNameOnServer,O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP|S_IROTH);
 	  if(targetFile<0){
+#ifdef DEBUG
 	    fprintf(stderr,"could not create the new file,%s\n",fileNameOnServer);	    
+#endif
 	  }else{
 	    while (cgiFormFileRead(file, buffer, BufferLen, &got) ==cgiFormSuccess){
@@ -1926,5 +1933,7 @@
 	  cgiFormFileClose(file);
 	  close(targetFile);
+#ifdef DEBUG
 	  fprintf(stderr,"File \"%s\" has been uploaded",fileNameOnServer);
+#endif
 	}
       }
