Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 09:10:03

0001 /* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com)
0002  *
0003  * Distributed under the Boost Software License, Version 1.0. (See
0004  * accompanying file LICENSE.txt)
0005  */
0006 
0007 #include <boost/redis/detail/resp3_handshaker.hpp>
0008 
0009 namespace boost::redis::detail
0010 {
0011 
0012 void push_hello(config const& cfg, request& req)
0013 {
0014    if (!cfg.username.empty() && !cfg.password.empty() && !cfg.clientname.empty())
0015       req.push("HELLO", "3", "AUTH", cfg.username, cfg.password, "SETNAME", cfg.clientname);
0016    else if (cfg.password.empty() && cfg.clientname.empty())
0017       req.push("HELLO", "3");
0018    else if (cfg.clientname.empty())
0019       req.push("HELLO", "3", "AUTH", cfg.username, cfg.password);
0020    else
0021       req.push("HELLO", "3", "SETNAME", cfg.clientname);
0022 
0023    if (cfg.database_index && cfg.database_index.value() != 0)
0024       req.push("SELECT", cfg.database_index.value());
0025 }
0026 
0027 } // boost::redis::detail