Skip to content

Commit

Permalink
backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Feb 12, 2022
1 parent 602b243 commit abec19e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion make_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ else
fi
ldd $RELEASE/usr/bin/ebusd | egrep -q libssl.so.1.1
if [ $? -eq 0 ]; then
extralibs="$extralibs, libssl1.1 (>= 1.1.1)"
extralibs="$extralibs, libssl1.1 (>= 1.1.0)"
fi

if [ -n "$RUNTEST" ]; then
Expand Down
14 changes: 14 additions & 0 deletions src/lib/utils/httpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,18 @@ SSLSocket::~SSLSocket() {

ssize_t SSLSocket::send(const char* data, size_t len) {
do {
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
size_t part = 0;
int res = BIO_write_ex(m_bio, data, len, &part);
if (res == 1) {
return static_cast<signed>(part);
}
#else
int res = BIO_write(m_bio, data, static_cast<int>(len));
if (res > 0) {
return static_cast<ssize_t>(res);
}
#endif
if (!BIO_should_retry(m_bio)) {
if (isError("send", true)) {
return -1;
Expand All @@ -94,11 +101,18 @@ ssize_t SSLSocket::send(const char* data, size_t len) {

ssize_t SSLSocket::recv(char* data, size_t len) {
do {
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
size_t part = 0;
int res = BIO_read_ex(m_bio, data, len, &part);
if (res == 1) {
return static_cast<signed>(part);
}
#else
int res = BIO_read(m_bio, data, static_cast<int>(len));
if (res > 0) {
return static_cast<ssize_t>(res);
}
#endif
if (!BIO_should_retry(m_bio)) {
if (isError("recv", true)) {
return -1;
Expand Down

0 comments on commit abec19e

Please sign in to comment.