Changeset 446 for trunk/zoo-project/zoo-kernel/ulinet.c
- Timestamp:
- Oct 30, 2013, 1:24:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 };
Note: See TracChangeset
for help on using the changeset viewer.