by dacc@exaptic.com:
What steps will reproduce the problem?
1. Attempt to retrieve a document from an https location using e.g.
http.Get("https://google.com/";)
What is the expected output?
Success.
What do you see instead?
Error with "bad certificate".
What is your $GOOS? $GOARCH?
darwin / i386
Which revision are you using? (hg identify)
db904d88dc0e+ tip
Please provide any additional information below.
This is caused by missing CA certificates. In src/pkg/crypt/tls/common.go the default
config looks for curl's root CA bundle at these locations:
<pre>
var certFiles = []string{
"/etc/ssl/certs/ca-certificates.crt", // Linux etc
"/usr/share/curl/curl-ca-bundle.crt", // OS X
}
</pre>
On the two OS 10.6 systems I checked the second location didn't exist. In fact, I
couldn't find this file anywhere after trying the following:
<pre>
{dan@godel /}$ mdfind curl-ca-bundle.crt|grep -v '^/opt'
/Users/dan/src/golang/src/pkg/crypto/tls/common.go
{dan@godel /}$ curl-config --ca
{dan@godel /}$
</pre>
Curl can still retrieve HTTPS URLs. I patched my common.m to look for the MacPorts
version of this file:
<pre>
{dan@godel ~/src/golang}$ hg diff
diff -r db904d88dc0e src/pkg/crypto/tls/common.go
--- a/src/pkg/crypto/tls/common.go Fri Jul 30 14:48:30 2010 +1000
+++ b/src/pkg/crypto/tls/common.go Sun Aug 08 01:47:51 2010 -0700
@@ -138,7 +138,8 @@
// the same root set that curl uses.
var certFiles = []string{
"/etc/ssl/certs/ca-certificates.crt", // Linux etc
- "/usr/share/curl/curl-ca-bundle.crt", // OS X
+ "/usr/share/curl/curl-ca-bundle.crt", // OS X (<= 10.5?)
+ "/opt/local/share/curl/curl-ca-bundle.crt", // OS X (MacPorts)
}
func initDefaultConfig() {
{dan@godel ~/src/golang}$
</pre>
by dacc@exaptic.com:
What steps will reproduce the problem? 1. Attempt to retrieve a document from an https location using e.g. http.Get("https://google.com/";) What is the expected output? Success. What do you see instead? Error with "bad certificate". What is your $GOOS? $GOARCH? darwin / i386 Which revision are you using? (hg identify) db904d88dc0e+ tip Please provide any additional information below. This is caused by missing CA certificates. In src/pkg/crypt/tls/common.go the default config looks for curl's root CA bundle at these locations: <pre> var certFiles = []string{ "/etc/ssl/certs/ca-certificates.crt", // Linux etc "/usr/share/curl/curl-ca-bundle.crt", // OS X } </pre> On the two OS 10.6 systems I checked the second location didn't exist. In fact, I couldn't find this file anywhere after trying the following: <pre> {dan@godel /}$ mdfind curl-ca-bundle.crt|grep -v '^/opt' /Users/dan/src/golang/src/pkg/crypto/tls/common.go {dan@godel /}$ curl-config --ca {dan@godel /}$ </pre> Curl can still retrieve HTTPS URLs. I patched my common.m to look for the MacPorts version of this file: <pre> {dan@godel ~/src/golang}$ hg diff diff -r db904d88dc0e src/pkg/crypto/tls/common.go --- a/src/pkg/crypto/tls/common.go Fri Jul 30 14:48:30 2010 +1000 +++ b/src/pkg/crypto/tls/common.go Sun Aug 08 01:47:51 2010 -0700 @@ -138,7 +138,8 @@ // the same root set that curl uses. var certFiles = []string{ "/etc/ssl/certs/ca-certificates.crt", // Linux etc - "/usr/share/curl/curl-ca-bundle.crt", // OS X + "/usr/share/curl/curl-ca-bundle.crt", // OS X (<= 10.5?) + "/opt/local/share/curl/curl-ca-bundle.crt", // OS X (MacPorts) } func initDefaultConfig() { {dan@godel ~/src/golang}$ </pre>