void WebServer::_handleRequest() { RequestHandler* handler; for (handler = _firstHandler; handler; handler = handler->next) { if (handler->method != HTTP_ANY && handler->method != _currentMethod) continue; if (handler->uri != _currentUri) continue; handler->fn(); break; } if (!handler){ #ifdef DEBUG DEBUG_OUTPUT.println("request handler not found"); #endif if(_notFoundHandler) { _notFoundHandler(); } else { printHead(404,"text/plain"); print(String("Not found: ") + _currentUri); closeClient(); } } _currentClient = WiFiClient(); _currentUri = String(); }
void ESP8266WebServer::_handleRequest() { RequestHandler* handler; for (handler = _firstHandler; handler; handler = handler->next()) { if (handler->handle(*this, _currentMethod, _currentUri)) break; } if (!handler){ #ifdef DEBUG DEBUG_OUTPUT.println("request handler not found"); #endif if(_notFoundHandler) { _notFoundHandler(); } else { send(404, "text/plain", String("Not found: ") + _currentUri); } } uint16_t maxWait = HTTP_MAX_CLOSE_WAIT; while(_currentClient.connected() && maxWait--) { delay(1); } _currentClient = WiFiClient(); _currentUri = String(); }
void ESP8266WebServer::_handleRequest(WiFiClient& client, String uri, HTTPMethod method) { _currentClient = client; _currentUri = uri; _currentMethod = method; RequestHandler* handler; for (handler = _firstHandler; handler; handler = handler->next) { if (handler->method != HTTP_ANY && handler->method != method) continue; if (handler->uri != uri) continue; handler->fn(); break; } if (!handler){ #ifdef DEBUG Serial.println("request handler not found"); #endif if(_notFoundHandler) { _notFoundHandler(); } else { send(404, "text/plain", String("Not found: ") + uri); } } _currentClient = WiFiClient(); _currentUri = String(); }
void ESP8266WebServer::_handleRequest() { bool handled = false; if (!_currentHandler){ #ifdef DEBUG_ESP_HTTP_SERVER DEBUG_OUTPUT.println("request handler not found"); #endif } else { handled = _currentHandler->handle(*this, _currentMethod, _currentUri); #ifdef DEBUG_ESP_HTTP_SERVER if (!handled) { DEBUG_OUTPUT.println("request handler failed to handle request"); } #endif } if (!handled) { if(_notFoundHandler) { _notFoundHandler(); } else { send(404, "text/plain", String("Not found: ") + _currentUri); } } uint16_t maxWait = HTTP_MAX_CLOSE_WAIT; while(_currentClient.connected() && maxWait--) { delay(1); } _currentClient = WiFiClient(); _currentUri = String(); }
void ESP8266WebServer::_handleRequest() { bool handled = false; if (!_currentHandler){ #ifdef DEBUG_ESP_HTTP_SERVER DEBUG_OUTPUT.println("request handler not found"); #endif } else { handled = _currentHandler->handle(*this, _currentMethod, _currentUri); #ifdef DEBUG_ESP_HTTP_SERVER if (!handled) { DEBUG_OUTPUT.println("request handler failed to handle request"); } #endif } if (!handled) { if(_notFoundHandler) { _notFoundHandler(); } else { send(404, "text/plain", String("Not found: ") + _currentUri); } } _currentUri = String(); }