Commit Graph

168 Commits

Author SHA1 Message Date
michael-grunder
d7a84df9ea Bump development SONAME. 2023-07-13 09:17:53 -07:00
Chayim
60e5075d4a
Version 1.2.0 (#1202)
Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
2023-07-12 10:31:17 +03:00
Viktor Söderqvist
b6a052fe09
Helper for setting TCP_USER_TIMEOUT socket option (#1188)
* Implement redisSetTcpUserTimeout to set socket option TCP_USER_TIMEOUT

* Documentation for redisSetTcpUserTimeout and some more undocumented functions

Documentation for redisReconnect() and the setters of socket options:

* redisKeepAlive()
* redisEnableKeepAliveWithInterval()
* redisSetTcpUserTimeout()
2023-05-29 13:25:34 -07:00
Viktor Söderqvist
04c1b5b029 Fix colliding option values 2023-03-13 12:08:58 -07:00
michael-grunder
011f7093c0 Allow specifying the keepalive interval
Fixes #1155
2023-03-07 17:06:35 -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
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
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
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
Viktor Söderqvist
10c78c6e17 Add possibility to prefer IPv6, IPv4 or unspecified 2022-09-01 10:42:36 -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
sundb
f2be748024
Fix integer overflow when format command larger than 4GB (#1030) 2021-12-22 10:45:52 -08:00
Bjorn Svensson
58aacdac65
Handle array response in parallell with pubsub using RESP3 (#1014)
RESP3 allows sending commands in parallell with pubsub handling
and these commands might get responded with a REDIS_REPLY_ARRAY.
This conflicts with the pubsub response handling for RESP2 and
results in a faulty state when using RESP3.

Add functionality to keep track of PUSH/RESP3 support on the connection
and only expect the message type REDIS_REPLY_PUSH as subscribe messages
when once seen.
2021-12-22 10:44:29 -08:00
michael-grunder
632bf07183 Merge branch 'release/v1.0.2' 2021-10-07 13:25:50 -07:00
michael-grunder
d4e6f109a0 Revert erroneous SONAME bump 2021-10-07 09:48:08 -07:00
michael-grunder
a39824a5df Merge branch 'release/v1.0.1'
Merge the v1.0.1 release branch and bump the dev version to 1.0.2-dev
2021-10-04 13:35:10 -07:00
michael-grunder
8d1bfac464 Prepare for v1.0.1 GA 2021-10-04 13:08:51 -07:00
Meir Shpilraien (Spielrein)
f5f31ff9b9
Added REDIS_NO_AUTO_FREE_REPLIES flag (#962)
When set hiredis will not automatically free replies in an async context, and the replies must be freed instead by the user.

Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
2021-07-11 11:26:20 -07:00
Alex Smith
83c1450425 read: Add support for the RESP3 bignum type 2021-02-25 21:25:17 -08:00
michael-grunder
bd6f86eb6b Fix sockaddr typo
Fixes #867
2020-08-20 17:58:23 -07:00
michael-grunder
d5b4c69b71 Prepare for v1.0.0 GA 2020-08-03 11:18:07 -07:00
michael-grunder
ea063b7cc8 Use development specific versions in master
Avoids issues like #860
2020-07-31 12:32:40 -07:00
michael-grunder
a853467542 Update notes preparing for v1.0.0-rc1 2020-07-29 13:39:28 -07:00
Michael Grunder
d8ff72387d
Move SSL management to a distinct private pointer. (#855)
We need to allow our users to use redisContext->privdata as context
for any RESP3 PUSH messages, which means we can't use it for managing
SSL connections.

Bulletpoints:

* Create a secondary redisContext member for internal use only called
  privctx and rename the redisContextFuncs->free_privdata accordingly.

* Adds a `free_privdata` function pointer so the user can tie allocated
  memory to the lifetime of a redisContext (like they can already do
  with redisAsyncContext)

* Enables SSL tests in .travis.yml
2020-07-29 11:53:03 -07:00
Michael Grunder
be32bcdc8e
Minor refactor for scheduling an async timer. (#854)
Small change to the logic introduced in #839
2020-07-26 13:03:42 -07:00
valentinogeron
38b5ae543f
add a command_timeout to redisContextOptions (#839)
Add an additional timeout so the user has a convenient way of controlling distinct connect and command timeouts
2020-07-26 12:32:27 -07:00
Michael Grunder
2e7d7cbabd
Resp3 oob push support (#841)
Proper support for RESP3 PUSH messages.

By default, PUSH messages are now intercepted and the reply memory freed.  
This means existing code should work unchanged when connecting to Redis
>= 6.0.0 even if `CLIENT TRACKING` were then enabled.

Additionally, we define two callbacks users can configure if they wish to handle
these messages in a custom way:

void redisPushFn(void *privdata, void *reply);
void redisAsyncPushFn(redisAsyncContext *ac, void *reply);

See #825
2020-07-19 18:54:42 -07:00
Michael Grunder
6448f735d5
sdsrange overflow fix (#830)
Fix overflow bug in `sdsrange`
2020-06-07 14:38:16 -07:00
Michael Grunder
5c9f49e212
Resp3 verbatim string support (#805)
Pull RESP3 verbatim string handling from Redis

Fixes #802
2020-05-19 12:56:02 -07:00
michael-grunder
139f966cc8 Bump version to 0.15.0 2020-02-28 11:04:52 -08:00
Michael Grunder
669ac9d0c8
Safe allocation wrappers (#754)
Create allocation wrappers with a configurable OOM handler (defaults to abort()).

See #752, #747
2020-01-28 12:13:05 -08:00
ShooterIT
386b9950f3 fix spelling mistakes 2020-01-01 14:42:10 +08:00
Yossi Gottlieb
5c85a04164 Use a const funcs in redisContext. 2019-09-01 13:46:07 +03:00
Yossi Gottlieb
8715ba5c82 wip: SSL code reorganization, see #705. 2019-08-29 22:09:37 +03:00
Mark Nunberg
ff4fa45422
Merge pull request #697 from yossigo/resp3
Port RESP3 support from Redis.
2019-08-27 06:59:32 -04:00
Marcus Geelnard
85fee25653 MinGW fix: Use _MSC_VER instead of _WIN32 where appropriate
Use _MSC_VER (instead of _WIN32) for things that are specific for
Visual Studio.

Also remove #include <winsock2.h> from hiredis.h, as it leaks too
many symbols and defines into the global namespace, which is
undesirable for a public interface header. Anyone who uses the
the affected parts of the hiredis API needs to include the
appropriate headers anyway in order to declare struct timeval
variables.
2019-08-09 11:49:02 +02:00
Yossi Gottlieb
91de9c975a RESP3 support changes from Redis.
This corresponds to commits d5c54f0b..bea09a7f in the redis repository.
2019-08-04 12:13:04 +03:00
jinjiazhang
cdb836d5f8 Fix Compile Error On Windows (Visual Studio) 2019-04-13 10:38:34 +08:00
m
dc6d19b9ec Port network layer to Winsock
With this change, Hiredis builds with MinGW and runs on Windows.
2019-04-01 11:54:37 +02:00
m
e84086cb92 Introduce a redisFD type
The redisFD type should be equal to the system native socket file
desciptor type (for POSIX, this is a plain int).

We also introduce the REDIS_INVALID_FD value, which maps to -1 on POSIX
systems.
2019-04-01 11:52:24 +02:00
Mark Nunberg
5eb6958870 Allow option for async connections to not automatically free 2019-02-21 11:49:25 -05:00
valentino
58222c26f4 Support SNI 2019-02-20 09:10:10 -05:00
Mark Nunberg
53d9b12b76 Fix bug in options macro 2019-02-20 09:10:10 -05:00
Mark Nunberg
e4a78006e7 Provide option-struct initialization
This reduces the boilerplate of all the redisConnectXXX functions, and
allows us to provide more connection options in the future.
2019-02-20 09:10:10 -05:00
Mark Nunberg
0c14544906 Initial SSL (sync) implementation 2019-02-20 09:10:10 -05:00
Mark Nunberg
49974c9359 Call connect(2) again for non-blocking connect
This retrieves the actual error which occurred, as getsockopt is not
always reliable in this regard.
2018-09-25 20:21:37 -04:00
Tom Lee
29c82b728c Prepare for the 0.14.0 release
SONAME bumped to 0.14 because we've broken ABI compatibility with 0.13.x
2018-09-25 15:48:07 -07:00