Changeset 375 for trunk


Ignore:
Timestamp:
Oct 28, 2012, 2:09:47 PM (12 years ago)
Author:
djay
Message:

Print specific headers when a [headers] section was added to the main.cfg file (can add headers such as X-Powered-By for instance). Handle reading file in cache as binary (solving file size not corresponding for text files).

Location:
trunk/zoo-project/zoo-kernel
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/nmake.opt

    r370 r375  
    1010
    1111!IFDEF MS_DIR
    12 MS_CFLAGS=-DUSE_MS -I$(MS_DIR) /DNEED_STRCASESTR
     12MS_CFLAGS=-DUSE_MS -I$(MS_DIR)
    1313MS_LDFLAGS=$(MS_DIR)/mapserver_i.lib
    1414MS_FILE=service_internal_ms.obj
     
    3636PYTHON_CPATH=$(ZOOK_DIR)\..\..\..\Python-2.7.3
    3737
    38 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
     38CFLAGS=$(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
    3939
    4040LDFLAGS=$(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
  • trunk/zoo-project/zoo-kernel/service.h

    r364 r375  
    2929
    3030#ifdef WIN32
    31 #define strncasecmp strnicmp
    32 #define strcasecmp stricmp
     31#define strncasecmp _strnicmp
     32#define strcasecmp _stricmp
     33#ifndef snprintf
    3334#define snprintf sprintf_s
     35#endif
    3436#endif
    3537
     
    6365#define SHMSZ     27
    6466
     67
     68#ifdef DEBUG_STACK
     69  void debugStack(const char* file,const int line){
     70    int stack;
     71    fprintf(stderr,"stack %p (%s: %d) \n",&stack,file,line);
     72  }
     73#endif
    6574
    6675  /**
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r365 r375  
    3434#define FALSE -1
    3535#endif
     36
     37void printHeaders(maps* m){
     38  maps *_tmp=getMaps(m,"headers");
     39  if(_tmp!=NULL){
     40    map* _tmp1=_tmp->content;
     41    while(_tmp1!=NULL){
     42      printf("%s: %s\r\n",_tmp1->name,_tmp1->value);
     43      _tmp1=_tmp1->next;
     44    }
     45  }
     46}
    3647
    3748void addLangAttr(xmlNodePtr n,maps *m){
     
    18171828  }
    18181829
     1830  printHeaders(m);
     1831
    18191832  if(asRaw==0){
    18201833#ifdef DEBUG
     
    24782491    int s=stat(cached, &f_status);
    24792492    if(s==0){
     2493      fprintf(stderr,"FILE SIZE (%d)\n",f_status.st_size/1024);
    24802494      fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1));
    2481       FILE* f=fopen(cached,"r");
     2495      FILE* f=fopen(cached,"rb");
    24822496      fread(fcontent,sizeof(char),f_status.st_size,f);
    24832497      fsize=f_status.st_size;
  • trunk/zoo-project/zoo-kernel/service_internal.h

    r364 r375  
    5959#include <openssl/buffer.h>
    6060
    61 #include "cgic.h"
     61//#include "cgic.h"
    6262#include "ulinet.h"
    6363
     
    8585  static int nbNs=0;
    8686
     87  void printHeaders(maps*);
    8788  void unhandleStatus(maps*);
    8889  void updateStatus(maps*);
  • trunk/zoo-project/zoo-kernel/ulinet.c

    r368 r375  
    293293  else{
    294294    memset(lpBuffer,0,hInternet.nDataLen+1);
    295     memcpy( lpBuffer, hInternet.pabyData, hInternet.nDataLen );
     295    memcpy(lpBuffer, hInternet.pabyData, hInternet.nDataLen );
    296296    dwDataSize=hInternet.nDataLen;
    297297    free( hInternet.pabyData );
  • trunk/zoo-project/zoo-kernel/zoo_loader.c

    r364 r375  
    8585  if(strncmp(cgiContentType,"text/xml",8)==0 ||
    8686     strncasecmp(cgiRequestMethod,"post",4)==0){
     87    //fprintf(stderr,"length %d\n",cgiContentLength);
    8788    if(cgiContentLength==NULL){
    8889       cgiContentLength=0;
     
    112113        buffer[cgiContentLength]=0;
    113114        tmpMap=createMap("request",buffer);
    114         fprintf(stderr,"%s\n",tmpMap->value);
     115        //fprintf(stderr,"%s\n",tmpMap->value);
    115116      }else{
    116117        buffer[0]=0;
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r370 r375  
    18381838
    18391839#ifdef DEBUG
    1840   fprintf(stderr,"\n%i\n",i);
     1840  fprintf(stderr,"\n%d\n",__LINE__);
     1841  fflush(stderr);
    18411842  dumpMaps(request_input_real_format);
    18421843  dumpMaps(request_output_real_format);
    18431844  dumpMap(request_inputs);
    1844   fprintf(stderr,"\n%i\n",i);
     1845  fprintf(stderr,"\n%d\n",__LINE__);
     1846  fflush(stderr);
    18451847#endif
    18461848
     
    19111913         
    19121914          sprintf(storageNameOnServer,"%s/%s",path->value,fileNameOnServer);
     1915          printf("\n\nName on server %s\n",storageNameOnServer);
     1916#ifdef DEBUG
    19131917          fprintf(stderr,"Name on server %s\n",storageNameOnServer);
    19141918          fprintf(stderr,"fileNameOnServer: %s\n",fileNameOnServer);
     1919#endif
    19151920          mode=S_IRWXU|S_IRGRP|S_IROTH;
    19161921          targetFile = open (storageNameOnServer,O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP|S_IROTH);
    19171922          if(targetFile<0){
     1923#ifdef DEBUG
    19181924            fprintf(stderr,"could not create the new file,%s\n",fileNameOnServer);         
     1925#endif
    19191926          }else{
    19201927            while (cgiFormFileRead(file, buffer, BufferLen, &got) ==cgiFormSuccess){
     
    19261933          cgiFormFileClose(file);
    19271934          close(targetFile);
     1935#ifdef DEBUG
    19281936          fprintf(stderr,"File \"%s\" has been uploaded",fileNameOnServer);
     1937#endif
    19291938        }
    19301939      }
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