1. 31 Jan, 2024 2 commits
    • git-hulk's avatar
      Fix review comments · ab30060a
      git-hulk authored
      ab30060a
    • git-hulk's avatar
      Add support of RESP3 attribute type · 5b253d89
      git-hulk authored
      Currently, Redis DEBUG PROTOCOL 'attrib' command will return an
      attribute type, but hiredis doesn't support it yet. So it got the
      protocol type error:
      
      ```
      127.0.0.1:6379>  DEBUG PROTOCOL attrib
      Error: Protocol error, got "|" as reply type byte
      ```
      
      After apply this PR, it should reply:
      
      ```
      127.0.0.1:6379> DEBUG PROTOCOL attrib
      1# "key-popularity"
      1# 1) "key:123"
         2) (integer) 90
      ```
      5b253d89
  2. 01 Jun, 2023 1 commit
  3. 29 May, 2023 1 commit
    • Viktor Söderqvist's avatar
      Helper for setting TCP_USER_TIMEOUT socket option (#1188) · b6a052fe
      Viktor Söderqvist authored
      * Implement redisSetTcpUserTimeout to set socket option TCP_USER_TIMEOUT
      
      * Documentation for redisSetTcpUserTimeout and some more undocumented functions
      
      Documentation for redisReconnect() and the setters of socket options:
      
      * redisKeepAlive()
      * redisEnableKeepAliveWithInterval()
      * redisSetTcpUserTimeout()
      b6a052fe
  4. 15 Apr, 2023 1 commit
  5. 08 Mar, 2023 1 commit
  6. 08 Sep, 2022 1 commit
    • michael-grunder's avatar
      Minor refactor · 560e6648
      michael-grunder authored
      Protect against a NULL pointer dereference, and remove unused write
      to a variable.
      560e6648
  7. 05 Sep, 2022 1 commit
    • Michael Grunder's avatar
      Fix protocol error (#1106) · 79ae5ffc
      Michael Grunder authored
      
      
      Fix ProtocolError
      
      This commit attempts to fix hiredis such that a recoverable write error
      will be retried rather than throwing a hard error.
      
      Since our read/write functions are now behind function pointers, we
      specify semantically that a return value of < 0 is a hard error, 0 a
      recoverable error, and > 0 a success.
      
      Our default `redisNetRead` function was already doing something similar
      so this also improves code consistency.
      
      Resolves #961
      Co-authored-by: default avatarMaksim Tuleika <maksim.tuleika@appcast.io>
      79ae5ffc
  8. 02 Sep, 2022 1 commit
  9. 01 Sep, 2022 3 commits
  10. 22 Dec, 2021 1 commit
  11. 01 Nov, 2021 1 commit
  12. 10 Oct, 2021 1 commit
  13. 04 Oct, 2021 1 commit
  14. 19 Aug, 2021 1 commit
  15. 11 Jul, 2021 1 commit
  16. 02 Apr, 2021 2 commits
    • michael-grunder's avatar
      Change order independant push logic to not change behavior. · dfa33e60
      michael-grunder authored
      Since redisGetReplyFromReader is exposed in a header file, we probably
      shouldn't modify how it behaves in any way.  For this reason, handle the
      changed logic in an internal static helper method.
      dfa33e60
    • michael-grunder's avatar
      Handle the case where an invalidation is sent second. · 6204182a
      michael-grunder authored
      RESP3 invalidation messages always seemed to be sent before the response
      to a given command, but it appears this is not always the case:
      
      In Redis 6.2.0RC1 Redis sends the invalidation after the HSET in the
      following sequence:
      
      ```
      hget hash field
      $5
      value
      hset hash field value
      :0
      >2
      $10
      invalidate
      *1
      $4
      hash
      ```
      
      To account for this possibility just wrap redisGetReplyFromReader in a
      loop as it is called twice in redisGetReply.
      6204182a
  17. 26 Feb, 2021 4 commits
  18. 18 Oct, 2020 1 commit
    • michael-grunder's avatar
      Fix handling of NIL invalidation messages. · b9b9f446
      michael-grunder authored
      When CLIENT TRACKING is enabled, Redis will send an invalidation message
      with a NIL payload to all tracking clients after a FLUSHDB is executed.
      
      We didn't account for REDIS_REPLY_PUSH being a valid parent object to a
      NIL payload, and were failing an assertion.
      
      Additionally this commit adds a regression test for the logic.
      b9b9f446
  19. 12 Oct, 2020 1 commit
  20. 29 Jul, 2020 1 commit
    • Michael Grunder's avatar
      Move SSL management to a distinct private pointer. (#855) · d8ff7238
      Michael Grunder authored
      We need to allow our users to use redisContext->privdata as context
      for any RESP3 PUSH messages, which means we can't use it for managing
      SSL connections.
      
      Bulletpoints:
      
      * Create a secondary redisContext member for internal use only called
        privctx and rename the redisContextFuncs->free_privdata accordingly.
      
      * Adds a `free_privdata` function pointer so the user can tie allocated
        memory to the lifetime of a redisContext (like they can already do
        with redisAsyncContext)
      
      * Enables SSL tests in .travis.yml
      d8ff7238
  21. 26 Jul, 2020 1 commit
  22. 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
  23. 19 Jun, 2020 1 commit
  24. 07 Jun, 2020 1 commit
  25. 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
  26. 21 May, 2020 1 commit
  27. 19 May, 2020 1 commit
  28. 12 Dec, 2019 1 commit
    • michael-grunder's avatar
      Free the reply in redisGetReply when passed NULL · ac0b186a
      michael-grunder authored
      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
      ac0b186a
  29. 16 Sep, 2019 1 commit
    • Yossi Gottlieb's avatar
      Fix: redisReconnect() should clear SSL context. · d41443bd
      Yossi Gottlieb authored
      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.
      d41443bd
  30. 29 Aug, 2019 1 commit
  31. 04 Aug, 2019 1 commit
  32. 10 Apr, 2019 1 commit
  33. 01 Apr, 2019 1 commit