-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
Status: StaleIssue is stale stage (outdated/stuck)Issue is stale stage (outdated/stuck)
Description
Hardware:
Board: ESP32 Dev Module
Core Installation version: 1.0.4
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: ?no? ?yes?
Upload Speed: 115200
Computer OS: Mac OSX
Description:
I am trying to read HTTP headers from request. The array always contain 1 element regardless actual number of headers sent with request. Exemplary code is below:
Please note the interesting thing. When printing array of headers only 1 item is available i.e. Authorization but when trying to access Host header by method hostHeader() it returns valid value.
class HTTPServer {
private:
WebServer *server;
public:
HTTPServer() {
this->server = new WebServer(80);
this->server->begin();
this->server->on("/aaatest", [this]() {
int argsNum = this->server->args();
for(int i=0; i<argsNum; i++) {
Serial.println(this->server->argName(i) + " : " + this->server->arg(i));
}
int headersNum = this->server->headers();
Serial.println("Headers num: " + String(headersNum));
Serial.println("Header [Accept]: " + this->server->header("Accept"));
Serial.println("Header [Host]: " + this->server->hostHeader());
Serial.println(this->server->hasHeader("Accept"));
for(int i=0; i<headersNum; i++) {
Serial.println(this->server->headerName(i) + " : " + this->server->header(i));
}
});
}
}
Here is the result:
00:38:25.359 -> Headers num: 1
00:38:25.359 -> Header [Accept]:
00:38:25.359 -> Header [Host]: 10.0.0.165
00:38:25.359 -> 0
00:38:25.359 -> Authorization :
Metadata
Metadata
Assignees
Labels
Status: StaleIssue is stale stage (outdated/stuck)Issue is stale stage (outdated/stuck)