| 49 | } |
| 50 | |
| 51 | void 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 | |
| 81 | multipart_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 |
nothing calls this directly
no test coverage detected