Exemplo n.º 1
0
func EasyInit() (easy *Easy, err *CurlError) {
	easy = new(Easy)
	if easy.cptr = C.curl_easy_init(); easy.cptr == nil {
		return nil, NewError(E_FAILED_INIT)
	}
	easy.cerrbuf = (*C.char)(C.malloc(C.CURL_ERROR_SIZE))
	err = NewError(C.my_esetoptc(easy.cptr, C.CURLOPT_ERRORBUFFER, easy.cerrbuf))
	if err != nil {
		C.curl_easy_cleanup(easy.cptr)
		return nil, err
	}
	runtime.SetFinalizer(easy, func(e *Easy) { e.Cleanup() })
	return
}
Exemplo n.º 2
0
Arquivo: easy.go Projeto: ym/go-curl
// curl_easy_cleanup - End a libcurl easy session
func (curl *CURL) Cleanup() {
	p := curl.handle
	C.curl_easy_cleanup(p)
	curl.MallocFreeAfter(0)
}
Exemplo n.º 3
0
// curl_easy_cleanup - End a libcurl easy session
func (curl *CURL) Cleanup() {
	p := curl.handle
	C.curl_easy_cleanup(p)
	curl.MallocFreeAfter(0)
	context_map.Delete(uintptr(p))
}
Exemplo n.º 4
0
// curl_easy_cleanup - End a libcurl easy session
func (curl *CURL) Cleanup() {
	p := curl.handle
	C.curl_easy_cleanup(p)
}
Exemplo n.º 5
0
func (easy *Easy) Cleanup() {
	C.curl_easy_cleanup(easy.cptr)
	C.free(unsafe.Pointer(easy.cerrbuf))
}