Sample code for 30+ languages & platforms
Tcl

Transition from Http.GetServerSslCert to Http.GetServerCert

See more HTTP Examples

Provides instructions for replacing deprecated GetServerSslCert method calls with GetServerCert.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set http [new_CkHttp]

set domain "chilkatsoft.com"
set port 443

# ------------------------------------------------------------------------
# The GetServerSslCert method is deprecated:

# cert1 is a CkCert
set cert1 [CkHttp_GetServerSslCert $http $domain $port]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    exit
}

puts [CkCert_subjectDN $cert1]
delete_CkCert $cert1

# ------------------------------------------------------------------------
# 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.

set cert2 [new_CkCert]

set success [CkHttp_GetServerCert $http $domain $port $cert2]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkCert $cert2
    exit
}

puts [CkCert_subjectDN $cert2]

delete_CkHttp $http
delete_CkCert $cert2