1. 22 Dec, 2021 1 commit
    • Bjorn Svensson's avatar
      Handle array response in parallell with pubsub using RESP3 (#1014) · 58aacdac
      Bjorn Svensson authored
      RESP3 allows sending commands in parallell with pubsub handling
      and these commands might get responded with a REDIS_REPLY_ARRAY.
      This conflicts with the pubsub response handling for RESP2 and
      results in a faulty state when using RESP3.
      
      Add functionality to keep track of PUSH/RESP3 support on the connection
      and only expect the message type REDIS_REPLY_PUSH as subscribe messages
      when once seen.
      58aacdac
  2. 16 Dec, 2021 1 commit
    • Bjorn Svensson's avatar
      Support PING while subscribing (RESP2) (#1027) · d3384260
      Bjorn Svensson authored
      * Handle PING during pubsub in RESP2
      
      * Rename invalid callback list
      
      Some commands are valid to send during a subscribe in RESP2, and
      most in RESP3. Renaming the callback list from `invalid` to `replies`
      to detail this fact.
      
      * Fix review comment
      d3384260
  3. 01 Dec, 2021 1 commit
    • Bjorn Svensson's avatar
      Add asynchronous test for pubsub using RESP3 (#1012) · da5a4ff3
      Bjorn Svensson authored
      * Include `unsubscribe` as a subscribe reply in RESP3
      
      By providing the (p)unsubscribe message via the subscribe callback,
      instead of via the push callback, we get the same behavior in RESP3
      as in RESP2.
      
      * Add asynchronous test for pubsub using RESP3
      
      The testcase will subscribe to a channel, and via a second client
      a message is published to the channel. After receiving the message
      the testcase will unsubscribe and disconnect.
      
      This RESP3 testcase reuses the subscribe callback from the RESP2
      testcase to make sure we have a common behavior.
      da5a4ff3
  4. 11 Jul, 2021 1 commit
  5. 17 Jun, 2021 1 commit
  6. 08 Apr, 2021 1 commit
  7. 26 Jan, 2021 1 commit
  8. 25 Jan, 2021 1 commit
    • Bjorn Svensson's avatar
      Stack allocate dict iterators · 920128a2
      Bjorn Svensson authored
      Replacing the get & release functions with an initiation
      function. Simplifies the code and will make sure we
      run subscription callbacks in OOM scenarios.
      920128a2
  9. 23 Sep, 2020 1 commit
  10. 31 Jul, 2020 1 commit
  11. 26 Jul, 2020 1 commit
  12. 20 Jul, 2020 1 commit
    • Michael Grunder's avatar
      Resp3 oob push support (#841) · 2e7d7cba
      Michael Grunder authored
      Proper support for RESP3 PUSH messages.
      
      By default, PUSH messages are now intercepted and the reply memory freed.  
      This means existing code should work unchanged when connecting to Redis
      >= 6.0.0 even if `CLIENT TRACKING` were then enabled.
      
      Additionally, we define two callbacks users can configure if they wish to handle
      these messages in a custom way:
      
      void redisPushFn(void *privdata, void *reply);
      void redisAsyncPushFn(redisAsyncContext *ac, void *reply);
      
      See #825
      2e7d7cba
  13. 22 Jun, 2020 1 commit
  14. 22 May, 2020 1 commit
    • Michael Grunder's avatar
      Allow users to replace allocator and handle OOM everywhere. (#800) · 8e0264cf
      Michael Grunder authored
      * 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.
      8e0264cf
  15. 21 May, 2020 1 commit
  16. 10 Apr, 2020 1 commit
  17. 28 Jan, 2020 1 commit
  18. 29 Aug, 2019 1 commit
  19. 09 Aug, 2019 1 commit
    • Marcus Geelnard's avatar
      MinGW fix: Use _MSC_VER instead of _WIN32 where appropriate · 85fee256
      Marcus Geelnard authored
      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.
      85fee256
  20. 22 Jul, 2019 1 commit
  21. 13 Apr, 2019 1 commit
  22. 11 Mar, 2019 1 commit
  23. 21 Feb, 2019 1 commit
  24. 20 Feb, 2019 5 commits
  25. 26 Sep, 2018 2 commits
  26. 15 Jun, 2017 1 commit
  27. 15 May, 2017 1 commit
  28. 30 Jan, 2017 2 commits
  29. 29 Sep, 2016 1 commit
  30. 27 Oct, 2015 1 commit
  31. 27 Jul, 2015 1 commit
  32. 28 Apr, 2015 1 commit
    • antirez's avatar
      Fix memory leak in async spontaneous reply handling · 2fc39eb4
      antirez authored
      When an asynchronous hiredis connection subscribes to a Pub/Sub channel
      and gets an error, and in other related conditions, the function
      redisProcessCallbacks() enters a code path where the link is
      disconnected, however the function returns before freeing the allocated
      reply object. This causes a memory leak. The memory leak was trivial to
      trigger in Redis Sentinel, which uses hiredis, every time we tried to
      subscribe to an instance that required a password, in case the Sentinel
      was configured either with the wrong password or without password at
      all. In this case, the -AUTH error caused the leaking code path to be
      executed.
      2fc39eb4
  33. 05 Jan, 2015 2 commits
    • Matt Stancliff's avatar
      Fix redisAppendCommand error result · 6a00a464
      Matt Stancliff authored
      Previously, redisvAppendCommand() would return OOM even with formatting
      errors.  Now we use OTHER with an error string telling the user the
      error was formatting related, not memory related.
      
      This also fixes a potentially worse bug where were would pass error result
      of -1 as an actual length to another function taking an unsigned length,
      which would result in crash/overallocation/errors.  Now for that case,
      we just return an error immediately and stop processing the command.
      
      Fixes #177
      6a00a464
    • Matt Stancliff's avatar
      Fix clang analyzer warning · 9b83ddc2
      Matt Stancliff authored
      redisAsyncInitialize() can return NULL, but then we pass
      the return value from redisAsyncInitialize() into something
      dereferencing the return value, which can cause crashies.
      9b83ddc2