Commit Graph

157 Commits (cfb6ca881132f7d44121935f55493e144511fbb6)

Author SHA1 Message Date
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
Justin Brewer d1c1b668c1 Drop __redis_strerror_r
Since _GNU_SOURCE is now guaranteed to be unset, it is no longer
necessary to support the GNU-specific version of strerror_r.

Drop __redis_strerror_r from the header, and call strerror_r directly.
This breaks any external users of this macro, but they shouldn't have
been using it in  the first place.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30 21:45:13 -05:00
Ichito Nagata 2ec7740c3a suppress gcc complaint 2017-03-22 17:03:52 +09:00
Donald Whyte 41b07dab5e Remove trailing comma in redisConnectionType enum
Remove trailing comma in last value of `redisConnectionType` enum. This causes a compiler warning on Solaris compilers. I'd like to build this on Solaris with `-Werror`. However, due to the trailing comma, I cannot do that.

This PR removes the trailing comma, which should prevent it causing compiler warnings on any architecture.
2016-10-25 09:25:24 +01:00
Jan-Erik Rediger 97ac0d1f50 fix: Change string length type to size_t 2016-04-20 17:00:14 +02:00
not-a-robot 36bddcf6ed Auto merge of #391 - redis:catch-error-buf-overflow, r=badboy
Prevent buffer overflow when formatting the error

strncat might copy n+1 bytes (n bytes from the source plus a terminating nul byte).
Also strncat appends after the first found nul byte. But all we pass is
a buffer we might not have zeroed out already.

Closes #380
2016-04-20 15:31:23 +02:00
Jan-Erik Rediger 0335cb3e98 Prevent buffer overflow when formatting the error
strncat might copy n+1 bytes (n bytes from the source plus a terminating nul byte).
Also strncat appends after the first found nul byte. But all we pass is
a buffer we might not have zeroed out already.

Closes #380
2015-11-18 14:37:47 +01:00
charsyam e2f6ee239c fixing typos 2015-10-28 02:19:24 +09:00
Jan-Erik Rediger 010756025e Release version 0.13.3 2015-09-16 12:25:02 +02:00
Jan-Erik Rediger 53c32439bf Release version 0.13.2 2015-08-25 14:16:20 +02:00
Jan-Erik Rediger 9644a96a48 Use stable soname version 2015-07-27 22:14:03 +02:00
Jan-Erik Rediger f58dd249d6 Release version 0.13.1 2015-05-03 22:58:11 +02:00