Commit Graph

725 Commits

Author SHA1 Message Date
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
Mark Nunberg 3af99d5fd5
Merge pull request #597 from justinbrewer/createArray-size_t
Update createArray to take size_t
2019-08-09 04:03:02 -04:00
Mark Nunberg f9bccfb7ba
Merge branch 'master' into createArray-size_t 2019-08-09 04:02:53 -04:00
Mark Nunberg 5d013039a9
Merge pull request #621 from Crunsher/master
Update README.md
2019-08-09 03:54:24 -04:00
Mark Nunberg fe215464ca
Merge pull request #662 from dragonation/master
The setsockopt and getsockopt API diffs from BSD socket and WSA one
2019-08-09 03:52:06 -04:00
Mark Nunberg b1fa77d023
Merge pull request #665 from ghost/musl-test-compat
test: fix errstr matching for musl libc
2019-08-09 03:48:56 -04:00
Mark Nunberg 99cdec371f
Merge pull request #671 from movebean/master
redisReaderGetReply leak memory
2019-08-09 03:44:25 -04:00
Mark Nunberg fbb83c4a7a
Merge pull request #684 from qlyoung/remove-unnecessary-nullcheck
Remove unnecessary null check before free
2019-08-09 03:40:32 -04:00
Mark Nunberg 9414207002
Merge pull request #688 from kevin1018/patch-1
Add install adapters header files
2019-08-09 03:40:05 -04:00
Mark Nunberg c259f9059d
Merge pull request #691 from Miniwoffer/master
Removed whitespace before newline
2019-08-09 03:39:39 -04:00
Odin Hultgren Van Der Horst a1d4da63b8 Removed whitespace before newline
- Removed whitespace before newline
 - Removed win style newline
2019-07-22 11:06:10 +02:00
kevin1018 8249e67355
Add install adapters header files 2019-07-17 19:05:06 +08:00
Quentin Young 83d3c097ef Remove unnecessary null check before free 2019-07-03 21:36:48 +00:00
qi.yang 918e24c83b redisReaderGetReply leak memory 2019-05-30 15:03:38 +08:00
Eivind Uggedal 993af7710e test: fix errstr matching for musl libc
This makes the tests pass on musl[1] based distros like Alpine Linux.

[1]: https://www.musl-libc.org/
2019-05-14 07:29:26 +00:00
Minun Dragonation 76394f1be8 remove useless type casting 2019-05-13 23:20:05 +08:00
Minun Dragonation f5454d509f fix bugs on socket timeout tv usec calculation 2019-05-05 21:58:34 +08:00
Minun Dragonation 4a94ce6326 fix bugs for optlen output on size not big enough for timeout events 2019-05-05 21:46:34 +08:00
Minun Dragonation 82252440de fix bugs on ref address incorrect on sockcompact with getsockopt 2019-05-05 21:39:46 +08:00
Minun Dragonation d8f814d48b fix bugs of setsockopt diff in win compact implementation 2019-05-05 21:34:28 +08:00
Mark Nunberg f5f855c912
Merge pull request #658 from jinjiazhang/master
Fix Compile Error On Windows (Visual Studio)
2019-04-13 09:16:46 -04:00
jinjiazhang cdb836d5f8 Fix Compile Error On Windows (Visual Studio) 2019-04-13 10:38:34 +08:00
Mark Nunberg 5aa2397f9e fix blocking timeouts on SSL reads/writes 2019-04-11 15:08:27 -04:00
Mark Nunberg dc3c6ce85c build ssl example if ssl is enabled 2019-04-10 08:36:34 -04:00
Mark Nunberg 4830786c84 ensure that blocking timeout is set 2019-04-10 08:36:06 -04:00
Mark Nunberg ca153fa4a8
Merge pull request #652 from mbitsnbites/mingw-support
Add MinGW support
2019-04-02 01:17:11 -04:00
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