MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / common_http_client

Function common_http_client

common/http.h:68–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68static std::pair<httplib::Client, common_http_url> common_http_client(const std::string & url) {
69 common_http_url parts = common_http_parse_url(url);
70
71 if (parts.host.empty()) {
72 throw std::runtime_error("error: invalid URL format");
73 }
74
75#ifndef CPPHTTPLIB_OPENSSL_SUPPORT
76 if (parts.scheme == "https") {
77 throw std::runtime_error(
78 "HTTPS is not supported. Please rebuild with one of:\n"
79 " -DLLAMA_BUILD_BORINGSSL=ON\n"
80 " -DLLAMA_BUILD_LIBRESSL=ON\n"
81 " -DLLAMA_OPENSSL=ON (default, requires OpenSSL dev files installed)"
82 );
83 }
84#endif
85
86 httplib::Client cli(parts.scheme + "://" + parts.host + ":" + std::to_string(parts.port));
87
88 if (!parts.user.empty()) {
89 cli.set_basic_auth(parts.user, parts.password);
90 }
91
92 cli.set_follow_location(true);
93
94 return { std::move(cli), std::move(parts) };
95}
96
97static std::string common_http_show_masked_url(const common_http_url & parts) {
98 return parts.scheme + "://" + (parts.user.empty() ? "" : "****:****@") + parts.host + parts.path;

Callers 4

gguf_http_getFunction · 0.85
api_getFunction · 0.85

Calls 3

common_http_parse_urlFunction · 0.85
to_stringFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected