@@ -90,32 +90,24 @@ void setup(void) {
90
90
// Hook examples
91
91
92
92
server.addHook ([](const String & method, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction contentType) {
93
- (void )method;
94
- (void )url;
95
- (void )client;
96
- (void )contentType;
93
+ (void )method; // GET, PUT, ...
94
+ (void )url; // example: /root/myfile.html
95
+ (void )client; // the webserver tcp client connection
96
+ (void )contentType; // contentType(".html") => "text/html"
97
97
Serial.printf (" A useless web hook has passed\n " );
98
98
Serial.printf (" (this hook is in 0x%08x area (401x=IRAM 402x=FLASH))\n " , esp_get_program_counter ());
99
99
return ESP8266WebServer::CLIENT_REQUEST_CAN_CONTINUE;
100
100
});
101
101
102
- server.addHook ([](const String & method, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction contentType) {
103
- (void )method;
104
- (void )client;
105
- (void )contentType;
106
- Serial.printf (" (this hook is in 0x%08x area (401x=IRAM 402x=FLASH))\n " , esp_get_program_counter ());
102
+ server.addHook ([](const String&, const String & url, WiFiClient*, ESP8266WebServer::ContentTypeFunction) {
107
103
if (url.startsWith (" /fail" )) {
108
104
Serial.printf (" An always failing web hook has been triggered\n " );
109
105
return ESP8266WebServer::CLIENT_MUST_STOP;
110
106
}
111
107
return ESP8266WebServer::CLIENT_REQUEST_CAN_CONTINUE;
112
108
});
113
109
114
- server.addHook ([](const String & method, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction contentType) {
115
- (void )method;
116
- (void )client;
117
- (void )contentType;
118
- Serial.printf (" (this hook is in 0x%08x area (401x=IRAM 402x=FLASH))\n " , esp_get_program_counter ());
110
+ server.addHook ([](const String&, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction) {
119
111
if (url.startsWith (" /dump" )) {
120
112
Serial.printf (" The dumper web hook is on the run\n " );
121
113
@@ -125,7 +117,7 @@ void setup(void) {
125
117
// webserver.
126
118
#ifdef STREAMTO_API
127
119
// we are lucky
128
- client->streamToWithTimeout (Serial, 500 );
120
+ client->toWithTimeout (Serial, 500 );
129
121
#else
130
122
auto last = millis ();
131
123
while ((millis () - last) < 500 ) {
0 commit comments