MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / connect

Method connect

src/dpp/httpsclient.cpp:51–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void https_client::connect()
52{
53 state = HTTPS_HEADERS;
54 std::string map_headers;
55 for (auto& [k,v] : request_headers) {
56 std::string lower_header = dpp::lowercase(k);
57 if (lower_header == "connection" || lower_header == "content-length" || lower_header == "host") {
58 owner->log(ll_warning, "Detected unnecessary duplicate header '" + k + "' in HTTP request to '" + hostname + "', which has been discarded.");
59 continue;
60 }
61 map_headers += k + ": " + v + "\r\n";
62 }
63
64 if (this->sfd != SOCKET_ERROR) {
65 this->socket_write(
66 this->request_type + " " + this->path + " HTTP/" + http_protocol + "\r\n"
67 "Host: " + this->hostname + "\r\n"
68 "pragma: no-cache\r\n"
69 "Connection: keep-alive\r\n"
70 "Content-Length: " +
71 std::to_string(this->request_body.length()) +
72 "\r\n" +
73 map_headers +
74 "\r\n" +
75 this->request_body
76 );
77 read_loop();
78 }
79}
80
81multipart_content https_client::build_multipart(const std::string &json, const std::vector<std::string>& filenames, const std::vector<std::string>& contents, const std::vector<std::string>& mimetypes) {
82

Callers

nothing calls this directly

Calls 4

lowercaseFunction · 0.85
to_stringFunction · 0.85
socket_writeMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected