| 248 | } |
| 249 | |
| 250 | void http_server_request::one_second_timer() { |
| 251 | if (!tcp_connect_done && time(nullptr) >= timeout) { |
| 252 | timed_out = true; |
| 253 | this->close(); |
| 254 | } else if (tcp_connect_done && !connected && time(nullptr) >= timeout && this->state != HTTPS_DONE) { |
| 255 | this->close(); |
| 256 | timed_out = true; |
| 257 | } else if (time(nullptr) >= timeout && this->state != HTTPS_DONE) { |
| 258 | this->close(); |
| 259 | timed_out = true; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | std::string http_server_request::get_response() { |
| 264 | std::string response = "HTTP/1.0 " + std::to_string(status) + " OK\r\n"; |