Commit Graph

696 Commits

Author SHA1 Message Date
m
e38cd75562 CMake: Minor modernization
Rely more on transitive dependencies, as provided by
TARGET_LINK_LIBRARIES. Avoid using ADD_DEFINITIONS and
INCLUDE_DIRECTORIES. This avoids leakage/pollution of defines and
includes.
2019-04-01 11:54:37 +02: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
1d092a235a Use recv/send instead of read/write
The recv/send calls are more portable than read/write, since unlike the
latter, the former work with Windows sockets.

We also check for EWOULDBLOCK instead of EAGAIN. On most Unices, EAGAIN
and EWOULDBLBOCK are the same thing. However, on Windows they are
different, and send/recv are expected to give EWOULDBLOCK for
non-blocking sockets.
2019-04-01 11:52:24 +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
m
1788f41f16 Move network I/O calls to net.c
This makes hiredis.c free from system calls related to socket I/O. This
is also makes the treatment of raw socket connections more similar to
the SSL backend.
2019-04-01 11:52:24 +02:00
Mark Nunberg
1c43a3823f
Merge pull request #653 from michael-grunder/bad-domain-test-fix
Fix NXDOMAIN test case
2019-03-31 20:35:33 -04:00
michael-grunder
afcc11cc5a Fix NXDOMAIN test case
As it turns out 'idontexist.com' actually does exist.
2019-03-31 13:46:05 -07:00
Mark Nunberg
17b4174089 Retain the same semantics for connection error on connection timeout
This ensures that a disconnect occurs.

This commit also ensures that disconnects will clean the socket even if
the user is in no-auto-free mode
2019-03-11 09:20:21 -04:00
Mark Nunberg
297de989a6
Merge pull request #645 from redis/ssl
SSL Support
2019-02-21 13:05:58 -05:00
Mark Nunberg
ffceb87ec3 SSL: build in travis 2019-02-21 12:09:17 -05:00
Mark Nunberg
792bdbab7e cmake: ssl disabled by default 2019-02-21 12:04:53 -05:00
Mark Nunberg
5eb6958870 Allow option for async connections to not automatically free 2019-02-21 11:49:25 -05:00
Mark Nunberg
1ec4aefba6 Fix ifeq condition (thanks @regae) 2019-02-21 06:21:53 -05:00
Mark Nunberg
3949c8a153 Disable SSL by default 2019-02-20 09:11:10 -05:00
Mark Nunberg
3511c8df68 gitignore: dSYM 2019-02-20 09:11:10 -05:00
Mark Nunberg
4b90429640 Remove redundant line after rebase 2019-02-20 09:11:10 -05:00
valentino
d9e0299f1c fix redisLibeventEvents init 2019-02-20 09:11:10 -05:00
valentino
271f33953f fix pkg config 2019-02-20 09:11:10 -05:00
Mark Nunberg
ea9f9d2515 fixed wrong memset args 2019-02-20 09:11:10 -05:00
Mark Nunberg
f0a7595056 libevent: call destroy from cleanup
also, indentation fix
2019-02-20 09:11:10 -05:00
Mark Nunberg
1eb44cf0c4 scrub redisContext before freeing
This helps us detect use-after-free
2019-02-20 09:11:10 -05:00
Mark Nunberg
f60c5506fe Add EV_PERSIST flag to read events
This will avoid the need to constantly reschedule the event
2019-02-20 09:11:10 -05:00
Mark Nunberg
24e6166fed libevent: fix invalid mem access on delete within callback enter 2019-02-20 09:11:10 -05:00
Mark Nunberg
5f633ac4ec fix potential uninitialized read
If callback was set before scheduleTimer was set (i..e before one of the
attach()) calls.
2019-02-20 09:11:10 -05:00
Mark Nunberg
0bc2356ed5 CMake: update for SSL 2019-02-20 09:11:10 -05:00
valentino
847a20122f Fix memory leaks 2019-02-20 09:10:10 -05:00
valentino
58222c26f4 Support SNI 2019-02-20 09:10:10 -05:00
valentino
389e694abe Fix compilation on Ubuntu 2019-02-20 09:10:10 -05:00
Mark Nunberg
3a547b8ec0 Unix: set addrlen so async reconnect uses proper size 2019-02-20 09:10:10 -05:00
Mark Nunberg
f51363a70c Don't warn on missing field initializers 2019-02-20 09:10:10 -05:00
Mark Nunberg
f4f6b6d65c minor fixes: initialize options struct with 0 always
also, clean up redisContextInit -- we're just zeoring the struct
2019-02-20 09:10:10 -05:00
Mark Nunberg
7b705936f6 libevent-example: Use timeout 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
deba8d956d Allow connectWithOptions for async as well 2019-02-20 09:10:10 -05:00
Mark Nunberg
35a0a1f369 read/write timeouts 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
d329cc952a Use SSL by default 2019-02-20 09:10:10 -05:00
Mark Nunberg
4127e4488b Don't add dead code for HIREDIS_NOSSL
We changed this to `HIREDIS_SSL`
2019-02-20 09:10:10 -05:00
Mark Nunberg
bc2a8f372a Minor SSL-related fixes 2019-02-20 09:10:10 -05:00
Mark Nunberg
82549a53de Disable SSL by default 2019-02-20 09:10:10 -05:00
Mark Nunberg
08efa46599 SSL for async I/O 2019-02-20 09:10:10 -05:00
Mark Nunberg
ba947bc93c Add SSL example 2019-02-20 09:10:10 -05:00
Mark Nunberg
5f50eb4131 Remove extra printfs 2019-02-20 09:10:10 -05:00
Mark Nunberg
0c14544906 Initial SSL (sync) implementation 2019-02-20 09:10:10 -05:00
Justin Brewer
4d00404b8f Update appveyor.yml to cmake
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2019-02-20 05:01:09 -05:00
Justin Brewer
93261d465f Update .travis-ci.yml to use cmake
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2019-02-20 05:01:09 -05:00
Justin Brewer
ebe1657c8f Obey HIREDIS_SONAME for shared library
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2019-02-20 05:01:09 -05:00
Justin Brewer
7d38176bdb Call project() with parsed version string
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2019-02-20 05:01:09 -05:00
Justin Brewer
58d0e28333 Enable make test
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2019-02-20 05:01:09 -05:00
Justin Brewer
9ea7ddec0c Generate and install hiredis.pc
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2019-02-20 05:01:09 -05:00