Skip to content

Commit

Permalink
curl_global_sslset: select backend by name case insensitively
Browse files Browse the repository at this point in the history
Closes #1849
  • Loading branch information
bagder committed Sep 1, 2017
1 parent 1cf323e commit c290b8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/libcurl/curl_global_sslset.3
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ must be called \fBbefore\fP \fIcurl_global_init(3)\fP.

The backend can be identified by the \fIid\fP
(e.g. \fBCURLSSLBACKEND_OPENSSL\fP). The backend can also be specified via the
\fIname\fP parameter (passing -1 as \fIid\fP). If both \fIid\fP and \fIname\fP
are specified, the \fIname\fP will be ignored.
\fIname\fP parameter for a case insensitive match (passing -1 as \fIid\fP). If
both \fIid\fP and \fIname\fP are specified, the \fIname\fP will be ignored.

If neither \fIid\fP nor \fPname\fP are specified, the function will fail with
CURLSSLSET_UNKNOWN_BACKEND and set the \fIavail\fP pointer to the
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/vtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ CURLsslset curl_global_sslset(curl_sslbackend id, const char *name,

for(i = 0; available_backends[i]; i++)
if(available_backends[i]->info.id == id ||
(name && !strcmp(available_backends[i]->info.name, name))) {
(name && Curl_strcasecompare(available_backends[i]->info.name, name))) {
multissl_init(available_backends[i]);
return CURLSSLSET_OK;
}
Expand Down

2 comments on commit c290b8f

@gvanem
Copy link
Contributor

@gvanem gvanem commented on c290b8f Sep 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the value of env-var CURL_SSL_BACKEND be treated in the same manner?

--- a/lib/vtls/vtls.c 2017-09-03 09:50:08
+++ b/vtls/vtls.c 2017-09-05 16:21:08
@@ -1252,7 +1252,7 @@
 #endif
   if(env)
     for(i = 0; available_backends[i]; i++)
-      if(!strcmp(env, available_backends[i]->info.name)) {
+      if(curl_strequal(env, available_backends[i]->info.name)) {
         Curl_ssl = available_backends[i];
         return 0;
       }

Edit: use curl_strequal() instead.

@jay
Copy link
Member

@jay jay commented on c290b8f Sep 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the value of env-var CURL_SSL_BACKEND be treated in the same manner?

Thanks, landed in 61825be. In the tool we would use curl_strequal and in the library it would be strcasecompare. They both map to Curl_strcasecompare.

Please sign in to comment.