| 13 | {} |
| 14 | |
| 15 | bool http_get::get(const char* addr, const char* host, |
| 16 | const char *url, acl::string &out) { |
| 17 | acl::http_request request(addr); |
| 18 | acl::http_header& header = request.request_header(); |
| 19 | |
| 20 | header.set_url(url) |
| 21 | .set_host(host) |
| 22 | .accept_gzip(true) |
| 23 | .set_keep_alive(false); |
| 24 | |
| 25 | log_info("http_get(%d): addr=%s, host=%s, url=%s", __LINE__, addr, host, url); |
| 26 | |
| 27 | if (!request.request(NULL, 0)) { |
| 28 | log_error("send http request error=%s", acl::last_serror()); |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | if (!request.get_body(out)) { |
| 33 | log_error("get body error: %s", acl::last_serror()); |
| 34 | return false; |
| 35 | } |
| 36 | |
| 37 | acl::http_client* conn = request.get_client(); |
| 38 | acl::string hdr_res; |
| 39 | conn->sprint_header(hdr_res, "response header"); |
| 40 | log_info("%s", hdr_res.c_str()); |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | void http_get::run(void) { |
| 45 | std::vector<acl::string> ips; |
nothing calls this directly
no test coverage detected