Age | Commit message (Collapse) | Author |
|
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.
|
|
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
|
|
redisFormatSdsCommandArgv takes an sds* and calls sdsempty() for us.
Addresses #714
|
|
This repeats all existing tests in SSL mode, but does not yet provide
SSL-specific tests.
|
|
|
|
This makes the tests pass on musl[1] based distros like Alpine Linux.
[1]: https://www.musl-libc.org/
|
|
As it turns out 'idontexist.com' actually does exist.
|
|
|
|
Some ISPs like to inject their own "Suggestions" page whenever you hit
NXDOMAIN. This confuses Redis as well as addrinfo (black-holing the
route).
|
|
This makes createArray consistent with createString, which also takes
size_t. Bounds-check and unit tests are updated to allow up to
min(SIZE_MAX,LLONG_MAX).
Changelog is updated to mention this API break.
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
|
|
|
|
|
|
processMultiBulkItem truncates the value read from readLongLong,
resulting in a corrupted state when the next item is read.
createArray takes an int, so bound to INT_MAX.
Inspection showed that processBulkItem had the same truncation issue.
createString takes size_t, so bound to SIZE_MAX. This only has an
effect on 32-bit platforms.
A strict lower bound is also added, since negative lengths other
than -1 are invalid according to RESP.
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
|
|
Badly formatted or out-of-range integers are now protocol errors.
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
|
|
|
|
Fix potential race in 'invalid timeout' tests
It's possible for the call to connect() to succeed on the very first try, in which case the logic for checking for invalid timeout fields is never executed. When this happens, the tests fail because they expect a REDIS_ERR_IO but no such failure has occurred.
Tests aside, this is a potential source of irritating and hard-to-find intermittent bugs.
This patch forces the validation to occur early so that we get predictable behavior whenever an invalid timeout is specified.
|
|
- fix macro problem in mingw-gcc
- fix typedef in cygwin
|
|
|
|
It's possible for the call to connect() to succeed on the very first
try, in which case the logic for checking for invalid timeout fields is
never executed. When this happens, the tests fail because they expect a
REDIS_ERR_IO but no such failure has occurred.
Tests aside, this is a potential source of irritating and hard-to-find
intermittent bugs.
This patch forces the validation to occur early so that we get
predictable behavior whenever an invalid timeout is specified.
|
|
|
|
Originally implemented by @abedra as part of #306.
In case a write or read times out, we force an error state, because we
can't guarantuee that the next read will get the right data.
Instead we need to reconnect to have a clean-state connection, which is
now easily possible with this method.
|
|
|
|
Closes #309
(such as when -DNDEBUG disables all assert() macros)
Inspired by keith-bennett-gbg, but re-rewritten to be more concise.
|
|
|
|
Suggested at
https://github.com/redis/hiredis/issues/294#issuecomment-69153074
This change also makes the test stop hanging for 10 to 30 seconds
waiting for the resolver to timeout. Now the resolver immediately
sees the hostname is bad and returns error without waiting for timeout.
|
|
Fixes #294
|
|
Test that redisFree() and freeReplyObject() do not crash when NULL is
passed in.
|
|
Closes #202
|
|
Closes #186
|
|
These allows for easier integration of hiredis with external
code that wants to manage its fds, say for instance in a pool.
Closes #223
|
|
Closes #121.
|
|
|
|
See pull request #153.
|
|
|
|
Closes #154
This commit properly sets the error value inside of
redisContextWaitReady when an invalid sec or usec value is provided.
Tests for each case are provided to demonstrate that the issue is
properly fixed and to avoid regression.
Signed-off-by: Aaron Bedra <aaron@aaronbedra.com>
|
|
Add strings to allow OpenBSD/OSX to pass.
|
|
Updated documentation and examples accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
There is no way we can guess the width of the argument when we cannot
infer its type from the format specifier.
|
|
|
|
This reverts commit 77540aa31694aa1e14d41f60a0452e49a2fed86a. The change
in buffer strategy is too large to put in a minor release. It is put in
a separate branch in the meantime, so it can be refined and released
together with a minor version bump.
|
|
|
|
|
|
|
|
|
|
|