| 99 | }; |
| 100 | |
| 101 | int main() |
| 102 | { |
| 103 | #ifdef WIN32 |
| 104 | acl::acl_cpp_init(); |
| 105 | #endif |
| 106 | acl::atomic_long n; |
| 107 | n++; |
| 108 | printf("n=%lld\r\n", n.value()); |
| 109 | getchar(); |
| 110 | |
| 111 | acl::aio_handle handle(acl::ENGINE_SELECT); |
| 112 | acl::http_service* service = new acl::http_service(); |
| 113 | |
| 114 | // ʹ��Ϣ���������� 127.0.0.1 �ĵ�ַ |
| 115 | if (service->open(&handle) == false) |
| 116 | { |
| 117 | printf(">>open message service error!\n"); |
| 118 | printf(">>enter any key to quit\n"); |
| 119 | getchar(); |
| 120 | return (1); |
| 121 | } |
| 122 | |
| 123 | |
| 124 | // ���� HTTP ������� |
| 125 | acl::string domain; |
| 126 | domain = "www.hexun.com"; |
| 127 | //domain = "192.168.1.229"; |
| 128 | //domain = "www.renwou.net"; |
| 129 | http_request* req = new http_request(domain.c_str(), 80, &handle); |
| 130 | req->set_url("/index.html"); |
| 131 | //req->set_url("/download/banmau_install.exe"); |
| 132 | req->set_host(domain); |
| 133 | req->set_keep_alive(false); |
| 134 | req->set_method(acl::HTTP_METHOD_GET); |
| 135 | req->add_cookie("x-cookie-name", "cookie-value"); |
| 136 | //req->set_redirect(1); // �����Զ��ض���Ĵ������� |
| 137 | |
| 138 | // ֪ͨ�첽��Ϣ������������ HTTP ������� |
| 139 | |
| 140 | ////////////////////////////////////////////////////////////////////////// |
| 141 | //acl::string buf; |
| 142 | //req->build_request(buf); |
| 143 | //printf("-----------------------------------------------\n"); |
| 144 | //printf("%s", buf.c_str()); |
| 145 | //printf("-----------------------------------------------\n"); |
| 146 | ////////////////////////////////////////////////////////////////////////// |
| 147 | |
| 148 | service->do_request(req); |
| 149 | |
| 150 | while (true) |
| 151 | { |
| 152 | if (handle.check() == false) |
| 153 | { |
| 154 | printf(">>quit aio process\n"); |
| 155 | break; |
| 156 | } |
| 157 | } |
| 158 |
nothing calls this directly
no test coverage detected
searching dependent graphs…