Compare commits
1 Commits
master
...
drop-dead-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b778f732e |
36
.github/workflows/build.yml
vendored
36
.github/workflows/build.yml
vendored
@ -37,6 +37,42 @@ jobs:
|
|||||||
# TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
|
# TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
|
||||||
# run: $GITHUB_WORKSPACE/test.sh
|
# run: $GITHUB_WORKSPACE/test.sh
|
||||||
|
|
||||||
|
centos7:
|
||||||
|
name: CentOS 7
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: centos:7
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
|
||||||
|
yum -y --enablerepo=remi install redis
|
||||||
|
yum -y install gcc gcc-c++ make openssl openssl-devel cmake3 valgrind libevent-devel
|
||||||
|
|
||||||
|
- name: Build using cmake
|
||||||
|
env:
|
||||||
|
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
|
||||||
|
CFLAGS: -Werror
|
||||||
|
CXXFLAGS: -Werror
|
||||||
|
run: mkdir build && cd build && cmake3 .. && make
|
||||||
|
|
||||||
|
- name: Build using Makefile
|
||||||
|
run: USE_SSL=1 TEST_ASYNC=1 make
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
env:
|
||||||
|
SKIPS_AS_FAILS: 1
|
||||||
|
TEST_SSL: 1
|
||||||
|
run: $GITHUB_WORKSPACE/test.sh
|
||||||
|
|
||||||
|
- name: Run tests under valgrind
|
||||||
|
env:
|
||||||
|
SKIPS_AS_FAILS: 1
|
||||||
|
TEST_SSL: 1
|
||||||
|
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
|
||||||
|
run: $GITHUB_WORKSPACE/test.sh
|
||||||
|
|
||||||
centos8:
|
centos8:
|
||||||
name: RockyLinux 8
|
name: RockyLinux 8
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
3
Makefile
3
Makefile
@ -141,10 +141,7 @@ endif
|
|||||||
ifeq ($(uname_S),Darwin)
|
ifeq ($(uname_S),Darwin)
|
||||||
DYLIBSUFFIX=dylib
|
DYLIBSUFFIX=dylib
|
||||||
DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
|
DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
|
||||||
DYLIB_MAJOR_NAME=$(LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
|
|
||||||
DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
|
DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
|
||||||
SSL_DYLIB_MINOR_NAME=$(SSL_LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
|
|
||||||
SSL_DYLIB_MAJOR_NAME=$(SSL_LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
|
|
||||||
SSL_DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME) -o $(SSL_DYLIBNAME) $(LDFLAGS) $(SSL_LDFLAGS)
|
SSL_DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME) -o $(SSL_DYLIBNAME) $(LDFLAGS) $(SSL_LDFLAGS)
|
||||||
DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup
|
DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,35 +1,7 @@
|
|||||||
/*
|
//
|
||||||
* Copyright (c) 2015 Дмитрий Бахвалов (Dmitry Bakhvalov)
|
// Created by Дмитрий Бахвалов on 13.07.15.
|
||||||
*
|
// Copyright (c) 2015 Dmitry Bakhvalov. All rights reserved.
|
||||||
* Permission for license update:
|
//
|
||||||
* https://github.com/redis/hiredis/issues/1271#issuecomment-2258225227
|
|
||||||
*
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of Redis nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __HIREDIS_MACOSX_H__
|
#ifndef __HIREDIS_MACOSX_H__
|
||||||
#define __HIREDIS_MACOSX_H__
|
#define __HIREDIS_MACOSX_H__
|
||||||
|
|||||||
2
async.c
2
async.c
@ -478,7 +478,7 @@ static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply,
|
|||||||
|
|
||||||
/* Match reply with the expected format of a pushed message.
|
/* Match reply with the expected format of a pushed message.
|
||||||
* The type and number of elements (3 to 4) are specified at:
|
* The type and number of elements (3 to 4) are specified at:
|
||||||
* https://redis.io/docs/latest/develop/interact/pubsub/#format-of-pushed-messages */
|
* https://redis.io/topics/pubsub#format-of-pushed-messages */
|
||||||
if ((reply->type == REDIS_REPLY_ARRAY && !(c->flags & REDIS_SUPPORTS_PUSH) && reply->elements >= 3) ||
|
if ((reply->type == REDIS_REPLY_ARRAY && !(c->flags & REDIS_SUPPORTS_PUSH) && reply->elements >= 3) ||
|
||||||
reply->type == REDIS_REPLY_PUSH) {
|
reply->type == REDIS_REPLY_PUSH) {
|
||||||
assert(reply->element[0]->type == REDIS_REPLY_STRING);
|
assert(reply->element[0]->type == REDIS_REPLY_STRING);
|
||||||
|
|||||||
@ -1,35 +1,7 @@
|
|||||||
/*
|
//
|
||||||
* Copyright (c) 2015 Дмитрий Бахвалов (Dmitry Bakhvalov)
|
// Created by Дмитрий Бахвалов on 13.07.15.
|
||||||
*
|
// Copyright (c) 2015 Dmitry Bakhvalov. All rights reserved.
|
||||||
* Permission for license update:
|
//
|
||||||
* https://github.com/redis/hiredis/issues/1271#issuecomment-2258225227
|
|
||||||
*
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of Redis nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
2
net.c
2
net.c
@ -668,7 +668,7 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
|
|||||||
sa->sun_family = AF_UNIX;
|
sa->sun_family = AF_UNIX;
|
||||||
strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1);
|
strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1);
|
||||||
if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) {
|
if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) {
|
||||||
if ((errno == EAGAIN || errno == EINPROGRESS) && !blocking) {
|
if (errno == EINPROGRESS && !blocking) {
|
||||||
/* This is ok. */
|
/* This is ok. */
|
||||||
} else {
|
} else {
|
||||||
if (redisContextWaitReady(c,timeout_msec) != REDIS_OK)
|
if (redisContextWaitReady(c,timeout_msec) != REDIS_OK)
|
||||||
|
|||||||
9
ssl.c
9
ssl.c
@ -167,8 +167,8 @@ static int initOpensslLocks(void) {
|
|||||||
|
|
||||||
int redisInitOpenSSL(void)
|
int redisInitOpenSSL(void)
|
||||||
{
|
{
|
||||||
#ifdef HIREDIS_USE_CRYPTO_LOCKS
|
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
|
#ifdef HIREDIS_USE_CRYPTO_LOCKS
|
||||||
initOpensslLocks();
|
initOpensslLocks();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -364,6 +364,7 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
|
|||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c->funcs = &redisContextSSLFuncs;
|
||||||
rssl->ssl = ssl;
|
rssl->ssl = ssl;
|
||||||
|
|
||||||
SSL_set_mode(rssl->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
SSL_set_mode(rssl->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
||||||
@ -371,19 +372,15 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
|
|||||||
SSL_set_connect_state(rssl->ssl);
|
SSL_set_connect_state(rssl->ssl);
|
||||||
|
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
|
||||||
int rv = SSL_connect(rssl->ssl);
|
int rv = SSL_connect(rssl->ssl);
|
||||||
if (rv == 1) {
|
if (rv == 1) {
|
||||||
c->funcs = &redisContextSSLFuncs;
|
|
||||||
c->privctx = rssl;
|
c->privctx = rssl;
|
||||||
return REDIS_OK;
|
return REDIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = SSL_get_error(rssl->ssl, rv);
|
rv = SSL_get_error(rssl->ssl, rv);
|
||||||
if (((c->flags & REDIS_BLOCK) == 0) &&
|
if (((c->flags & REDIS_BLOCK) == 0) &&
|
||||||
(rv == SSL_ERROR_WANT_READ || rv == SSL_ERROR_WANT_WRITE))
|
(rv == SSL_ERROR_WANT_READ || rv == SSL_ERROR_WANT_WRITE)) {
|
||||||
{
|
|
||||||
c->funcs = &redisContextSSLFuncs;
|
|
||||||
c->privctx = rssl;
|
c->privctx = rssl;
|
||||||
return REDIS_OK;
|
return REDIS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
10
test.c
10
test.c
@ -1276,13 +1276,15 @@ static void test_blocking_connection_timeouts(struct config config) {
|
|||||||
redisContext *c;
|
redisContext *c;
|
||||||
redisReply *reply;
|
redisReply *reply;
|
||||||
ssize_t s;
|
ssize_t s;
|
||||||
const char *sleep_cmd = "DEBUG SLEEP 1\r\n";
|
const char *sleep_cmd = "DEBUG SLEEP 3\r\n";
|
||||||
struct timeval tv = {.tv_sec = 0, .tv_usec = 10000};
|
struct timeval tv;
|
||||||
|
|
||||||
c = do_connect(config);
|
c = do_connect(config);
|
||||||
test("Successfully completes a command when the timeout is not exceeded: ");
|
test("Successfully completes a command when the timeout is not exceeded: ");
|
||||||
reply = redisCommand(c,"SET foo fast");
|
reply = redisCommand(c,"SET foo fast");
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_usec = 10000;
|
||||||
redisSetTimeout(c, tv);
|
redisSetTimeout(c, tv);
|
||||||
reply = redisCommand(c, "GET foo");
|
reply = redisCommand(c, "GET foo");
|
||||||
test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
|
test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
|
||||||
@ -1300,6 +1302,8 @@ static void test_blocking_connection_timeouts(struct config config) {
|
|||||||
sdsfree(c->obuf);
|
sdsfree(c->obuf);
|
||||||
c->obuf = sdsempty();
|
c->obuf = sdsempty();
|
||||||
|
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_usec = 10000;
|
||||||
redisSetTimeout(c, tv);
|
redisSetTimeout(c, tv);
|
||||||
reply = redisCommand(c, "GET foo");
|
reply = redisCommand(c, "GET foo");
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -1312,7 +1316,7 @@ static void test_blocking_connection_timeouts(struct config config) {
|
|||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
|
|
||||||
// wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
|
// wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
|
||||||
millisleep(1100);
|
millisleep(3000);
|
||||||
} else {
|
} else {
|
||||||
test_skipped();
|
test_skipped();
|
||||||
}
|
}
|
||||||
|
|||||||
4
test.sh
4
test.sh
@ -11,7 +11,7 @@ SKIPS_ARG=${SKIPS_ARG:-}
|
|||||||
REDIS_DOCKER=${REDIS_DOCKER:-}
|
REDIS_DOCKER=${REDIS_DOCKER:-}
|
||||||
|
|
||||||
# We need to enable the DEBUG command for redis-server >= 7.0.0
|
# We need to enable the DEBUG command for redis-server >= 7.0.0
|
||||||
REDIS_MAJOR_VERSION="$(${REDIS_SERVER} --version|awk -F'[^0-9]+' '{ print $2 }')"
|
REDIS_MAJOR_VERSION="$(redis-server --version|awk -F'[^0-9]+' '{ print $2 }')"
|
||||||
if [ "$REDIS_MAJOR_VERSION" -gt "6" ]; then
|
if [ "$REDIS_MAJOR_VERSION" -gt "6" ]; then
|
||||||
ENABLE_DEBUG_CMD="enable-debug-command local"
|
ENABLE_DEBUG_CMD="enable-debug-command local"
|
||||||
fi
|
fi
|
||||||
@ -98,7 +98,7 @@ if [ -n "${REDIS_DOCKER}" ] ; then
|
|||||||
-p ${REDIS_SSL_PORT}:${REDIS_SSL_PORT} \
|
-p ${REDIS_SSL_PORT}:${REDIS_SSL_PORT} \
|
||||||
-v ${tmpdir}:${tmpdir} \
|
-v ${tmpdir}:${tmpdir} \
|
||||||
${REDIS_DOCKER} \
|
${REDIS_DOCKER} \
|
||||||
${REDIS_SERVER} ${tmpdir}/redis.conf
|
redis-server ${tmpdir}/redis.conf
|
||||||
else
|
else
|
||||||
${REDIS_SERVER} ${tmpdir}/redis.conf
|
${REDIS_SERVER} ${tmpdir}/redis.conf
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user