Skip to content

Commit

Permalink
curl patch for libssh2 1.11.1 test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Jan 22, 2024
1 parent d2e86ec commit 78e8385
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions curl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,57 @@ index 159fa6c66..7d70de53b 100644
/* OpenSSL catches this case, so should we. */
if(!buf)
return 0;
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index fa24ac38c..b09e35b89 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -3289,6 +3289,25 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)

#ifndef CURL_DISABLE_PROXY
if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) {
+ /*
+ Setup libssh2 callbacks to make it read/write TLS from the socket.
+
+ ssize_t
+ recvcb(libssh2_socket_t sock, void *buffer, size_t length,
+ int flags, void **abstract);
+
+ ssize_t
+ sendcb(libssh2_socket_t sock, const void *buffer, size_t length,
+ int flags, void **abstract);
+
+ */
+#if LIBSSH2_VERSION_NUM >= 0x010b01
+ infof(data, "Uses HTTPS proxy");
+ libssh2_session_callback_set2(sshc->ssh_session,
+ LIBSSH2_CALLBACK_RECV, ssh_tls_recv);
+ libssh2_session_callback_set2(sshc->ssh_session,
+ LIBSSH2_CALLBACK_SEND, ssh_tls_send);
+#else
/*
* This crazy union dance is here to avoid assigning a void pointer a
* function pointer as it is invalid C. The problem is of course that
@@ -3309,22 +3328,11 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
sshsend.sendptr = ssh_tls_send;

infof(data, "Uses HTTPS proxy");
- /*
- Setup libssh2 callbacks to make it read/write TLS from the socket.
-
- ssize_t
- recvcb(libssh2_socket_t sock, void *buffer, size_t length,
- int flags, void **abstract);
-
- ssize_t
- sendcb(libssh2_socket_t sock, const void *buffer, size_t length,
- int flags, void **abstract);
-
- */
libssh2_session_callback_set(sshc->ssh_session,
LIBSSH2_CALLBACK_RECV, sshrecv.recvp);
libssh2_session_callback_set(sshc->ssh_session,
LIBSSH2_CALLBACK_SEND, sshsend.sendp);
+#endif

/* Store the underlying TLS recv/send function pointers to be used when
reading from the proxy */

0 comments on commit 78e8385

Please sign in to comment.