- Timestamp:
- Oct 30, 2013, 1:24:11 PM (11 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/Makefile.in
r408 r446 14 14 MS_FILE=@MS_FILE@ 15 15 16 CFLAGS= ${MACOS_CFLAGS} ${MS_CFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF16 CFLAGS=-fpic ${MACOS_CFLAGS} ${MS_CFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 17 17 LDFLAGS=-lcurl -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lfcgi -lcrypto ${MS_LDFLAGS} ${MACOS_LD_FLAGS} 18 18 -
trunk/zoo-project/zoo-kernel/main_conf_read.y
r385 r446 6 6 //====================================================== 7 7 8 #include <string>9 #include <stdio.h>10 #include <ctype.h>11 8 #include <service.h> 12 #include <vector>13 9 14 10 static int defaultsc=0; -
trunk/zoo-project/zoo-kernel/service.h
r444 r446 268 268 map* icurs=curs->content; 269 269 if(type==0){ 270 map* tmp=getMap(curs->content,"value");271 270 char *temp=strdup(dataInputsKVP); 272 271 if(getMap(m->content,"xlink:href")!=NULL) … … 276 275 free(temp); 277 276 } 278 int j=0;279 277 while(icurs!=NULL){ 280 278 if(strcasecmp(icurs->name,"value")!=0 && … … 686 684 } 687 685 688 map* tmpValI=getMap(tmp->content,"value");689 686 char *tmpV[8]={ 690 687 "size", … … 701 698 int i=0; 702 699 map* tmpSizeI=getMap(tmp->content,tmpV[i]); 703 for( 0;i<8;i++){700 for(i=0;i<8;i++){ 704 701 map* tmpVI=getMap(tmp->content,tmpV[i]); 705 702 if(tmpVI!=NULL){ -
trunk/zoo-project/zoo-kernel/service_internal.c
r442 r446 2516 2516 * Cache a file for a given request 2517 2517 */ 2518 void addToCache(maps* conf,char* request,char* content, int length){2518 void addToCache(maps* conf,char* request,char* content,char* mimeType,int length){ 2519 2519 map* tmp=getMapFromMaps(conf,"main","cacheDir"); 2520 2520 if(tmp!=NULL){ … … 2529 2529 fwrite(content,sizeof(char),length,fo); 2530 2530 fclose(fo); 2531 2532 sprintf(fname,"%s/%s.zcm",tmp->value,md5str); 2533 fo=fopen(fname,"w+"); 2534 #ifdef DEBUG 2535 fprintf(stderr,"MIMETYPE: %s\n",mimeType); 2536 #endif 2537 fwrite(mimeType,sizeof(char),strlen(mimeType),fo); 2538 fclose(fo); 2539 2531 2540 free(md5str); 2532 2541 free(fname); … … 2563 2572 char* fcontent; 2564 2573 char* cached=isInCache(m,url); 2574 char *mimeType=NULL; 2565 2575 int fsize; 2566 2576 int hasF=-1; … … 2574 2584 fsize=f_status.st_size; 2575 2585 fcontent[fsize]=0; 2586 fclose(f); 2587 } 2588 cached[strlen(cached)-1]='m'; 2589 s=stat(cached, &f_status); 2590 if(s==0){ 2591 mimeType=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 2592 FILE* f=fopen(cached,"rb"); 2593 int len=fread(mimeType,f_status.st_size,1,f); 2594 mimeType[f_status.st_size]=0; 2595 fclose(f); 2576 2596 } 2577 2597 }else{ … … 2585 2605 fcontent[res.nDataLen]=0; 2586 2606 fsize=res.nDataLen; 2607 mimeType=res.mimeType; 2587 2608 } 2588 2609 if(fsize==0){ 2589 2610 return errorException(m, _("Unable to download the file."), "InternalError"); 2611 } 2612 2613 if(mimeType!=NULL){ 2614 addToMap(content,"fmimeType",mimeType); 2590 2615 } 2591 2616 … … 2603 2628 addToMap(content,"size",ltmp1); 2604 2629 if(cached==NULL) 2605 addToCache(m,url,fcontent, fsize);2630 addToCache(m,url,fcontent,mimeType,fsize); 2606 2631 else{ 2632 free(fcontent); 2633 free(mimeType); 2607 2634 free(cached); 2608 2635 } -
trunk/zoo-project/zoo-kernel/service_internal.h
r392 r446 131 131 int checkForSoapEnvelope(xmlDocPtr); 132 132 133 void addToCache(maps*,char*,char*, int);133 void addToCache(maps*,char*,char*,char*,int); 134 134 char* isInCache(maps*,char*); 135 135 int loadRemoteFile(maps*,map*,HINTERNET,char*); -
trunk/zoo-project/zoo-kernel/ulinet.c
r375 r446 39 39 psInternet=(HINTERNET *)data; 40 40 if(psInternet->pabyData){ 41 psInternet->pabyData=( char*)realloc(psInternet->pabyData,psInternet->nDataLen+realsize+1);41 psInternet->pabyData=(unsigned char*)realloc(psInternet->pabyData,psInternet->nDataLen+realsize+1); 42 42 psInternet->nDataAlloc+=psInternet->nDataLen+realsize+1; 43 43 } 44 44 else{ 45 psInternet->pabyData=( char*)malloc(psInternet->nDataLen+realsize+1);45 psInternet->pabyData=(unsigned char*)malloc(psInternet->nDataLen+realsize+1); 46 46 psInternet->nDataAlloc=realsize+1; 47 47 } … … 106 106 CFArrayRef proxies; 107 107 108 CFStringRef key_enabled ;109 CFStringRef key_host ;110 CFStringRef key_port ;108 CFStringRef key_enabled = NULL; 109 CFStringRef key_host = NULL; 110 CFStringRef key_port = NULL; 111 111 112 112 bool proxy_enabled; … … 120 120 proxyDict = SCDynamicStoreCopyProxies(NULL); 121 121 122 if( proto=="http"){122 if(strncmp(proto,"http",4)==0){ 123 123 key_enabled=kSCPropNetProxiesHTTPEnable; 124 124 key_host=kSCPropNetProxiesHTTPProxy; … … 126 126 } 127 127 else 128 if( proto=="https"){128 if(strncmp(proto,"https",5)==0){ 129 129 key_enabled=kSCPropNetProxiesHTTPSEnable; 130 130 key_host=kSCPropNetProxiesHTTPSProxy; … … 168 168 ret.hasCacheFile=0; 169 169 ret.nDataAlloc = 0; 170 ret.mimeType = NULL; 170 171 171 172 ret.handle=curl_easy_init(); … … 191 192 192 193 return ret; 193 }194 195 static size_t196 CurlWriteCB(void *buffer, size_t size, size_t nmemb, void *reqInfo){197 HINTERNET *psInternet = (HINTERNET *) reqInfo;198 199 memcpy( psInternet->pabyData + psInternet->nDataLen, buffer, nmemb * size );200 psInternet->nDataLen += nmemb * size;201 psInternet->pabyData[psInternet->nDataLen] = 0;202 203 return nmemb *size;204 194 } 205 195 … … 208 198 fclose(handle.file); 209 199 unlink(handle.filename); 200 handle.mimeType = NULL; 210 201 } 211 202 else{ 212 203 handle.pabyData = NULL; 204 handle.mimeType = NULL; 213 205 handle.nDataAlloc = handle.nDataLen = 0; 214 206 } … … 271 263 curl_easy_setopt(hInternet.handle,CURLOPT_URL,lpszUrl); 272 264 curl_easy_perform(hInternet.handle); 273 265 curl_easy_getinfo(hInternet.handle,CURLINFO_CONTENT_TYPE,&hInternet.mimeType); 266 #ifdef ULINET_DEBUG 267 fprintf(stderr,"DEBUG MIMETYPE: %s\n",hInternet.mimeType); 268 #endif 274 269 return hInternet; 275 270 }; -
trunk/zoo-project/zoo-kernel/ulinet.h
r368 r446 26 26 #define _ULINET_H 27 27 28 #include "fcgi_stdio.h" 28 29 #include <stdlib.h> 29 30 #include <fcntl.h> … … 72 73 int nDataAlloc; 73 74 unsigned char *pabyData; 75 unsigned char *mimeType; 74 76 } HINTERNET; 75 77
Note: See TracChangeset
for help on using the changeset viewer.