| 64 | } |
| 65 | |
| 66 | bool http_client::open(void) |
| 67 | { |
| 68 | http_stream* conn = new http_stream(handle_, *this); |
| 69 | |
| 70 | conn->unzip_body(true); |
| 71 | |
| 72 | acl::http_header& hdr = conn->request_header(); |
| 73 | hdr.set_url(url_) |
| 74 | .set_host(host_) |
| 75 | .accept_gzip(true) |
| 76 | .set_keep_alive(keep_alive_); |
| 77 | |
| 78 | acl::string buf; |
| 79 | hdr.build_request(buf); |
| 80 | printf("---------------request header-----------------\r\n"); |
| 81 | printf("[%s]\r\n", buf.c_str()); |
| 82 | |
| 83 | if (!conn->open(addr_, conn_timeout_, rw_timeout_)) { |
| 84 | delete conn; |
| 85 | return false; |
| 86 | } |
| 87 | |
| 88 | ++__aio_refer; |
| 89 | |
| 90 | // 本对象的引用计数递增 |
| 91 | refered_++; |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | bool http_client::redirect(const char* url) |
| 96 | { |
no test coverage detected