| 159 | }; |
| 160 | |
| 161 | bool http_client::handle(void) |
| 162 | { |
| 163 | const char* cmd = http_hdr_req_param(hdr_req_, "cmd"); |
| 164 | if (cmd == NULL || *cmd == 0) { |
| 165 | //logger_error("cmd null"); |
| 166 | acl::string dummy; |
| 167 | do_reply(400, "none", dummy, false); |
| 168 | if (hdr_req_->hdr.keep_alive) |
| 169 | wait(); |
| 170 | else |
| 171 | acl_aio_iocp_close(conn_); |
| 172 | return true; |
| 173 | } |
| 174 | |
| 175 | #define EQ !strcasecmp |
| 176 | |
| 177 | int i; |
| 178 | |
| 179 | for (i = 0; handlers[i].cmd != NULL; i++) { |
| 180 | if (EQ(cmd, handlers[i].cmd)) |
| 181 | break; |
| 182 | } |
| 183 | |
| 184 | if (handlers[i].handler == NULL) { |
| 185 | logger_warn("invalid cmd=%s", cmd); |
| 186 | acl::string dummy; |
| 187 | do_reply(400, "unknown", dummy, false); |
| 188 | if (hdr_req_->hdr.keep_alive) |
| 189 | wait(); |
| 190 | else |
| 191 | acl_aio_iocp_close(conn_); |
| 192 | return true; |
| 193 | } |
| 194 | |
| 195 | if ((this->*handlers[i].handler)()) |
| 196 | return true; |
| 197 | |
| 198 | acl_aio_iocp_close(conn_); |
| 199 | return false; |
| 200 | } |
| 201 | |
| 202 | bool http_client::handle_list(void) |
| 203 | { |
no test coverage detected