Go
Go
Transition from Http.GetServerSslCert to Http.GetServerCert
See more HTTP Examples
Provides instructions for replacing deprecated GetServerSslCert method calls with GetServerCert.Chilkat Go Downloads
success := false
http := chilkat.NewHttp()
domain := "chilkatsoft.com"
port := 443
// ------------------------------------------------------------------------
// The GetServerSslCert method is deprecated:
cert1 := http.GetServerSslCert(domain,port)
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
return
}
fmt.Println(cert1.SubjectDN())
cert1.DisposeCert()
// ------------------------------------------------------------------------
// Do the equivalent using GetServerCert.
// Your application creates a new, empty certificate object which is passed
// in the last argument and filled with the server certificate upon success.
cert2 := chilkat.NewCert()
success = http.GetServerCert(domain,port,cert2)
if success == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
cert2.DisposeCert()
return
}
fmt.Println(cert2.SubjectDN())
http.DisposeHttp()
cert2.DisposeCert()