andelf/go-curl

Couldn't read Getinfo Informations

sckn opened this issue · 0 comments

sckn commented

Hello,

I couldn't read response total time.


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
    }

    x,err:=easy.Getinfo(curl.INFO_TOTAL_TIME)
    if err != nil {
    }
    fmt.Printf("total:%f",x)


    easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest)

    if err := easy.Perform(); err != nil {
        fmt.Printf("ERROR: %v\n", err)
    }
}

Returned :
total:0.000000

Other options are like same too