golang curl(libcurl) binding.

go-curl

Build Status

my golang libcurl(curl) binding.

See more examples in ./examples/ directory~!

LICENSE

go-curl is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

Current Development Status

  • currently stable
  • READ, WRITE, HEADER, PROGRESS function callback
  • a Multipart Form supports file uploading
  • Most curl_easy_setopt option
  • partly implement share & multi interface
  • new callback function prototype

How to Install

Make Sure You Have libcurl (and its develop headers, static/dynamic libs) installed!

$ go get -u github.com/andelf/go-curl

Current Status

  • Linux x64
    • passed go1 (ArchLinux)
  • Windows x86
    • passed go1 (win7, mingw-gcc 4.5.2, curl 7.22.0)
  • Mac OS
    • passed go1 (Mac OS X 10.7.3, curl 7.21.4)

Sample Program

package main

import (
    "fmt"
    curl "github.com/andelf/go-curl"
)

func main() {
    easy := curl.EasyInit()
    defer easy.Cleanup()

    easy.Setopt(curl.OPT_URL, "http://www.baidu.com/")

    // make a callback function
    fooTest := func (buf []byte, userdata interface{}) bool {
        println("DEBUG: size=>", len(buf))
        println("DEBUG: content=>", string(buf))
        return true
    }

    easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest)

    if err := easy.Perform(); err != nil {
        fmt.Printf("ERROR: %v\n", err)
    }
}
Comments
  • SSL allow beast option?

    SSL allow beast option?

    Is it possible to use this[1] with your library? Without it I'm having problems connecting to some IIS7 servers[2].

    [1] https://bugzilla.redhat.com/show_bug.cgi?id=784219#c11 [2] http://curl.haxx.se/mail/archive-2012-04/0062.html

  • help

    help

    go get -u github.com/andelf/go-curl

    github.com/andelf/go-curl

    C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\core.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_getdate': E:\go\src\github.com\andelf\go-curl/core.go:41: undefined reference to_imp__cu rl_getdate' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\core.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_global_cleanup': E:\go\src\github.com\andelf\go-curl/core.go:50: undefined reference to_imp__cu rl_global_cleanup' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\core.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_global_init': E:\go\src\github.com\andelf\go-curl/core.go:60: undefined reference to_imp__cu rl_global_init' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\core.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_version': E:\go\src\github.com\andelf\go-curl/core.go:69: undefined reference to_imp__cu rl_version' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\core.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_version_info': E:\go\src\github.com\andelf\go-curl/core.go:79: undefined reference to_imp__cu rl_version_info' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_cleanup': E:\go\src\github.com\andelf\go-curl/easy.go:90: undefined reference to_imp__cu rl_easy_cleanup' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_duphandle': E:\go\src\github.com\andelf\go-curl/easy.go:100: undefined reference to_imp__c url_easy_duphandle' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_escape': E:\go\src\github.com\andelf\go-curl/easy.go:112: undefined reference to_imp__c url_easy_escape' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_getinfo_double': E:\go\src\github.com\andelf\go-curl/easy.go:32: undefined reference to_imp__cu rl_easy_getinfo' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_getinfo_long': E:\go\src\github.com\andelf\go-curl/easy.go:29: undefined reference to_imp__cu rl_easy_getinfo' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_getinfo_slist': E:\go\src\github.com\andelf\go-curl/easy.go:35: undefined reference to_imp__cu rl_easy_getinfo' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_getinfo_string': E:\go\src\github.com\andelf\go-curl/easy.go:26: undefined reference to_imp__cu rl_easy_getinfo' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_init': E:\go\src\github.com\andelf\go-curl/easy.go:169: undefined reference to_imp__c url_easy_init' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_pause': E:\go\src\github.com\andelf\go-curl/easy.go:180: undefined reference to_imp__c url_easy_pause' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_perform': E:\go\src\github.com\andelf\go-curl/easy.go:190: undefined reference to_imp__c url_easy_perform' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_recv': E:\go\src\github.com\andelf\go-curl/easy.go:203: undefined reference to_imp__c url_easy_recv' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_reset': E:\go\src\github.com\andelf\go-curl/easy.go:212: undefined reference to_imp__c url_easy_reset' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_send': E:\go\src\github.com\andelf\go-curl/easy.go:225: undefined reference to_imp__c url_easy_send' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_setopt_long': E:\go\src\github.com\andelf\go-curl/easy.go:10: undefined reference to_imp__cu rl_easy_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_setopt_off_t': E:\go\src\github.com\andelf\go-curl/easy.go:22: undefined reference to_imp__cu rl_easy_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_setopt_pointer': E:\go\src\github.com\andelf\go-curl/easy.go:19: undefined reference to_imp__cu rl_easy_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_setopt_slist': E:\go\src\github.com\andelf\go-curl/easy.go:16: undefined reference to_imp__cu rl_easy_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_easy_setopt_string': E:\go\src\github.com\andelf\go-curl/easy.go:13: undefined reference to_imp__cu rl_easy_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_strerror': E:\go\src\github.com\andelf\go-curl/easy.go:295: undefined reference to_imp__c url_easy_strerror' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_easy_unescape': E:\go\src\github.com\andelf\go-curl/easy.go:308: undefined reference to_imp__c url_easy_unescape' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_formadd_name_content_length': E:\go\src\github.com\andelf\go-curl/easy.go:40: undefined reference to_imp__cu rl_formadd' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_formadd_name_content_length_type': E:\go\src\github.com\andelf\go-curl/easy.go:47: undefined reference to_imp__cu rl_formadd' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function curl_formadd_name_file_type': E:\go\src\github.com\andelf\go-curl/easy.go:55: undefined reference to_imp__cu rl_formadd' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_free': E:\go\src\github.com\andelf\go-curl/easy.go:360: undefined reference to_imp__c url_free' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\easy.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_slist_append': E:\go\src\github.com\andelf\go-curl/easy.go:371: undefined reference to_imp__c url_slist_append' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_add_handle': E:\go\src\github.com\andelf\go-curl/multi.go:43: undefined reference to_imp__c url_multi_add_handle' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_cleanup': E:\go\src\github.com\andelf\go-curl/multi.go:53: undefined reference to_imp__c url_multi_cleanup' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_init': E:\go\src\github.com\andelf\go-curl/multi.go:62: undefined reference to_imp__c url_multi_init' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_perform': E:\go\src\github.com\andelf\go-curl/multi.go:73: undefined reference to_imp__c url_multi_perform' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_remove_handle': E:\go\src\github.com\andelf\go-curl/multi.go:84: undefined reference to_imp__c url_multi_remove_handle' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function curl_multi_setopt_long': E:\go\src\github.com\andelf\go-curl/multi.go:8: undefined reference toimp__cu rl_multi_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function curl_multi_setopt_pointer': E:\go\src\github.com\andelf\go-curl/multi.go:11: undefined reference toimp__c url_multi_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_strerror': E:\go\src\github.com\andelf\go-curl/multi.go:118: undefined reference toimp curl_multi_strerror' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\multi.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_multi_timeout': E:\go\src\github.com\andelf\go-curl/multi.go:129: undefined reference toimp curl_multi_timeout' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\share.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_share_cleanup': E:\go\src\github.com\andelf\go-curl/share.go:41: undefined reference to_imp__c url_share_cleanup' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\share.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_share_init': E:\go\src\github.com\andelf\go-curl/share.go:50: undefined reference to_imp__c url_share_init' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\share.cgo2.o: In function curl_share_setopt_long': E:\go\src\github.com\andelf\go-curl/share.go:7: undefined reference to_imp__cu rl_share_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\share.cgo2.o: In function curl_share_setopt_pointer': E:\go\src\github.com\andelf\go-curl/share.go:10: undefined reference to_imp__c url_share_setopt' C:\Users\think\AppData\Local\Temp\go-build789965335\github.com\andelf\go-curl_o bj\share.cgo2.o: In function cgo_99b504ba8303_Cfunc_curl_share_strerror': E:\go\src\github.com\andelf\go-curl/share.go:84: undefined reference to_imp__c url_share_strerror' collect2: ld returned 1 exit status

    what is wrong?

  • No such file or directory: stdio.h

    No such file or directory: stdio.h

    测试环境:ubuntu12.10 使用readme里的例子 在本地环境下 go run test.go 无异常 但是通过如下操作: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build ~/www/go/src/test/test.go

    提示:

    github.com/andelf/go-curl

    ../github.com/andelf/go-curl/c-callback.c:2 8c: No such file or directory: stdio.h

  • [WIP] Fix concurrent map read and map write

    [WIP] Fix concurrent map read and map write

    Fixes issue with concurrent map read and map write related to context_map.

    Maps are not safe for concurrent use: it's not defined what happens when you read and write to them simultaneously. - http://blog.golang.org/go-maps-in-action

    Wrapped context map inside a struct with sync.RWMutex Added a test case to verify that it is working, test with go test -race.

  • Error on using go get to install your packages in go1

    Error on using go get to install your packages in go1

    Hello andelf,

    I just wanted to try your package on my machine (Ubuntu 11.10, 64bit / go 1), but on issuing the "go get" command from your readme, I get the following error-messages from go :

    go get -u github.com/andelf/go-curl/curl

    github.com/andelf/go-curl/curl

    1: error: 'CURL_VERSION_NTLM_WB' undeclared (first use in this function) 1: note: each undeclared identifier is reported only once for each function it appears in 1: error: 'CURLOPT_CLOSESOCKETDATA' undeclared (first use in this function) 1: error: 'CURLOPT_CLOSESOCKETFUNCTION' undeclared (first use in this function)

    Kind regards Thomas

  • I don't know how to install curl in Windows(不知道怎么装curl 在windows)

    I don't know how to install curl in Windows(不知道怎么装curl 在windows)

    HI, I'm new for golang/c. When I run example, it will throw an exception "..\callback.go:6:23: fatal error: curl/curl.h: No such file or directory". I know I need to install curl but I don't know how to do that. Could you give me more detail to fix this.

    我不知道怎么装curl, 能给写详细点么怎么装curl

  • No Windows 7 x64 Support

    No Windows 7 x64 Support

    Running in Windows 7 x64

    go get -v github.com/andelf/go-curl
    

    gives the error

    cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
    

    and therefore cant be used.

    Gcc-Version: gcc.exe (GCC) 4.9.3

  • go test failed !!!

    go test failed !!!

    go test failed , maebe because callback function!! below is info :go test 不过。

    go版本 go version go1.1.1 linux/amd64

    ~/workspace/golang/src/github.com/andelf/go-curl/ [master] go test

    unexpected fault address 0xfffff8250c8b4864 fatal error: fault [signal 0xb code=0x1 addr=0xfffff8250c8b4864 pc=0xfffff8250c8b4864]

    goroutine 8 [running]: [fp=0x7ff0fdd7ed10] runtime.throw(0x9c79f7) /usr/local/go/src/pkg/runtime/panic.c:473 +0x67 [fp=0x7ff0fdd7ed28] runtime.sigpanic() /usr/local/go/src/pkg/runtime/os_linux.c:239 +0xe7 created by testing.RunTests /usr/local/go/src/pkg/testing/testing.go:433 +0x86b

    goroutine 1 [chan receive]: testing.RunTests(0x6c9ec8, 0x9c6300, 0x7, 0x7, 0x66cb01, ...) /usr/local/go/src/pkg/testing/testing.go:434 +0x88e testing.Main(0x6c9ec8, 0x9c6300, 0x7, 0x7, 0x9dc6e0, ...) /usr/local/go/src/pkg/testing/testing.go:365 +0x8a main.main() github.com/andelf/go-curl/_test/_testmain.go:55 +0x9a

    goroutine 2 [syscall]:

    goroutine 9 [IO wait]: net.runtime_pollWait(0x7ff0fdf17f00, 0x72, 0x0) /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82 net.(_pollDesc).WaitRead(0xc2000bc3e0, 0xb, 0xc2000b2db0) /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31 net.(_netFD).accept(0xc2000bc360, 0x6c9fd8, 0x0, 0xc2000b2db0, 0xb, ...) /usr/local/go/src/pkg/net/fd_unix.go:385 +0x2c1 net.(_TCPListener).AcceptTCP(0xc200000410, 0x41b278, 0x9ddc30, 0xc2000e9000) /usr/local/go/src/pkg/net/tcpsock_posix.go:229 +0x45 net.(_TCPListener).Accept(0xc200000410, 0x7ff0fdd7dfb0, 0x41b123, 0x6ca008, 0x7ff0fde9bf00, ...) /usr/local/go/src/pkg/net/tcpsock_posix.go:239 +0x25 net/http/httptest.(_historyListener).Accept(0xc2000e32d0, 0x0, 0x0, 0x0, 0x0, ...) /usr/local/go/src/pkg/net/http/httptest/server.go:48 +0x54 net/http.(_Server).Serve(0xc2000a35f0, 0xc20009fc40, 0xc2000e32d0, 0x0, 0x0, ...) /usr/local/go/src/pkg/net/http/server.go:1542 +0x85 created by net/http/httptest.(*Server).Start /usr/local/go/src/pkg/net/http/httptest/server.go:109 +0x21a

    goroutine 7 [runnable]: net.runtime_pollWait(0x7ff0fdf17e60, 0x72, 0x0) /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82 net.(_pollDesc).WaitRead(0xc2000bc230, 0xb, 0xc2000b2db0) /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31 net.(_netFD).Read(0xc2000bc1b0, 0xc2000e2000, 0x1000, 0x1000, 0x0, ...) /usr/local/go/src/pkg/net/fd_unix.go:195 +0x2b3 net.(_conn).Read(0xc200000390, 0xc2000e2000, 0x1000, 0x1000, 0xa, ...) /usr/local/go/src/pkg/net/net.go:123 +0xc3 net/http.(_liveSwitchReader).Read(0xc2000bc268, 0xc2000e2000, 0x1000, 0x1000, 0x1, ...) /usr/local/go/src/pkg/net/http/server.go:205 +0x91 io.(_LimitedReader).Read(0xc2000bb660, 0xc2000e2000, 0x1000, 0x1000, 0x666240, ...) /usr/local/go/src/pkg/io/io.go:394 +0xc0 net/http.(_switchReader).Read(0xc200084820, 0xc2000e2000, 0x1000, 0x1000, 0x0, ...) /usr/local/go/src/pkg/net/http/chunked.go:0 +0x62 bufio.(_Reader).fill(0xc2000c6360) /usr/local/go/src/pkg/bufio/bufio.go:79 +0x10c bufio.(_Reader).ReadSlice(0xc2000c6360, 0x40e20a, 0x0, 0x0, 0x0, ...) /usr/local/go/src/pkg/bufio/bufio.go:262 +0x202 bufio.(_Reader).ReadLine(0xc2000c6360, 0x0, 0x0, 0x0, 0x7ff0fdd6ec00, ...) /usr/local/go/src/pkg/bufio/bufio.go:293 +0x61 net/textproto.(_Reader).readLineSlice(0xc2000e3030, 0xe004a42bb, 0x422a4f, 0xc2000a6680, 0x654500, ...) /usr/local/go/src/pkg/net/textproto/reader.go:55 +0x51 net/textproto.(_Reader).ReadLine(0xc2000e3030, 0xc2000a6680, 0x7ff0fdd6ed6f, 0x10, 0xc200084520, ...) /usr/local/go/src/pkg/net/textproto/reader.go:36 +0x25 net/http.ReadRequest(0xc2000c6360, 0xc2000a6680, 0x0, 0x0) /usr/local/go/src/pkg/net/http/request.go:510 +0x86 net/http.(_conn).readRequest(0xc2000bc240, 0x0, 0x0, 0x0) /usr/local/go/src/pkg/net/http/server.go:547 +0x1bc net/http.(_conn).serve(0xc2000bc240) /usr/local/go/src/pkg/net/http/server.go:1052 +0x398 created by net/http.(_Server).Serve /usr/local/go/src/pkg/net/http/server.go:1564 +0x266

    goroutine 10 [runnable]: syscall.Syscall() /usr/local/go/src/pkg/syscall/asm_linux_amd64.s:36 +0x64 syscall.write(0x9, 0xc2000e8000, 0x85, 0x1000, 0x0, ...) /usr/local/go/src/pkg/syscall/zerrors_linux_amd64.go:2717 +0x70 syscall.Write(0x9, 0xc2000e8000, 0x85, 0x1000, 0xc2000e3120, ...) /usr/local/go/src/pkg/syscall/syscall_unix.go:143 +0x5a net.(_netFD).Write(0xc2000bc3f0, 0xc2000e8000, 0x85, 0x1000, 0x0, ...) /usr/local/go/src/pkg/net/fd_unix.go:286 +0x24e net.(_conn).Write(0xc200000448, 0xc2000e8000, 0x85, 0x1000, 0x7ff0fdd7de10, ...) /usr/local/go/src/pkg/net/net.go:131 +0xc3 net/http.(_switchWriter).Write(0xc2000849a0, 0xc2000e8000, 0x85, 0x1000, 0x10, ...) /usr/local/go/src/pkg/net/http/chunked.go:0 +0x62 bufio.(_Writer).Flush(0xc20009fec0, 0xc2000848a0, 0x0) /usr/local/go/src/pkg/bufio/bufio.go:465 +0xb9 net/http.(_response).finishRequest(0xc2000bea10) /usr/local/go/src/pkg/net/http/server.go:931 +0x9c net/http.(_conn).serve(0xc2000bc480) /usr/local/go/src/pkg/net/http/server.go:1100 +0x796 created by net/http.(*Server).Serve /usr/local/go/src/pkg/net/http/server.go:1564 +0x266 exit status 2 FAIL github.com/andelf/go-curl 0.039s

  • Fail to compile under linux 2.6.32, curl 7.12.

    Fail to compile under linux 2.6.32, curl 7.12.

    curl 7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
    Protocols: ftp gopher telnet dict ldap http file https ftps 
    Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
    
    1: error: 'CURLOPT_INTERLEAVEFUNCTION' undeclared (first use in this function)
    1: note: each undeclared identifier is reported only once for each function it appears in
    1: error: 'CURL_READFUNC_PAUSE' undeclared (first use in this function)
    1: error: 'CURLPAUSE_CONT' undeclared (first use in this function)
    1: error: 'CURLOPT_CONV_FROM_NETWORK_FUNCTION' undeclared (first use in this function)
    1: error: 'CURLINFO_PRIMARY_PORT' undeclared (first use in this function)
    1: error: 'CURLOPT_KRBLEVEL' undeclared (first use in this function)
    1: error: 'CURLOPT_COPYPOSTFIELDS' undeclared (first use in this function)
    1: error: 'CURLOPT_POSTREDIR' undeclared (first use in this function)
    1: error: 'CURLOPT_RESOLVE' undeclared (first use in this function)
    1: error: 'CURLOPT_FTP_ACCOUNT' undeclared (first use in this function)
    1: error: 'CURLOPT_SEEKFUNCTION' undeclared (first use in this function)
    1: error: 'CURLINFO_PRIMARY_IP' undeclared (first use in this function)
    1: error: 'CURLOPT_MAIL_FROM' undeclared (first use in this function)
    1: error: 'CURLE_SSL_ENGINE_INITFAILED' undeclared (first use in this function)
    1: error: 'CURLOPT_PROTOCOLS' undeclared (first use in this function)
    1: error: 'CURLMOPT_SOCKETDATA' undeclared (first use in this function)
    1: error: 'CURLOPT_CRLFILE' undeclared (first use in this function)
    1: error: 'CURLOPT_TIMEOUT_MS' undeclared (first use in this function)
    1: error: 'CURLE_QUOTE_ERROR' undeclared (first use in this function)
    1: error: 'CURLINFO_CONDITION_UNMET' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_KEYDATA' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSP_SERVER_CSEQ' undeclared (first use in this function)
    1: error: 'CURLE_TFTP_UNKNOWNID' undeclared (first use in this function)
    1: error: 'CURLMOPT_SOCKETFUNCTION' undeclared (first use in this function)
    1: error: 'CURLOPT_DIRLISTONLY' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_AUTH_TYPES' undeclared (first use in this function)
    1: error: 'CURLOPT_CONV_TO_NETWORK_FUNCTION' undeclared (first use in this function)
    1: error: 'CURLFTP_CREATE_DIR' undeclared (first use in this function)
    1: error: 'CURLOPT_CERTINFO' undeclared (first use in this function)
    1: error: 'CURLOPT_MAX_SEND_SPEED_LARGE' undeclared (first use in this function)
    1: error: 'CURLVERSION_FOURTH' undeclared (first use in this function)
    1: error: 'CURLOPT_IOCTLDATA' undeclared (first use in this function)
    1: error: 'CURLINFO_CERTINFO' undeclared (first use in this function)
    1: error: 'CURLE_RTSP_SESSION_ERROR' undeclared (first use in this function)
    1: error: 'CURLPAUSE_RECV' undeclared (first use in this function)
    1: error: 'CURLOPT_PASSWORD' undeclared (first use in this function)
    1: error: 'CURLOPT_APPEND' undeclared (first use in this function)
    1: error: 'CURLE_CONV_FAILED' undeclared (first use in this function)
    1: error: 'CURLPROXY_HTTP_1_0' undeclared (first use in this function)
    1: error: 'CURLPROXY_SOCKS4A' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_PRIVATE_KEYFILE' undeclared (first use in this function)
    1: error: 'CURLE_TFTP_NOTFOUND' undeclared (first use in this function)
    1: error: 'CURLE_USE_SSL_FAILED' undeclared (first use in this function)
    1: error: 'CURLE_SSL_CACERT_BADFILE' undeclared (first use in this function)
    1: error: 'CURLINFO_FTP_ENTRY_PATH' undeclared (first use in this function)
    1: error: 'CURLE_CONV_REQD' undeclared (first use in this function)
    1: error: 'CURLOPT_FTPSSLAUTH' undeclared (first use in this function)
    1: error: 'CURLOPT_TRANSFER_ENCODING' undeclared (first use in this function)
    1: error: 'CURLM_BAD_SOCKET' undeclared (first use in this function)
    1: error: 'CURLOPT_CHUNK_END_FUNCTION' undeclared (first use in this function)
    1: error: 'CURLE_REMOTE_FILE_NOT_FOUND' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSP_REQUEST' undeclared (first use in this function)
    1: error: 'CURLFTP_CREATE_DIR_RETRY' undeclared (first use in this function)
    1: error: 'CURLOPT_IOCTLFUNCTION' undeclared (first use in this function)
    1: error: 'CURLE_RANGE_ERROR' undeclared (first use in this function)
    1: error: 'CURLPROXY_SOCKS5_HOSTNAME' undeclared (first use in this function)
    1: error: 'CURLOPT_FTP_FILEMETHOD' undeclared (first use in this function)
    1: error: 'CURL_VERSION_SSPI' undeclared (first use in this function)
    1: error: 'CURLMOPT_TIMERDATA' undeclared (first use in this function)
    1: error: 'CURLINFO_RTSP_CLIENT_CSEQ' undeclared (first use in this function)
    1: error: 'CURLOPT_SOCKS5_GSSAPI_NEC' undeclared (first use in this function)
    1: error: 'CURLOPT_HTTP_TRANSFER_DECODING' undeclared (first use in this function)
    1: error: 'CURLE_REMOTE_FILE_EXISTS' undeclared (first use in this function)
    1: error: 'CURLOPT_FTP_SSL_CCC' undeclared (first use in this function)
    1: error: 'CURLOPT_NEW_DIRECTORY_PERMS' undeclared (first use in this function)
    1: error: 'CURLE_UPLOAD_FAILED' undeclared (first use in this function)
    1: error: 'CURLINFO_APPCONNECT_TIME' undeclared (first use in this function)
    1: error: 'CURLOPT_HTTP_CONTENT_DECODING' undeclared (first use in this function)
    1: error: 'CURLOPT_TLSAUTH_TYPE' undeclared (first use in this function)
    1: error: 'CURLFTP_CREATE_DIR_NONE' undeclared (first use in this function)
    1: error: 'CURLOPT_FTP_SKIP_PASV_IP' undeclared (first use in this function)
    1: error: 'CURLE_RTSP_CSEQ_ERROR' undeclared (first use in this function)
    1: error: 'CURLOPT_FNMATCH_FUNCTION' undeclared (first use in this function)
    1: error: 'CURLOPT_PROXY_TRANSFER_MODE' undeclared (first use in this function)
    1: error: 'CURLINFO_REDIRECT_URL' undeclared (first use in this function)
    1: error: 'CURLE_FTP_BAD_FILE_LIST' undeclared (first use in this function)
    1: error: 'CURLOPT_MAIL_RCPT' undeclared (first use in this function)
    1: error: 'CURLOPT_PROXYPASSWORD' undeclared (first use in this function)
    1: error: 'CURLOPT_SEEKDATA' undeclared (first use in this function)
    1: error: 'CURLINFO_RTSP_SESSION_ID' undeclared (first use in this function)
    1: error: 'CURLOPT_FTP_USE_PRET' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_KEYFUNCTION' undeclared (first use in this function)
    1: error: 'CURLINFO_SSL_ENGINES' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSP_CLIENT_CSEQ' undeclared (first use in this function)
    1: error: 'CURLPAUSE_ALL' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_PUBLIC_KEYFILE' undeclared (first use in this function)
    1: error: 'CURLINFO_RTSP_SERVER_CSEQ' undeclared (first use in this function)
    1: error: 'CURLINFO_LASTSOCKET' undeclared (first use in this function)
    1: error: 'CURLOPT_CONV_FROM_UTF8_FUNCTION' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSP_SESSION_ID' undeclared (first use in this function)
    1: error: 'CURLOPT_USERNAME' undeclared (first use in this function)
    1: error: 'CURLOPT_CONNECT_ONLY' undeclared (first use in this function)
    1: error: 'CURLOPT_ISSUERCERT' undeclared (first use in this function)
    1: error: 'CURLINFO_NUM_CONNECTS' undeclared (first use in this function)
    1: error: 'CURLOPT_REDIR_PROTOCOLS' undeclared (first use in this function)
    1: error: 'CURLOPT_PROXYUSERNAME' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSPHEADER' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSP_STREAM_URI' undeclared (first use in this function)
    1: error: 'CURLE_SSL_SHUTDOWN_FAILED' undeclared (first use in this function)
    1: error: 'CURLOPT_LOCALPORT' undeclared (first use in this function)
    1: error: 'CURLOPT_OPENSOCKETFUNCTION' undeclared (first use in this function)
    1: error: 'CURLINFO_RTSP_CSEQ_RECV' undeclared (first use in this function)
    1: error: 'CURLOPT_TLSAUTH_USERNAME' undeclared (first use in this function)
    1: error: 'CURLE_PEER_FAILED_VERIFICATION' undeclared (first use in this function)
    1: error: 'CURLOPT_OPENSOCKETDATA' undeclared (first use in this function)
    1: error: 'CURLM_UNKNOWN_OPTION' undeclared (first use in this function)
    1: error: 'CURLPAUSE_RECV_CONT' undeclared (first use in this function)
    1: error: 'CURLE_FTP_COULDNT_SET_TYPE' undeclared (first use in this function)
    1: error: 'CURLOPT_IGNORE_CONTENT_LENGTH' undeclared (first use in this function)
    1: error: 'CURL_VERSION_TLSAUTH_SRP' undeclared (first use in this function)
    1: error: 'CURLOPT_INTERLEAVEDATA' undeclared (first use in this function)
    1: error: 'CURLINFO_OS_ERRNO' undeclared (first use in this function)
    1: error: 'CURLOPT_SOCKS5_GSSAPI_SERVICE' undeclared (first use in this function)
    1: error: 'CURLOPT_USE_SSL' undeclared (first use in this function)
    1: error: 'CURLE_TFTP_NOSUCHUSER' undeclared (first use in this function)
    1: error: 'CURLINFO_COOKIELIST' undeclared (first use in this function)
    1: error: 'CURL_VERSION_CURLDEBUG' undeclared (first use in this function)
    1: error: 'CURLOPT_LOCALPORTRANGE' undeclared (first use in this function)
    1: error: 'CURLOPT_KEYPASSWD' undeclared (first use in this function)
    1: error: 'CURLOPT_SERVER_RESPONSE_TIMEOUT' undeclared (first use in this function)
    1: error: 'CURLE_TFTP_ILLEGAL' undeclared (first use in this function)
    1: error: 'CURL_VERSION_CONV' undeclared (first use in this function)
    1: error: 'CURLOPT_CONNECTTIMEOUT_MS' undeclared (first use in this function)
    1: error: 'CURLE_TFTP_PERM' undeclared (first use in this function)
    1: error: 'CURLINFO_LOCAL_PORT' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_HOST_PUBLIC_KEY_MD5' undeclared (first use in this function)
    1: error: 'CURLE_SSH' undeclared (first use in this function)
    1: error: 'CURLOPT_ACCEPT_ENCODING' undeclared (first use in this function)
    1: error: 'CURLOPT_FNMATCH_DATA' undeclared (first use in this function)
    1: error: 'CURLINFO_LOCAL_IP' undeclared (first use in this function)
    1: error: 'CURLOPT_SOCKOPTDATA' undeclared (first use in this function)
    1: error: 'CURLMOPT_MAXCONNECTS' undeclared (first use in this function)
    1: error: 'CURLOPT_WILDCARDMATCH' undeclared (first use in this function)
    1: error: 'CURLE_REMOTE_ACCESS_DENIED' undeclared (first use in this function)
    1: error: 'CURLE_CHUNK_FAILED' undeclared (first use in this function)
    1: error: 'CURLOPT_RTSP_TRANSPORT' undeclared (first use in this function)
    1: error: 'CURLOPT_ADDRESS_SCOPE' undeclared (first use in this function)
    1: error: 'CURLOPT_CHUNK_DATA' undeclared (first use in this function)
    1: error: 'CURLOPT_MAX_RECV_SPEED_LARGE' undeclared (first use in this function)
    1: error: 'CURL_VERSION_NTLM_WB' undeclared (first use in this function)
    1: error: 'CURLOPT_TFTP_BLKSIZE' undeclared (first use in this function)
    1: error: 'CURLOPT_SOCKOPTFUNCTION' undeclared (first use in this function)
    1: error: 'CURLE_SEND_FAIL_REWIND' undeclared (first use in this function)
    1: error: 'CURLOPT_TLSAUTH_PASSWORD' undeclared (first use in this function)
    1: error: 'CURLOPT_FTP_ALTERNATIVE_TO_USER' undeclared (first use in this function)
    1: error: 'CURLMOPT_PIPELINING' undeclared (first use in this function)
    1: error: 'CURLMOPT_TIMERFUNCTION' undeclared (first use in this function)
    1: error: 'CURLOPT_SSL_SESSIONID_CACHE' undeclared (first use in this function)
    1: error: 'CURLE_LOGIN_DENIED' undeclared (first use in this function)
    1: error: 'CURLPAUSE_SEND' undeclared (first use in this function)
    1: error: 'CURLOPT_CHUNK_BGN_FUNCTION' undeclared (first use in this function)
    1: error: 'CURLOPT_SSH_KNOWNHOSTS' undeclared (first use in this function)
    1: error: 'CURLOPT_NEW_FILE_PERMS' undeclared (first use in this function)
    1: error: 'CURLE_REMOTE_DISK_FULL' undeclared (first use in this function)
    1: error: 'CURLOPT_COOKIELIST' undeclared (first use in this function)
    1: error: 'CURLPAUSE_SEND_CONT' undeclared (first use in this function)
    1: error: 'CURLOPT_NOPROXY' undeclared (first use in this function)
    
  • Fails to compile

    Fails to compile

    github.com/andelf/go-curl

    ../github.com/andelf/go-curl/c-callback.c: In function ‘header_function’: ../github.com/andelf/go-curl/c-callback.c:8:52: error: ‘GoUintptr’ undeclared (first use in this function) ../github.com/andelf/go-curl/c-callback.c:8:52: note: each undeclared identifier is reported only once for each function it appears in ../github.com/andelf/go-curl/c-callback.c:8:62: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:8:62: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c:9:70: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:9:70: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c: In function ‘write_function’: ../github.com/andelf/go-curl/c-callback.c:24:51: error: ‘GoUintptr’ undeclared (first use in this function) ../github.com/andelf/go-curl/c-callback.c:24:61: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:24:61: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c:25:70: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:25:70: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c: In function ‘read_function’: ../github.com/andelf/go-curl/c-callback.c:39:50: error: ‘GoUintptr’ undeclared (first use in this function) ../github.com/andelf/go-curl/c-callback.c:39:60: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:39:60: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c:40:70: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:40:70: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c: In function ‘progress_function’: ../github.com/andelf/go-curl/c-callback.c:55:54: error: ‘GoUintptr’ undeclared (first use in this function) ../github.com/andelf/go-curl/c-callback.c:55:64: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:55:64: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here ../github.com/andelf/go-curl/c-callback.c:56:69: error: expected ‘)’ before ‘ctx’ ../github.com/andelf/go-curl/c-callback.c:56:69: error: too few arguments to function ‘goGetCurlField’ callback.go:23:16: note: declared here

    Using curl 7.22. libcurl is installed.

  • Return HTTP status

    Return HTTP status

    Hello, I'm relatively new to Go and don't know on how to approach on debugging Go libraries.

    My question is how do we log the HTTP Status (200, 400, 502) when using this library? The doc only shows how to get the response.

    Thanks for the help!

  • Windows: callback.go:8:10: fatal error: curl/curl.h: No such file or directory

    Windows: callback.go:8:10: fatal error: curl/curl.h: No such file or directory

    Hi there, I am trying to build/run our program on a Windows Laptop machine.

    go run main.go provider.go

    # github.com/andelf/go-curl
    ..\go\pkg\mod\github.com\andelf\[email protected]\callback.go:8:10: fatal error: curl/curl.h: No such file or directory
        8 | #include <curl/curl.h>
          |          ^~~~~~~~~~~~~
    compilation terminated.
    

    go build .

    # github.com/andelf/go-curl
    ..\go\pkg\mod\github.com\andelf\[email protected]\callback.go:8:10: fatal error: curl/curl.h: No such file or directory
        8 | #include <curl/curl.h>
          |          ^~~~~~~~~~~~~
    compilation terminated.
    
  • Getting SSL certificate expiry date

    Getting SSL certificate expiry date

    Hi, I am looking to retrieve SSL certificate expiry date information for a site. I see there is a INFO_CERTINFO argument to Easy GetInfo() method to obtain this information. The call is supposed to return a slist of certificates in the chain (I presume). However, the test code crashes when this parameter to used.

    Is there a way around this or some example code to try out? Or, is there any other way to get the same information using a different API call? if err := easy.Perform(); err != nil { fmt.Printf("ERROR: %v\n", err) } else { x, err := easy.Getinfo(curl.INFO_CERTINFO) if err != nil { } fmt.Printf("certinfo:%f", x) }

    goroutine 1 [running]: github.com/andelf/go-curl.(*CURL).Getinfo.func5(0x40743c, 0x0, 0x0) /DIR/pkg/mod/github.com/andelf/[email protected]/easy.go:409 +0x5b github.com/andelf/go-curl.(*CURL).Getinfo(0xc00010a000, 0x400022) /DIR/pkg/mod/github.com/andelf/[email protected]/easy.go:409 +0xe6 main.main() /DIR/gotest/hello/main.go:27 +0xff exit status 2

    Thanks and appreciate all the hard work that went into this work!

  • Problem in building go software for windows

    Problem in building go software for windows

    Hi everyone Why cannot compile program for windows, while this works as well for Linux?

    This library have neutralized the language cross platform supporting? Or i miss something?

    [max@base test-program]$ env GOOS=windows GOARCH=amd64 go build

    # github.com/basemax/test-program
    ./main.go:139:13: undefined: curl.EasyInit
    ./main.go:142:17: undefined: curl.OPT_URL
    ./main.go:164:17: undefined: curl.OPT_POSTFIELDS
    ./main.go:166:17: undefined: curl.OPT_HTTPHEADER
    ./main.go:179:17: undefined: curl.OPT_PROXY
    ./main.go:182:17: undefined: curl.OPT_PROXYTYPE
    ./main.go:182:37: undefined: curl.PROXY_SOCKS5
    ./main.go:184:17: undefined: curl.OPT_HEADER
    ./main.go:185:17: undefined: curl.OPT_WRITEFUNCTION
    

    [max@base test-program]$ env GOOS=windows GOARCH=386 go build

    # github.com/basemax/test-program
    ./main.go:139:13: undefined: curl.EasyInit
    ./main.go:142:17: undefined: curl.OPT_URL
    ./main.go:164:17: undefined: curl.OPT_POSTFIELDS
    ./main.go:166:17: undefined: curl.OPT_HTTPHEADER
    ./main.go:179:17: undefined: curl.OPT_PROXY
    ./main.go:182:17: undefined: curl.OPT_PROXYTYPE
    ./main.go:182:37: undefined: curl.PROXY_SOCKS5
    ./main.go:184:17: undefined: curl.OPT_HEADER
    ./main.go:185:17: undefined: curl.OPT_WRITEFUNCTION
    

    [max@base test-program]$ env GOOS=linux GOARCH=amd64 go build

    no error, and good
    

    [max@base test-program]$ cat go.mod

    module github.com/basemax/test-program
    
    go 1.13
    
    require github.com/andelf/go-curl v0.0.0-20200630032108-fd49ff24ed97 // indirect
    

    [max@base test-program]$ cat go.sum

    github.com/andelf/go-curl v0.0.0-20200630032108-fd49ff24ed97 h1:Nyfs+rh56aORy2tGMI9GCYEqTfePwL1v47qOzebfv/o=
    github.com/andelf/go-curl v0.0.0-20200630032108-fd49ff24ed97/go.mod h1:WO1d2m1QDzkoPcgn9lgHVMi7qQR5j3jxYjIIvMTHpC0=
    

    main.go source code:

    package main
    
    import (
        "io"
        "os"
        "time"
        "strings"
        "bytes"
        "math"
        "sync"
        "flag"
        "fmt"
        "runtime"
        "bufio"
        // "math/rand"
        curl "github.com/andelf/go-curl"
    )
    
    ....
    ....
    ....
    

    [max@base test-program]$ go version

    go version go1.16.2 linux/amd64
    

    [max@base test-program]$ uname -a

    Linux base 5.9.16-1-MANJARO #1 SMP PREEMPT Mon Dec 21 22:00:46 UTC 2020 x86_64 GNU/Linux
    

    [max@base test-program]$ curl --version

    curl 7.75.0 (x86_64-pc-linux-gnu) libcurl/7.75.0 OpenSSL/1.1.1j zlib/1.2.11 zstd/1.4.9 libidn2/2.3.0 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0
    Release-Date: 2021-02-03
    Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
    Features: alt-svc AsynchDNS GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
    

    [max@base test-program]$ yay mingw

    5 community/mingw-w64-winpthreads 8.0.0-1 (213.6 KiB 1.8 MiB) [mingw-w64-toolchain mingw-w64] 
        MinGW-w64 winpthreads library
    4 community/mingw-w64-headers 8.0.0-1 (9.4 MiB 112.5 MiB) [mingw-w64-toolchain mingw-w64] 
        MinGW-w64 headers for Windows
    3 community/mingw-w64-gcc 10.2.0-2 (143.5 MiB 885.1 MiB) [mingw-w64-toolchain mingw-w64] 
        Cross GCC for the MinGW-w64 cross-compiler
    2 community/mingw-w64-crt 8.0.0-1 (5.5 MiB 141.0 MiB) [mingw-w64-toolchain mingw-w64] 
        MinGW-w64 CRT for Windows
    1 community/mingw-w64-binutils 2.35.1-1 (4.3 MiB 46.4 MiB) [mingw-w64-toolchain mingw-w64] 
        Cross binutils for the MinGW-w64 cross-compiler
    ==> Packages to install (eg: 1 2 3, 1-3 or ^4)
    ==> 1,2,3,4,5
    resolving dependencies...
    looking for conflicting packages...
    
    Packages (5) mingw-w64-binutils-2.35.1-1  mingw-w64-crt-8.0.0-1  mingw-w64-gcc-10.2.0-2  mingw-w64-headers-8.0.0-1  mingw-w64-winpthreads-8.0.0-1
    
    Total Download Size:    162.96 MiB
    Total Installed Size:  1186.75 MiB
    
    :: Proceed with installation? [Y/n] y
    :: Retrieving packages...
     mingw-w64-winpthreads-8.0.0-1-any                                                     213.6 KiB   234 KiB/s 00:01 [####################################################################]   0%
     mingw-w64-headers-8.0.0-1-any                                                           9.6 MiB   408 KiB/s 00:24 [####################################################################]   5%
     mingw-w64-crt-8.0.0-1-any                                                              15.2 MiB   450 KiB/s 00:34 [####################################################################]   9%
     mingw-w64-binutils-2.35.1-1-x86_64                                                     19.5 MiB   471 KiB/s 00:42 [####################################################################]  11%
     mingw-w64-gcc-10.2.0-2-x86_64                                                         163.0 MiB   656 KiB/s 04:14 [####################################################################] 100%
    (5/5) checking keys in keyring                                                                                     [####################################################################] 100%
    (5/5) checking package integrity                                                                                   [####################################################################] 100%
    (5/5) loading package files                                                                                        [####################################################################] 100%
    (5/5) checking for file conflicts                                                                                  [####################################################################] 100%
    (5/5) checking available disk space                                                                                [####################################################################] 100%
    :: Processing package changes...
    (1/5) installing mingw-w64-winpthreads                                                                             [####################################################################] 100%
    (2/5) installing mingw-w64-headers                                                                                 [####################################################################] 100%
    (3/5) installing mingw-w64-crt                                                                                     [####################################################################] 100%
    (4/5) installing mingw-w64-binutils                                                                                [####################################################################] 100%
    (5/5) installing mingw-w64-gcc                                                                                     [####################################################################] 100%
    :: Running post-transaction hooks...
    (1/2) Arming ConditionNeedsUpdate...
    (2/2) Updating the info directory file...
    
  • Get cURL error code

    Get cURL error code

    I haven't found a way to get cURL error code so far. When using EasyInit, it's returning error message string like curl: Couldn't resolve host name.

    func main() {
            easy := curl.EasyInit()
    	defer easy.Cleanup()
    
    	easy.Setopt(curl.OPT_URL, "http://zzzzzzzz---.com")
    
    	if err := easy.Perform(); err != nil {
    		fmt.Println(err, err.Error())
    	}
    }
    

    But, how to get the cURL error code like the libcurl equivalent returns.

    int main(int argc, char *argv[]) {
        CURL *easyhandle = curl_easy_init();
        curl_easy_setopt(easyhandle, CURLOPT_URL, "http://zzzzzzzz---.com");
        int errorCode = curl_easy_perform(easyhandle);
        printf("Error Code: %d %d\n", errorCode, errorCode == CURLE_COULDNT_RESOLVE_HOST);
        return 0;
    }
    
  • HTTP2 support?

    HTTP2 support?

    Curl has http2 support since some time ago https://curl.se/docs/http2.html. In fact, it is enabled by default when https is used.

    Is it planned to get this options supported in the project? If not, I would like to understand what it is needed to enable it.

    Supporting these new options involves executing the pre-processor programs like: https://github.com/andelf/go-curl/pull/51 or is it needed an extra effort to enable it?

    Of course, I suppose that supporting some of the new HTTP2 features (streaming, bidirectional, etc.) will require an extra effort, but maybe a "light" version of http2 support would take advantage of most features in HTTP2 (speed, compression, security, etc.).

Related tags
Parcel - HTTP rendering and binding library for Go

parcel HTTP rendering/binding library for Go Getting Started Add to your project

Jan 1, 2022
An enhanced http client for Golang
An enhanced http client for Golang

go-http-client An enhanced http client for Golang Documentation on go.dev ?? This package provides you a http client package for your http requests. Y

Dec 23, 2022
Go (golang) http calls with retries and backoff

pester pester wraps Go's standard lib http client to provide several options to increase resiliency in your request. If you experience poor network co

Dec 28, 2022
http client for golang
http client for golang

Request HTTP client for golang, Inspired by Javascript-axios Python-request. If you have experience about axios or requests, you will love it. No 3rd

Dec 18, 2022
A nicer interface for golang stdlib HTTP client

rq A nicer interface for golang stdlib HTTP client Documents rq: here client: here jar: here Why? Because golang HTTP client is a pain in the a... Fea

Dec 12, 2022
HTTP mocking for Golang

httpmock Easy mocking of http responses from external resources. Install Currently supports Go 1.7 - 1.15. v1 branch has to be used instead of master.

Dec 28, 2022
Speak HTTP like a local. (the simple, intuitive HTTP console, golang version)

http-gonsole This is the Go port of the http-console. Speak HTTP like a local Talking to an HTTP server with curl can be fun, but most of the time it'

Jul 14, 2021
Http client call for golang http api calls

httpclient-call-go This library is used to make http calls to different API services Install Package go get

Oct 7, 2022
A fantastic HTTP request libarary used in Golang.

goz A fantastic HTTP request library used in golang. Inspired by guzzle Installation go get -u github.com/idoubi/goz Documentation API documentation

Dec 21, 2022
An HTTP performance testing tool written in GoLang

Gonce A HTTP API performance testing tool written in GoLang Description Installation Usage Description A performance testing tool written in GoLang. S

Jan 28, 2022
fhttp is a fork of net/http that provides an array of features pertaining to the fingerprint of the golang http client.

fhttp The f stands for flex. fhttp is a fork of net/http that provides an array of features pertaining to the fingerprint of the golang http client. T

Jan 1, 2023
NATS HTTP Round Tripper - This is a Golang http.RoundTripper that uses NATS as a transport.

This is a Golang http.RoundTripper that uses NATS as a transport. Included is a http.RoundTripper for clients, a server that uses normal HTTP Handlers and any existing http handler mux and a Caddy Server transport.

Dec 6, 2022
httpreq is an http request library written with Golang to make requests and handle responses easily.

httpreq is an http request library written with Golang to make requests and handle responses easily. Install go get github.com/binalyze/http

Feb 10, 2022
Declarative golang HTTP client

go-req Declarative golang HTTP client package req_test

Dec 20, 2022
A golang tool which makes http requests and prints the address of the request along with the MD5 hash of the response.

Golang Tool This repository is a golang tool which makes http requests to the external server and prints the address of the request along with the MD5

Oct 17, 2021
Rewrite the httpie using Golang

go-http In the previous time, I wrote raw HTTP request in a text and sent it to server by nc tool to test my API. This hard-core style do help me to u

Nov 5, 2021
GoLang Smart HTTP Flood

smart-httpflood Golgang smart http flood This script supports HTTP Version, Cookie and Post Data. Installation: apt install snapd snap install go --cl

Dec 30, 2021
Advanced HTTP client for golang.

go-request Advanced HTTP client for golang. Installation go get github.com/mingming-cn/go-request Usage import ( "github.com/mingming-cn/go-reque

Nov 22, 2021
Weather api - A Simple Weather API Example With Golang

Example import: import "github.com/mr-joshcrane/weather_api" Example of Library

Jan 5, 2022