Changeset 43713 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Oct 23, 2012 3:11:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/http.cpp
r43679 r43713 48 48 CURL *pCurl; 49 49 long lLastResp; 50 struct curl_slist *pHeaders; 50 51 } RTHTTPINTERNAL; 51 52 typedef RTHTTPINTERNAL *PRTHTTPINTERNAL; … … 116 117 117 118 curl_easy_cleanup(pHttpInt->pCurl); 119 120 if (pHttpInt->pHeaders) 121 curl_slist_free_all(pHttpInt->pHeaders); 118 122 119 123 RTMemFree(pHttpInt); … … 169 173 } 170 174 175 RTR3DECL(int) RTHttpSetHeaders(RTHTTP hHttp, uint32_t cHeaders, const char *pcszHeaders[]) 176 { 177 PRTHTTPINTERNAL pHttpInt = hHttp; 178 RTHTTP_VALID_RETURN(pHttpInt); 179 180 if (!cHeaders) 181 { 182 if (pHttpInt->pHeaders) 183 curl_slist_free_all(pHttpInt->pHeaders); 184 pHttpInt->pHeaders = 0; 185 return VINF_SUCCESS; 186 } 187 188 struct curl_slist* pHeaders = NULL; 189 for (unsigned i = 0; i < cHeaders; i++) 190 pHeaders = curl_slist_append(pHeaders, pcszHeaders[i]); 191 192 pHttpInt->pHeaders = pHeaders; 193 int rcCurl = curl_easy_setopt(pHttpInt->pCurl, CURLOPT_HTTPHEADER, pHeaders); 194 if (CURL_FAILED(rcCurl)) 195 return VERR_INVALID_PARAMETER; 196 197 return VINF_SUCCESS; 198 } 199 171 200 RTR3DECL(int) RTHttpGet(RTHTTP hHttp, const char *pcszUrl, char **ppszResponse) 172 201 { … … 177 206 if (CURL_FAILED(rcCurl)) 178 207 return VERR_INVALID_PARAMETER; 208 209 #if 0 210 rcCurl = curl_easy_setopt(pHttpInt->pCurl, CURLOPT_VERBOSE, 1); 211 if (CURL_FAILED(rcCurl)) 212 return VERR_INVALID_PARAMETER; 213 #endif 179 214 180 215 /* XXX */
Note:
See TracChangeset
for help on using the changeset viewer.