Skip to content
Snippets Groups Projects
Commit c0460660 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Wez Furlong's curl_version_info() function added, still needs some

adjustments and possibly some improvments to feature all those things we
could possibly want from this.
parent b03f4919
No related branches found
No related tags found
No related merge requests found
......@@ -909,6 +909,27 @@ CURLcode curl_share_set_unlock_function (curl_share *, curl_unlock_function);
CURLcode curl_share_set_lock_data (curl_share *, void *);
CURLcode curl_share_destroy (curl_share *);
/****************************************************************************
* Structures for querying information about the curl library at runtime.
*/
/* declared as a struct to allow future expansion while remaining backwards
* and binary compatible; any new fields in these two structs must be added
* after the existing fields */
typedef struct {
const char *protoname;
} curl_runtime_protocol_info;
typedef struct {
const char *version; /* LIBCURL_VERSION */
unsigned int version_num; /* LIBCURL_VERSION_NUM */
/* protocols is terminated by an entry with a NULL protoname */
curl_runtime_protocol_info *protocols;
} curl_version_info_data;
/* returns a pointer to a static copy of the version info struct */
const curl_version_info_data *curl_version_info(void);
#ifdef __cplusplus
}
#endif
......
......@@ -1832,6 +1832,9 @@ static CURLcode CreateConnection(struct SessionHandle *data,
* is based on the first letters of the server name.
*/
/* Note: if you add a new protocol, please update the list in
* lib/version.c too! */
if(strnequal(conn->gname, "FTP", 3)) {
strcpy(conn->protostr, "ftp");
}
......
......@@ -105,6 +105,53 @@ char *curl_version(void)
return version;
}
/* data for curl_version_info */
static const curl_runtime_protocol_info protocols[] = {
#ifndef CURL_DISABLE_FTP
{ "ftp" },
#endif
#ifndef CURL_DISABLE_GOPHER
{ "gopher" },
#endif
#ifndef CURL_DISABLE_TELNET
{ "telnet" },
#endif
#ifndef CURL_DISABLE_DICT
{ "dict" },
#endif
#ifndef CURL_DISABLE_LDAP
{ "ldap" },
#endif
#ifndef CURL_DISABLE_HTTP
{ "http" },
#endif
#ifndef CURL_DISABLE_FILE
{ "file" },
#endif
#ifdef USE_SSLEAY
#ifndef CURL_DISABLE_HTTP
{ "https" },
#endif
#ifndef CURL_DISABLE_FTP
{ "ftps" },
#endif
#endif
{ NULL }
};
static const curl_version_info_data version_info = {
LIBCURL_VERSION,
LIBCURL_VERSION_NUM,
&protocols
};
const curl_version_info_data *curl_version_info(void)
{
return &version_info;
}
/*
* local variables:
* eval: (load-file "../curl-mode.el")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment