Changeset 966 for trunk/zoo-project/zoo-kernel
- Timestamp:
- Nov 25, 2020, 4:14:56 PM (4 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/request_parser.c
r962 r966 204 204 int kvpParseInputs(maps** main_conf,service* s,map *request_inputs,maps** request_output,HINTERNET* hInternet){ 205 205 // Parsing inputs provided as KVP 206 map* memory=getMapFromMaps(*main_conf,"main","memory"); 206 207 maps *tmpmaps = *request_output; 207 208 map* r_inputs = getMap (request_inputs, "DataInputs"); … … 342 343 } 343 344 tmpc = strtok (NULL, "@"); 345 } 346 if(memory!=NULL && strncasecmp(memory->value,"load",4)!=0) 347 if(getMap(tmpmaps->content,"to_load")==NULL){ 348 addToMap(tmpmaps->content,"to_load","false"); 344 349 } 345 350 if (*request_output == NULL) -
trunk/zoo-project/zoo-kernel/response_print.c
r962 r966 95 95 } 96 96 } 97 printSessionHeaders(m); 98 } 99 100 /** 101 * Print the Set-Cookie header if necessary (conf["lenv"]["cookie"]) and save 102 * the session file. 103 * 104 * The session file (sess_<SESSID>_.cfg where <SESSID> is the cookie value) is 105 * stored in the conf["main"]["tmpPath"] directory. 106 * @param m the main configuration map 107 */ 108 void printSessionHeaders(maps* m){ 109 maps* tmpSess=getMaps(m,"senv"); 110 if(tmpSess!=NULL){ 111 map *_tmp=getMapFromMaps(m,"lenv","cookie"); 112 maps *tmps=getMaps(m,"senv"); 113 char* sessId=NULL; 114 if(_tmp!=NULL){ 115 printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value); 116 map *_tmp1=getMapFromMaps(m,"senv","ecookie_length"); 117 if(_tmp1!=NULL){ 118 int len=atoi(_tmp1->value); 119 int cnt=0; 120 for(cnt=0;cnt<len;cnt++){ 121 map* _tmp2=getMapArray(tmps->content,"ecookie",cnt); 122 if(_tmp2!=NULL) 123 printf("Set-Cookie: %s; HttpOnly\r\n",_tmp2->value); 124 } 125 } 126 printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n"); 127 char session_file_path[100]; 128 char *tmp1=strtok(_tmp->value,";"); 129 if(tmp1!=NULL) 130 sprintf(session_file_path,"%s",strstr(tmp1,"=")+1); 131 else 132 sprintf(session_file_path,"%s",strstr(_tmp->value,"=")+1); 133 sessId=zStrdup(session_file_path); 134 }else{ 135 maps* t=getMaps(m,"senv"); 136 map*p=t->content; 137 while(p!=NULL){ 138 if(strstr(p->name,"ID")!=NULL){ 139 sessId=zStrdup(p->value); 140 break; 141 } 142 p=p->next; 143 } 144 } 145 char session_file_path[1024]; 146 map *tmpPath=getMapFromMaps(m,"main","sessPath"); 147 if(tmpPath==NULL) 148 tmpPath=getMapFromMaps(m,"main","tmpPath"); 149 sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,sessId); 150 FILE* teste=fopen(session_file_path,"w"); 151 if(teste==NULL){ 152 char tmpMsg[1024]; 153 sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path); 154 errorException(m,tmpMsg,"InternalError",NULL); 155 return; 156 } 157 else{ 158 fclose(teste); 159 dumpMapsToFile(tmpSess,session_file_path,1); 160 } 161 } 97 162 } 98 163 … … 2665 2730 map* version=getMapFromMaps(m,"main","rversion"); 2666 2731 int vid=getVersionId(version->value); 2667 maps* tmpSess=getMaps(m,"senv"); 2668 if(tmpSess!=NULL){ 2669 map *_tmp=getMapFromMaps(m,"lenv","cookie"); 2670 maps *tmps=getMaps(m,"senv"); 2671 char* sessId=NULL; 2672 if(_tmp!=NULL){ 2673 printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value); 2674 map *_tmp1=getMapFromMaps(m,"senv","ecookie_length"); 2675 if(_tmp1!=NULL){ 2676 int len=atoi(_tmp1->value); 2677 int cnt=0; 2678 for(cnt=0;cnt<len;cnt++){ 2679 map* _tmp2=getMapArray(tmps->content,"ecookie",cnt); 2680 if(_tmp2!=NULL) 2681 printf("Set-Cookie: %s; HttpOnly\r\n",_tmp2->value); 2682 } 2683 } 2684 printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n"); 2685 char session_file_path[100]; 2686 char *tmp1=strtok(_tmp->value,";"); 2687 if(tmp1!=NULL) 2688 sprintf(session_file_path,"%s",strstr(tmp1,"=")+1); 2689 else 2690 sprintf(session_file_path,"%s",strstr(_tmp->value,"=")+1); 2691 sessId=zStrdup(session_file_path); 2692 }else{ 2693 maps* t=getMaps(m,"senv"); 2694 map*p=t->content; 2695 while(p!=NULL){ 2696 if(strstr(p->name,"ID")!=NULL){ 2697 sessId=zStrdup(p->value); 2698 break; 2699 } 2700 p=p->next; 2701 } 2702 } 2703 char session_file_path[1024]; 2704 map *tmpPath=getMapFromMaps(m,"main","sessPath"); 2705 if(tmpPath==NULL) 2706 tmpPath=getMapFromMaps(m,"main","tmpPath"); 2707 sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,sessId); 2708 FILE* teste=fopen(session_file_path,"w"); 2709 if(teste==NULL){ 2710 char tmpMsg[1024]; 2711 sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path); 2712 errorException(m,tmpMsg,"InternalError",NULL); 2713 return; 2714 } 2715 else{ 2716 fclose(teste); 2717 dumpMapsToFile(tmpSess,session_file_path,1); 2718 } 2719 } 2732 printSessionHeaders(m); 2720 2733 if(res==SERVICE_FAILED){ 2721 2734 char* tmp0=produceErrorMessage(m); -
trunk/zoo-project/zoo-kernel/response_print.h
r949 r966 197 197 198 198 void printHeaders(maps*); 199 void printSessionHeaders(maps*); 199 200 200 201 int zooXmlSearchForNs(const char*); -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r962 r966 1950 1950 "/","/api","/conformance","/processes" 1951 1951 }; 1952 map* tmpUrl=getMapFromMaps(m," main","serverAddress");1952 map* tmpUrl=getMapFromMaps(m,"openapi","rootUrl"); 1953 1953 for(int kk=0;kk<4;kk++){ 1954 1954 maps* tmpMaps=getMaps(m,urls[kk]);
Note: See TracChangeset
for help on using the changeset viewer.