Is any of the following set `HTTPS_PROXY', `HTTP_PROXY' ? The DefaultTransport pays attention to those env vars to decide whether to use a proxy or not. If that's not the case, what is the error that you're getting ?
cheers, -js yyq2...@gmail.com writes: > http.Get doesn't work with default transport, but works fine if I set a > custom as following(uncomment the two lines) > > package main > > import ( > "net/http" > "io/ioutil" > "fmt" > "log" > ) > func main() { > //tr := &http.Transport{} > //http.DefaultClient.Transport =tr > res, err:= http.Get("https://www.github.com/") > if err != nil { > log.Fatal(err) > return > } > > defer res.Body.Close() > > body,err:=ioutil.ReadAll(res.Body) > if err != nil { > log.Fatal(err) > return > } > > fmt.Println(string(body)) > } > > There is an error with less meaning: > Get https://www.github.com/: unexpected EOF -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.