Commit Graph

817 Commits

Author SHA1 Message Date
Michael Grunder
8966a1fc2b
Remove extra whitespace (#858) 2020-07-30 16:55:48 -07:00
lijiageng
34b7f7a0ff
Keep libev's code style (#857) 2020-07-30 10:59:19 -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
3bb985314d Fix a static analysis false positive
Static analyzer's can't tell that hi_calloc is calloc-like, and report a
potential null pointer dereference.  This isn't possible but it's
probably smarter to make the test anyway in the event code changes.
2020-07-21 15:39:40 -07:00
Michael Grunder
18fc12c392
Move include to sockcompat.h to maintain style (#850)
See #848
2020-07-20 16:27:28 -07:00
Malizia R
43aeabbbee
fix windows compiling with mingw (#848) 2020-07-20 15:34:52 -07:00
Michael Grunder
5a3c324138
Remove erroneous tag and add license to push example (#849) 2020-07-19 21:47:28 -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
1864e76ea7
Some Windows quality of life improvments. (#846)
* Don't try to ignore SIGPIPE in Windows (it doesn't exist).
* Add an include to our win32.h compatibility header.
* Enable building examples on Travis in Windows.

See #831
2020-07-10 12:53:52 -07:00
Michael Grunder
ada3665279
Use _WIN32 define instead of WIN32 (#845)
It appears that _WIN32 is always defined by MSVC whereas WIN32 may not
be, depending on configuration.
2020-07-08 17:44:30 -07:00
Michael Grunder
08593db1f2
Non Linux CI fixes (#844)
* Switch to memurai for Windows tests

* Switch to macports from brew.
2020-07-08 17:06:30 -07:00
OmriSteiner
392de5d7f9
fix #785: defer TCP_NODELAY in async tcp connections (#836)
Co-authored-by: Omri Steiner <omri@insoundz.com>
2020-06-22 13:20:30 -07:00
valentinogeron
a28de70a01
timeout option in redisConnectWithOptions should be on connect only (#829)
When connecting with a timeout, we shouldn't also call `redisSetTimeout` which will implement a timeout for commands.

See related issue #722
2020-06-18 21:45:25 -07:00
Michael Grunder
6448f735d5
sdsrange overflow fix (#830)
Fix overflow bug in `sdsrange`
2020-06-07 14:38:16 -07:00
Aureus
c726723545
Use explicit pointer casting for c++ compatibility (#826) 2020-06-01 15:21:27 -07:00
michael-grunder
4152bfce7c Merge branch 'new-ssl-api' 2020-05-30 11:50:59 -07:00
michael-grunder
904bf7fe00 Tiny OOM fix 2020-05-30 11:03:45 -07:00
michael-grunder
ffd6eaebd6 Merge branch 'master' into new-ssl-api 2020-05-30 09:30:01 -07:00
Michael Grunder
e553e0f382
Document allocator injection and completeness fix in test.c (#824) 2020-05-26 10:06:28 -07:00
Michael Grunder
f5d2585043
Use unique names for allocator struct members (#823)
Using `strdup` as a struct member causes issues in older gcc
2020-05-25 12:17:43 -07:00
Yossi Gottlieb
190bca88d0 New SSL API to replace redisSecureConnection(). 2020-05-24 23:37:47 +03:00
Michael Grunder
8e0264cfd6
Allow users to replace allocator and handle OOM everywhere. (#800)
* Adds an indirection to every allocation/deallocation to allow users to 
  plug in ones of their choosing (use custom functions, jemalloc, etc).

* Gracefully handle OOM everywhere in hiredis.  This should make it possible
  for users of the library to have more flexibility in how they handle such situations.

* Changes `redisReaderTask->elements` from an `int` to a `long long` to prevent
  a possible overflow when transferring the task elements into a `redisReply`.

* Adds a configurable `max elements` member to `redisReader` that defaults to
  2^32 - 1.  This can be set to "unlimited" by setting the value to zero.
2020-05-22 09:27:49 -07:00
Michael Grunder
83bba659b9
Add logic to handle RESP3 push messages (#819)
Fixes #815
2020-05-21 11:12:18 -07:00
Muhammad Zahalqa
c8999c6602
Use standrad isxdigit instead of custom helper function. (#814)
Standard function available and on most platforms uses a lookup table and not
a check with 3 ranges.
2020-05-20 09:35:15 -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
Yossi Gottlieb
243099ccd2
Fix missing SSL build/install options. (#812)
* Fix missing SSL build/install options.

* Use different build commands for non-Linux linkers.
* Add missing install targets.

Fixes #809
2020-05-19 10:13:32 -07:00
Michael Grunder
a6a824cb65
Add link to ABI tracker (#808)
Addresses #506
2020-05-16 12:15:26 -07:00
Michael Grunder
eafb085d11
Remove nested depth limitation. (#797)
* Remove nested depth limitation.

This commit removes the nested multi-bulk depth limitation of 7.
We do this by switching to pointer to pointer indirection and
growing the stack in chunks when needed.

See: #794, #421
2020-05-04 10:36:04 -07:00
Michael Grunder
994d2fd77d
Support timeouts in libev adapater (#795)
Add support for timeouts in our libev adapter.

See #795
2020-05-04 10:35:30 -07:00
Michael Grunder
2cb203c1e9
Attempt to fix compilation on Solaris (#796)
See #757
2020-04-23 14:15:59 -07:00
Michael Grunder
7e2ee7c38b
Fix pkgconfig when installing to a custom lib dir (#793)
* Respect overridden libdir in CMake

See: #767
2020-04-23 11:11:55 -07:00
Michael Grunder
b484021859
Fix USE_SSL=1 make/cmake on OSX and CMake tests (#789)
* Fix linker problems when building with SSL enabled on OSX
* Corrects `HIREDIS_SSL=ON` to `USE_SSL=ON` so we test building with
  SSL enabled on travis.
2020-04-13 09:32:32 -07:00
Nick Rivera
0184caac9d
Provides an optional cleanup callback for async data. 2020-04-09 20:23:06 -07:00
Michael Grunder
a5613f3f7f
Use correct libuv call on Windows (#784)
Explicitly call `uv_poll_init_socket` as that has slightly different semantics on Windows (and is identical to `uv_poll_init` on Linux).

http://docs.libuv.org/en/v1.x/poll.html#c.uv_poll_init_socket
2020-04-09 12:39:49 -07:00
Michael Grunder
ec08c2b94a
Added CMake package config and fixed hiredis_ssl on Windows (#783)
* Add CMake package configuration so hiredis can be more easily included in 
  other projects.

* Fixes hiredis_ssl such that it compiles and works in windows

Co-authored-by: nrivera <nrivera@blizzard.com>
Co-authored-by: Nick <heronr1@gmail.com>
2020-04-09 08:05:14 -07:00
Michael Grunder
b314c0df3d
Merge pull request #780 from yossigo/fix/cmake_ssl_so_version
CMake: Set hiredis_ssl shared object version.
2020-04-07 12:04:39 -07:00
Yossi Gottlieb
1b967bc947 CMake: Set hiredis_ssl shared object version. 2020-04-07 21:19:00 +03:00
Michael Grunder
cc9d032971
Win32 tests and timeout fix (#776)
Unit tests in Windows and a Windows timeout fix

This commit gets our unit tests compiling and running on Windows as well as removes a duplicated `timeval` -> `DWORD` conversion logic in sockcompat.c 

There are minor differences in behavior between Linux and Windows to note:

1.  In Windows, opening a non-existent hangs forever in WSAPoll whereas
    it correctly returns with a "Connection refused" error on Linux.
    For that reason, I simply skip this test in Windows.

    It may be related to this known issue:
    https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/

2.  Timeouts are handled slightly differently in Windows and Linux.  
    In Linux, we intentionally set REDIS_ERR_IO for connection
    timeouts whereas in Windows we set REDIS_ERR_TIMEOUT.  It may be
    prudent to fix this discrepancy although there are almost certainly
    users relying on the current behavior.
2020-04-02 22:41:34 -07:00
michael-grunder
ec18d790f1 Const correctness
Fixes #778
2020-04-02 11:38:04 -07:00
michael-grunder
a1405e172a Add release pattern for automatic CI 2020-03-14 15:09:37 -07:00
michael-grunder
d57067564e Actually define include guard 2020-03-13 10:57:06 -07:00
michael-grunder
139f966cc8 Bump version to 0.15.0 2020-02-28 11:04:52 -08:00
Michael Grunder
38675d23cc
Housekeeping fixes (#764)
Housekeeping

* Check for C++ (#758, #750) 
* Include `alloc.h` in `make install` and `cmake`
* Add a `.def` file for Windows (#760)
* Include allocation wrappers referenced in adapter headers
* Fix minor syntax errors and typos in README
* Fix CI in Windows by properly escaping arguments (#761)
2020-02-27 21:29:05 -08:00
Michael Grunder
3421ac3093
Merge pull request #756 from ch1aki/fix-make-install
install alloc.h
2020-01-29 01:00:14 -08:00
akichan
3ae4739799 install alloc.h
alloc.h added in # 754
But not added to INSTALL_INCLUDE_PATH
2020-01-29 17:26:34 +09: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
Michael Grunder
0501c623c9
Merge pull request #746 from ShooterIT/spelling
fix spelling mistakes
2020-01-01 00:43:30 -08:00