Replies: 5 comments 13 replies
-
which version of pioarduino? |
Beta Was this translation helpful? Give feedback.
-
I am converting that to a discussion since there is no issue here but several problems in the code. |
Beta Was this translation helpful? Give feedback.
-
static AsyncMiddlewareFunction digestAuth([](AsyncWebServerRequest *request,
ArMiddlewareNext next) {
Serial.println("digestAuth");
AsyncWebServerResponse *response = request->beginResponse(401); What happens to the response pointer if you go in the else clause ? Memory leak right ? if (!request->hasHeader("Authorization")) {
response->addHeader("Access-Control-Allow-Origin", "*");
static AsyncAuthorizationMiddleware authz([](AsyncWebServerRequest *request) {
Serial.println("authz");
String sessionToken = verifyDigest(request);
if (sessionToken != "") {
Serial.println("testAuth_ok");
request->getResponse()->addHeader("X-Session-Token", sessionToken); How to you know that you have a response already set ? request->getResponse() is NULL by default... it seems to me that you are trying to reinvent the wheel but with lots of bugs included. |
Beta Was this translation helpful? Give feedback.
-
thanks for the help, it's still a work in progress i haven't corrected all the errors yet. |
Beta Was this translation helpful? Give feedback.
-
Would it be possible later to add an example to have a basic or personalized digest (I could potentially do it if needed)? |
Beta Was this translation helpful? Give feedback.
-
Platform
ESP32
IDE / Tooling
pioarduino
What happened?
i got this error while using this function.
there's not much detail on this function in the documentation, so maybe it's just me using it wrong.
Stack Trace
Minimal Reproductible Example (MRE)
here's my code:
I confirm that:
Beta Was this translation helpful? Give feedback.
All reactions