Changeset 896 for branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
- Timestamp:
- Feb 25, 2019, 1:57:11 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
r891 r896 118 118 ; 119 119 #endif 120 tmp=strtok( buffer,";");120 tmp=strtok((char*) buffer,";"); // knut: added cast to char* 121 121 int cnt=0; 122 122 _HINTERNET *psInternet=(_HINTERNET *)data; … … 322 322 * @return 1 if the host is listed as protected, 0 in other case 323 323 */ 324 int isProtectedHost(const char* protectedHosts,const char* url){ 325 char *token, *saveptr; 326 token = strtok_r (url, "//", &saveptr); 327 int cnt=0; 328 char* host; 329 while(token!=NULL && cnt<=1){ 330 if(cnt==1 && strstr(protectedHosts,token)!=NULL){ 331 return 1; 332 } 333 token = strtok_r (NULL, "/", &saveptr); 334 cnt+=1; 335 } 336 return 0; 324 int isProtectedHost(const char* protectedHosts, const char* url) { 325 char *token, *saveptr; 326 int cnt; 327 char* host; 328 329 // knut: make a copy of url since strtok family modifies first argument and cannot be used on constant strings 330 char* urlcpy = (char*)malloc(sizeof(char)*(strlen(url) + 1)); 331 urlcpy = strncpy(urlcpy, url, strlen(url) + 1); // since count > strlen(url), a null character is properly appended 332 333 //token = strtok_r (url, "//", &saveptr); 334 token = strtok_r(urlcpy, "//", &saveptr); // knut 335 cnt = 0; 336 while (token != NULL && cnt <= 1) { 337 fprintf(stderr, "%s %d %s \n", __FILE__, __LINE__, token); 338 if (cnt == 1) 339 fprintf(stderr, "%s %d %s \n", __FILE__, __LINE__, strstr(protectedHosts, token)); 340 fflush(stderr); 341 if (cnt == 1 && strstr(protectedHosts, token) != NULL) { 342 fprintf(stderr, "%s %d %s \n", __FILE__, __LINE__, strstr(protectedHosts, token)); 343 free(urlcpy); 344 return 1; 345 } 346 token = strtok_r(NULL, "/", &saveptr); 347 cnt += 1; 348 } 349 free(urlcpy); 350 return 0; 337 351 } 338 352 … … 457 471 int ldwFlags=INTERNET_FLAG_NEED_FILE; 458 472 struct MemoryStruct header; 459 map* memUse=getMapFromMaps( conf,"main","memory");473 map* memUse=getMapFromMaps((maps*) conf,"main","memory"); // knut: addad cast to maps* 460 474 461 475 hInternet->ihandle[hInternet->nb].handle=curl_easy_init( ); … … 505 519 map* tmpPath=NULL; 506 520 if(conf!=NULL){ 507 tmpPath=getMapFromMaps( conf,"main","tmpPath");521 tmpPath=getMapFromMaps((maps*) conf,"main","tmpPath"); // knut added cast to maps* 508 522 } 509 523 if(tmpPath==NULL)
Note: See TracChangeset
for help on using the changeset viewer.