MCPcopy Create free account
hub / github.com/apache/trafficserver / loadSocksAuthInfo

Function loadSocksAuthInfo

src/iocore/net/Socks.cc:527–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527int
528loadSocksAuthInfo(swoc::TextView content, socks_conf_struct *socks_stuff)
529{
530 static constexpr swoc::TextView PREFIX = "auth u ";
531 std::string text;
532
533 while (content.ltrim_if(&isspace)) {
534 auto line = content.take_prefix_at('\n');
535
536 if (line.starts_with(PREFIX)) {
537 line.remove_prefix(PREFIX.size()).ltrim_if(&isspace);
538 auto user_name = line.take_prefix_if(&isspace);
539 auto password = line.take_prefix_if(&isspace);
540
541 if (!user_name.empty() && !password.empty()) {
542 Dbg(dbg_ctl_Socks, "%s", swoc::bwprint(text, "Read auth credentials \"{}\" : \"{}\"", user_name, password).c_str());
543 swoc::bwprint(socks_stuff->user_name_n_passwd, "{}{}{}{}", static_cast<char>(user_name.size()), user_name,
544 static_cast<char>(password.size()), password);
545 }
546 }
547 }
548 return 0;
549}
550
551swoc::Errata
552loadSocksIPAddrs(swoc::TextView content, socks_conf_struct *socks_stuff)

Callers 1

loadSocksConfigurationFunction · 0.85

Calls 7

take_prefix_atMethod · 0.80
take_prefix_ifMethod · 0.80
starts_withMethod · 0.45
remove_prefixMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected