| 72 | ////////////////////////////////////////////////////////////////////////// |
| 73 | |
| 74 | class http_ipc_request : public ipc_request |
| 75 | { |
| 76 | public: |
| 77 | http_ipc_request(http_service_request* callback, int nwait) |
| 78 | { |
| 79 | nwait_ = nwait; |
| 80 | memset(&data_, 0, sizeof(data_)); |
| 81 | data_.callback = callback; |
| 82 | hdr_res_ = NULL; |
| 83 | res_ = NULL; |
| 84 | vstream_ = NULL; |
| 85 | respond_over_ = false; |
| 86 | } |
| 87 | |
| 88 | ~http_ipc_request(void) |
| 89 | { |
| 90 | if (res_) { |
| 91 | res_->hdr_res = NULL; |
| 92 | http_res_free(res_); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // ���� ipc_request ���Զ����ô˻ص������������ |
| 97 | // @override |
| 98 | void run(ipc_client* ipc) |
| 99 | { |
| 100 | unsigned int nredirect_limit = data_.callback->get_redirect(); |
| 101 | unsigned int nredirect = 0; |
| 102 | http_status_t ret; |
| 103 | |
| 104 | while (true) { |
| 105 | if ((ret = connect_server()) != HTTP_OK) { |
| 106 | report_error(ipc, ret); |
| 107 | break; |
| 108 | } |
| 109 | if ((ret = send_request()) != HTTP_OK) { |
| 110 | report_error(ipc, ret); |
| 111 | break; |
| 112 | } |
| 113 | if ((ret = read_respond_hdr()) != HTTP_OK) { |
| 114 | report_error(ipc, ret); |
| 115 | break; |
| 116 | } |
| 117 | |
| 118 | acl_assert(hdr_res_); |
| 119 | |
| 120 | // ������������ص����ض�����Ϣ��������ض������ |
| 121 | |
| 122 | if ((hdr_res_->reply_status != 301 |
| 123 | && hdr_res_->reply_status != 302) |
| 124 | || nredirect_limit == 0) { |
| 125 | |
| 126 | // ������Ӧͷ�յ���Ϣ�����߳� |
| 127 | report(ipc, HTTP_MSG_HDR); |
| 128 | |
| 129 | // ����������Ӧ�岢����Ӧ���յ���Ϣ�����߳� |
| 130 | read_respond_body(ipc); |
| 131 | break; |
no outgoing calls
no test coverage detected
searching dependent graphs…