1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2003, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
22 ***************************************************************************/
29 #include <curl/curl.h>
33 static void getssl_version(char *ptr, long *num)
36 #if (SSLEAY_VERSION_NUMBER >= 0x905000)
39 unsigned long ssleay_value;
41 ssleay_value=SSLeay();
43 if(ssleay_value < 0x906000) {
44 ssleay_value=SSLEAY_VERSION_NUMBER;
48 if(ssleay_value&0xff0) {
49 sub[0]=(char)((ssleay_value>>4)&0xff) + 'a' -1;
55 sprintf(ptr, " OpenSSL/%lx.%lx.%lx%s",
56 (ssleay_value>>28)&0xf,
57 (ssleay_value>>20)&0xff,
58 (ssleay_value>>12)&0xff,
63 *num = SSLEAY_VERSION_NUMBER;
64 #if (SSLEAY_VERSION_NUMBER >= 0x900000)
65 sprintf(ptr, " OpenSSL/%lx.%lx.%lx",
66 (SSLEAY_VERSION_NUMBER>>28)&0xff,
67 (SSLEAY_VERSION_NUMBER>>20)&0xff,
68 (SSLEAY_VERSION_NUMBER>>12)&0xf);
73 if(SSLEAY_VERSION_NUMBER&0x0f) {
74 sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1;
79 sprintf(ptr, " SSL/%x.%x.%x%s",
80 (SSLEAY_VERSION_NUMBER>>12)&0xff,
81 (SSLEAY_VERSION_NUMBER>>8)&0xf,
82 (SSLEAY_VERSION_NUMBER>>4)&0xf, sub);
90 char *curl_version(void)
92 static char version[200];
95 strcpy(version, LIBCURL_NAME "/" LIBCURL_VERSION );
96 ptr=strchr(version, '\0');
99 getssl_version(ptr, &num);
100 ptr=strchr(version, '\0');
102 (void)num; /* no compiler warning please */
106 sprintf(ptr, " krb4");
110 sprintf(ptr, " ipv6");
114 sprintf(ptr, " zlib/%s", zlibVersion());
118 sprintf(ptr, " GSS");
125 /* data for curl_version_info */
127 static const char *protocols[] = {
128 #ifndef CURL_DISABLE_FTP
131 #ifndef CURL_DISABLE_GOPHER
134 #ifndef CURL_DISABLE_TELNET
137 #ifndef CURL_DISABLE_DICT
140 #ifndef CURL_DISABLE_LDAP
143 #ifndef CURL_DISABLE_HTTP
146 #ifndef CURL_DISABLE_FILE
151 #ifndef CURL_DISABLE_HTTP
154 #ifndef CURL_DISABLE_FTP
161 static curl_version_info_data version_info = {
165 OS, /* as found by configure or set by hand at build-time */
166 0 /* features is 0 by default */
171 | CURL_VERSION_KERBEROS4
175 | CURL_VERSION_NTLM /* since this requires OpenSSL */
181 | CURL_VERSION_GSSNEGOTIATE
187 | CURL_VERSION_ASYNCHDNS
190 NULL, /* ssl_version */
191 0, /* ssl_version_num */
192 NULL, /* zlib_version */
196 curl_version_info_data *curl_version_info(CURLversion stamp)
199 static char ssl_buffer[80];
201 getssl_version(ssl_buffer, &num);
203 version_info.ssl_version = ssl_buffer;
204 version_info.ssl_version_num = num;
205 /* SSL stuff is left zero if undefined */
209 version_info.libz_version = zlibVersion();
210 /* libz left NULL if non-existing */
212 (void)stamp; /* avoid compiler warnings, we don't use this */
214 return &version_info;