Commit Graph

803 Commits

Author SHA1 Message Date
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
ShooterIT 386b9950f3 fix spelling mistakes 2020-01-01 14:42:10 +08:00
Michael Grunder c96d492215
Merge pull request #741 from redis/redisgetreply-null
Free the reply in redisGetReply when passed NULL
2019-12-18 13:45:01 -08:00
michael-grunder ac0b186aa3 Free the reply in redisGetReply when passed NULL
We currently perform a NULL check in redisGetReply and don't push the
reply back to the caller, but we don't free any reply meaning that this
will leak memory:

redisGetReply(context, NULL);

This change simply frees the reply if we were passed NULL.

Addresses #740
2019-12-12 14:40:50 -08:00
Michael Grunder b2d1ad64d0
Merge pull request #727 from pbotros/botros/disable-tests-cmake
Adding an option to DISABLE_TESTS
2019-12-05 17:06:44 -08:00
Michael Grunder f2ef5f0c98
Merge pull request #737 from natoscott/master
Fix dead code in sslLogCallback relating to should_log variable.
2019-11-25 17:01:12 -08:00
Nathan Scott 42697bd45a Fix dead code in sslLogCallback relating to should_log variable.
Coverity scans found that the should_log logic in sslLogCallback
is not working as expected because the variable is not correctly
initialised (the conditional code before logging always sets the
value to 1, which it already is).
2019-11-25 15:21:05 +11:00
Michael Grunder 5d0568d9ae
Merge pull request #731 from Kevin-Xi/patch-1
Fix typo in dict.c.
2019-11-19 11:11:46 -08:00
Kevin e58a9f7d52
Fix typo in dict.c. 2019-11-20 00:00:00 +08:00
Paul Botros f052fd1add Adding an option to DISABLE_TESTS
Useful when hiredis is used as a CMake dependency in other projects and
added via add_subdirectory(). With DISABLE_TESTS on, `make test` in the
parent project won't run hiredis tests.
2019-11-03 22:01:28 -08:00
michael-grunder e777b0295e Use correct flag in README.md 2019-10-10 15:46:33 -07:00
Michael Grunder 42a2e679be
Merge pull request #720 from yossigo/ssl-docs
Update README with SSL support.
2019-10-10 14:54:01 -07:00
Michael Grunder 18eeeed076
Merge pull request #715 from redis/test-leaks
Fixes leaks in unit tests
2019-10-08 10:55:15 -07:00
Yossi Gottlieb c5726ba5f7 Update README with SSL support. 2019-10-07 13:23:59 +03:00
michael-grunder 5aa7b1056b Fixes leaks in unit tests
redisFormatSdsCommandArgv takes an sds* and calls sdsempty() for us.

Addresses #714
2019-09-25 11:02:44 -07:00