void oc_curl_debug(OCstate* state) { state->curlflags.verbose = 1; ocset_curlflag(state,CURLOPT_VERBOSE); ocset_curlflag(state,CURLOPT_ERRORBUFFER); }
OCerror ocset_netrc(OCstate* state, const char* path) { OCerror stat = OC_NOERR; if(state->curlflags.netrc != NULL) free(state->curlflags.netrc); state->curlflags.netrc = strdup(path); if(state->curlflags.netrc == NULL) return OCTHROW(OC_ENOMEM); stat = ocset_curlflag(state,CURLOPT_NETRC); return stat; }
OCerror ocset_useragent(OCstate* state, const char* agent) { OCerror stat = OC_NOERR; if(state->curlflags.useragent != NULL) free(state->curlflags.useragent); state->curlflags.useragent = strdup(agent); if(state->curlflags.useragent == NULL) return OCTHROW(OC_ENOMEM); stat = ocset_curlflag(state,CURLOPT_USERAGENT); return stat; }
OCerror ocset_flags_perlink(OCstate* state) { OCerror stat = OC_NOERR; if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_ENCODING); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_NETRC); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_VERBOSE); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_TIMEOUT); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USERAGENT); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_COOKIEJAR); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USERPWD); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_PROXY); if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_USE_SSL); if(stat != OC_NOERR) return stat; /* Following are always set */ ocset_curlflag(state, CURLOPT_FOLLOWLOCATION); ocset_curlflag(state, CURLOPT_MAXREDIRS); ocset_curlflag(state, CURLOPT_ERRORBUFFER); /* Set the CURL. options */ stat = oc_set_curl_options(state); return stat; }