Commit Graph

1043 Commits

Author SHA1 Message Date
michael-grunder
b652ad61e7 Rework searching for openssl 2023-03-06 12:59:09 -08:00
Victor Polevoy
a88c1da738 Attempt to find the correct path for openssl.
The installation path for openssl may vary depending on the way
used for its installation and the macOS version.

This commit attempts to find the correct path for openssl to use.
2023-03-06 12:59:09 -08:00
Dominik Charousset
1cbd5bc762
Write a version file for the CMake package (#1165)
* Write a version file for the CMake package

> If no VERSION is given, the PROJECT_VERSION variable is used.

Since we set the project version to `${VERSION}`, we can safely skip
passing it to `write_basic_package_version_file` as well.
2023-02-24 11:42:18 -08:00
Till Krüss
6f5bae8c69 fix typo 2023-01-06 12:29:45 -08:00
Fabrice Fontaine
acd09461d3 CMakeLists.txt: respect BUILD_SHARED_LIBS
To allow building hiredis on toolchain without dynamic library support,
respect standard cmake BUILD_SHARED_LIBS:
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-12-27 11:24:55 -08:00
Michael de Lang
97fcf0fd1a Add sdevent adapter 2022-12-21 15:55:54 -08:00
michael-grunder
ccff093bcd Bump dev version for the next release cycle. 2022-11-15 21:18:54 -08:00
michael-grunder
c14775b4e4 Prepare for v1.1.0 GA 2022-11-14 20:34:30 -08:00
filipe oliveira
f0bdf8405b
Add support for nan in RESP3 double (#1133) 2022-11-14 08:55:52 -08:00
Michael Grunder
991b0b0b31
Add an example that calls redisCommandArgv (#1140)
See #1138
2022-11-12 20:18:45 -08:00
Bjorn Svensson
a36686f84f
CI updates (#1139)
* Build CMake generated makefiles
* Simplify and update checkout
* Update CI workflow 'C/C++ CI'
* Some corrections of spelling and naming.
* Remove running on branch dev since not officially available.
2022-11-10 11:20:43 -08:00
dachui
8ad4985e9d fix flag reference 2022-11-09 21:17:59 -08:00
michael-grunder
7583ebb1b2 Make freeing a NULL redisAsyncContext a no op.
This makes our behavior consistent with redisFree and freeReplyObject.
2022-11-09 18:35:59 -08:00
michael-grunder
2c53dea7f9 Update version in dev branch. 2022-11-09 18:13:54 -08:00
michael-grunder
f063370edf Prepare for v1.1.0-rc1
- Update changelog.
- Bump version/soname defines.
2022-11-06 17:39:21 -08:00
michael-grunder
2b069573a5 CI fixes in preparation of release
- Upgrade to actions/checkout@v3 as node 12 is being phased out.
- Perform a manual dnf refresh on RockyLinux during setup.
- Switch to official cygwin/cygwin-install-action
2022-11-02 14:43:59 -07:00
michael-grunder
e1e9eb40db Add author information to release-drafter template. 2022-11-02 11:25:16 -07:00
bit0fun
afc29ee1a1 Update for mingw cross compile
- Used lowercase for Mstcpip.h as mingw will not find the file
	  otherwise
2022-10-26 18:09:00 -07:00
cqm
ceb8a8815e fixed cpp build error with adapters/libhv.h 2022-10-24 11:04:47 -07:00
Bjorn Svensson
3b15a04b59
Fixup of PR734: Coverage of hiredis.c (#1124)
Improve coverage (#734)

* Remove duplicate tests

- double covered by:
  "Can parse RESP3 doubles"
- bool covered via:
  "Can parse RESP3 bool"

* Make (connect) timeout in test config general

* Set error string in Unix connect with invalid timeout

Restructure testcase since redisConnectWithTimeout() and
redisConnectUnixWithTimeout() now behaves similar.

* Use quiet flag in lcov/genhtml instead of piping to /dev/null

* Fixup of redisCommandArgv test case

* Update test case to match what it covers

Use new test case info text since the previous one seemed copy&pasted.
The sought coverage was the handling of the parent-chaining
for a double object, which the test case now focuses on.

Co-authored-by: Ariel <ashtul@gmail.com>
2022-10-14 08:11:40 -07:00
Bjorn Svensson
c245df9fb9
CMake corrections for building on Windows (#1122)
* Replace use of newer CMake builtins than in v3.0.0

Visual Studio generator will replace -D with /D.

* Only use /Z7 flag on a Visual Studio compilator

Flag is not available on a GNU compilator running on windows,
like in a mingw64 setup.
2022-09-29 10:20:49 -07:00
michael-grunder
9c338a5981 Fix PUSH handler tests for Redis >= 7.0.5
Redis updated how invalidation push messages are sent to the client
after a FLUSHDB or FLUSHALL command.

See: redis/redis#8935
2022-09-27 14:33:26 -07:00
Bjorn Svensson
6d5c3ee74d
Install on windows fixes (#1117)
* Remove attempt to install .pdb file for windows static lib

From ff57c18b (#1054) the debug information was embedded in the
windows static lib rather than creating a .pdb file.
Removing the installation step of this file in CMake when building
with buildtype Debug or RelWithDebInfo.

* Embed debug information in windows hiredis_ssl_static lib

See ff57c18b (#1054) for same change in library hiredis_static.
2022-09-27 09:56:42 -07:00
Michael Grunder
68b29e1ad5
Add timeout support to libhv adapter. (#1109)
Add timeout support to libhv adapter.

See: #904
2022-09-21 15:10:37 -07:00
Bjorn Svensson
722e3409c7
Additional include directory given by pkg-config (#1118)
* Update include example in README

* Update pkg-config installed via CMake

Gives the include directory to enable the use of:
 #include <hiredis/hiredis.h>

but keeps the existing include dir. for backwards compatibility.

Example:
> pkg-config hiredis --cflags
-D_FILE_OFFSET_BITS=64 -I/usr/local/include/hiredis -I/usr/local/include

* Update pkg-config installed via Make

Gives the include directory to enable the use of:
  #include <hiredis/hiredis.h>
but keeps the existing include path for backwards compatibility.

Example:
> pkg-config hiredis --cflags
-D_FILE_OFFSET_BITS=64 -I/usr/local/include/hiredis -I/usr/local/include
2022-09-19 10:49:55 -07:00
Björn Svensson
bd9ccb8c47 Use __attribute__ when building with clang on windows
Since clang supports __attribute__ we can avoid disabling
it and use packed sdshdr structs. This also make sure we dont
affect subsequent header files that require __attribute__.

Note:
Clang attempts to be compatible with MSVC and defines _MSC_VER
2022-09-14 16:56:41 -07:00
Vlad Turchenko
5392adc265 set default SSL certificate directory 2022-09-08 14:02:29 -07:00
michael-grunder
560e664862 Minor refactor
Protect against a NULL pointer dereference, and remove unused write
to a variable.
2022-09-08 11:18:43 -07:00
michael-grunder
d756f68a59 Add libhv example to our standard Makefile
See #904
2022-09-07 15:20:28 -07:00
hewei.it
a66916719b Add adapters/libhv 2022-09-07 11:14:45 -07:00
Björn Svensson
855b48a819 Fix pkgconfig for hiredis_ssl
Respect an overridden libdir when installing using CMake.
CMake now generates the hiredis_ssl.pc file with the correct
result in `libdir` and `Libs`.

See #767 and CMakes `CMAKE_INSTALL_LIBDIR`
2022-09-06 09:11:00 -07:00
Michael Grunder
79ae5ffc69
Fix protocol error (#1106)
Fix ProtocolError

This commit attempts to fix hiredis such that a recoverable write error
will be retried rather than throwing a hard error.

Since our read/write functions are now behind function pointers, we
specify semantically that a return value of < 0 is a hard error, 0 a
recoverable error, and > 0 a success.

Our default `redisNetRead` function was already doing something similar
so this also improves code consistency.

Resolves #961

Co-authored-by: Maksim Tuleika <maksim.tuleika@appcast.io>
2022-09-05 11:59:21 -07:00
Michael Grunder
61b5b299f0
Use a windows specific keepalive function. (#1104)
Use a windows specific keepalive function.

While it is possible to toggle `TCP_KEEPALIVE` in windows via
setsockopt, you have to use `WSAIoctl` to set the interval.

Since `WSAIoctl` can actually do all of this in one call (toggle the
option, and set the corresponding interval), just use that in Windows
and avoid the call to `setsockopt` alltogether.

Fixes: #1100
2022-09-03 12:39:57 -07:00
zhenwei pi
fce8abc1c1 Introduce .close method for redisContextFuncs
Currently, hiredis supports TCP/SSL/Unix, all of the connection types
use a single FD(int), close() is enough to close a connection. For the
further step, introduce .close method for redisContextFuncs, this
allows to close a complex connection context, for example RDMA.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-09-02 10:25:52 -07:00
Michael Grunder
cfb6ca8811
Add REDIS_OPT_PREFER_UNSPEC (#1101)
Add REDIS_OPT_PREFER_UNSPEC

See: #1099, #1096

Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
2022-09-02 09:57:18 -07:00
michael-grunder
cc7c35ce60 Update documentation to explain redisConnectWithOptions.
Additionally document the new `REDIS_OPT_PREFER_IPV4`,
`REDIS_OPT_PREFER_IPV6` as well as the rest of our existing options.

See #1096
2022-09-01 18:40:12 -07:00
zhangtaoXT5
bc8d837b72
fix heap-buffer-overflow (#957)
Prevent incrementing passed a `\0` in our format string.

Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
2022-09-01 13:45:28 -07:00
Anton Tiurin
ca4a0e850b uvadapter: reduce number of uv_poll_start calls
Internally uv_poll_start iterates over all
attached event handlers to update event mask. It's
quite expensive operation if there many event handlers attached
to a loop.
As redisLibuvEvents.events is a copy of what libuv should see,
we can rely on it to avoid event mask updates.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2022-09-01 12:37:30 -07:00
Tongliang Liao
35d398c903 Fix cmake config path on Linux.
CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`.
I'm not sure why it was set that way.
Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
2022-09-01 10:43:36 -07:00
Viktor Söderqvist
10c78c6e17 Add possibility to prefer IPv6, IPv4 or unspecified 2022-09-01 10:42:36 -07:00
Björn Svensson
1abe0c8285 fuzzer: No alloc in redisFormatCommand() when fail 2022-09-01 10:35:07 -07:00
Björn Svensson
329eaf9bae Fix heap-buffer-overflow issue in redisvFormatCommad
A command with a faulty formatting string that lacks the
conversion specifier results in a ASAN heap-buffer-overflow.
This was due to that strchr() matches on null-termination,
which triggers a continuation of the string parsing.
2022-09-01 10:35:07 -07:00
michael-grunder
eaae7321c2 Polling adapter requires sockcompat.h
We need to install our socket compatibility header as the new polling
adapter needs it.
2022-09-01 00:50:23 -07:00
bugwz
0a5fa3ddee Regression test for off-by-one parsing error
See: #916
2022-08-31 09:42:10 -07:00
Pei-Hsuan Hung
9e174e8f7d Add do while(0) protection for macros
Wrapping multi-line macros in do...while(0) statement prevents
potential dangling else problem.
2022-08-30 11:41:59 -07:00
michael-grunder
4ad99c69a2 Rework asSleep to be a generic millisleep function. 2022-08-29 16:22:20 -07:00
Arseniy Simonov
75cb6c1ea6 Do store command timeout in the context for redisSetTimeout (#593) 2022-08-29 16:22:20 -07:00
Lipraxde
c57cad658d CMake: remove dict.c form hiredis_sources
Commit c6b8bd77c0 to make all functions in dict.c static. If a CMake project set warning unused functions, and include hiredis using add_subdirectory , this cause warnings / errors.
2022-08-29 14:31:51 -07:00
Kristján Valur Jónsson
8491a65a95
Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
* Add docker support to test.sh
specifying a REDIS_DOCKER env var will run this as a server.
* Add initial test workflow
* Add workflow test to test 32 bit build
* Add ARM x compilation tests
* Add tests for windows platform
* Test with valgrind
2022-08-29 14:30:08 -07:00
Michael Grunder
77e4f09ea8
Merge pull request #964 from afcidk/fix-createDoubleObject
Fix potential fault at createDoubleObject
2022-08-29 12:24:57 -07:00