Commit Graph

832 Commits

Author SHA1 Message Date
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
Mark Nunberg
0153527444
Merge pull request #711 from yossigo/ssl-tests
SSL Tests
2019-09-16 10:43:53 -04:00
Yossi Gottlieb
d952ed877a Add SSL mode tests.
This repeats all existing tests in SSL mode, but does not yet provide
SSL-specific tests.
2019-09-16 17:30:35 +03:00
Yossi Gottlieb
a1e538092d Make SSL timeout error compatible with rest. 2019-09-16 17:30:35 +03:00
Yossi Gottlieb
d41443bd3d Fix: redisReconnect() should clear SSL context.
We should not attempt to keep the context and re-establish the
TLS connection for several reasons:

1. Maintain symmetry between redisConnect() and redisReconnect(), so in
both cases an extra step is required to initiate SSL.
2. The caller may also wish to reconfigure the SSL session and needs a
chance to do that.
3. It is not a practical thing to do on an async non-blocking connection
context.
2019-09-16 17:30:35 +03:00
Mark Nunberg
bd2c8fedf7
Merge pull request #708 from yossigo/wip/ssl-reorganization
SSL Reorganization
2019-09-16 06:05:46 -04:00
Yossi Gottlieb
dd408e8e3f Update CMakelists for hiredis/hiredis_ssl builds.
Also rename the SSL option from `HIREDIS_SSL` to `ENABLE_SSL` to conform
with CMake convnetions.
2019-09-01 13:47:39 +03:00
Yossi Gottlieb
5872d818d9 Separate hiredis and hiredis_ssl library build. 2019-09-01 13:46:27 +03:00
Yossi Gottlieb
5c85a04164 Use a const funcs in redisContext. 2019-09-01 13:46:07 +03:00
Yossi Gottlieb
44ef4de9d9 Update CMakeLists with sslio.c rename. 2019-08-29 22:21:40 +03:00
Yossi Gottlieb
df68d7d8bd Rename sslio. 2019-08-29 22:14:09 +03:00
Yossi Gottlieb
8715ba5c82 wip: SSL code reorganization, see #705. 2019-08-29 22:09:37 +03:00
Mark Nunberg
1ac8fca35d
Merge pull request #706 from yossigo/fix/msvc
Fix MSVC build.
2019-08-29 10:14:34 -04:00
Yossi Gottlieb
28759c4b81 Fix MSVC build. 2019-08-28 18:43:40 +03:00
Mark Nunberg
2020f6f329
Merge pull request #702 from yossigo/report-connect-errors
SSL: Properly report SSL_connect() errors.
2019-08-27 07:10:25 -04:00
Mark Nunberg
ff4fa45422
Merge pull request #697 from yossigo/resp3
Port RESP3 support from Redis.
2019-08-27 06:59:32 -04:00
Mark Nunberg
ce7cb7bcc4
Merge pull request #699 from yossigo/silent-ssl-trace
Silent SSL trace to stdout by default.
2019-08-27 06:58:55 -04:00
Yossi Gottlieb
aacd4ccd76 Fix typo. 2019-08-25 11:43:27 +03:00
Yossi Gottlieb
153b8f632b SSL: Properly report SSL_connect() errors. 2019-08-22 16:20:41 +03:00
Mark Nunberg
9c7c694cb7
Merge pull request #670 from jman-krafton/master
fix timeout code in windows
2019-08-13 08:50:41 -04:00
Yossi Gottlieb
6d21ffce7c Silent SSL trace to stdout by default. 2019-08-13 12:51:47 +03:00
Sangmoon Yi
8e61d5737a add recv error code for clarifying timeout 2019-08-12 10:55:08 +09:00