Need help with STM32F407 HTTPD POST function
I've been working with STM32F407 httpd POST for the last week. I've got everything with the POST working but I have one problem that I can't resolve. I don't know if it is a C problem or an LwIP problem, but I suspect it is LwIP.
I have code that I send to the POST functions that check the password that I enter on the login page. If the password matches the system password that is stored in EEPROM, I advance to the next web page of my app. If the password is incorrect, I simply return to the login page. That process works as designed as long as a good password and a bad password are the same length.
The POST function that handles the login is this:
err_t httpd_post_receive_data(void *connection, struct pbuf *p)
{
p->payload holds the password when function is called
password check code.
at end of check code:
pbuf_free(p);
}Assume the good password is test123. I enter a bad password of test4567 which is one character longer than test123. I return to the login page and enter test123 and POST that to the server. The login fails and returns me to the login page. If I stop the debugger in the function after entering the good password I see p->payload now holds test1237 as the password. It appears pbuf_free(p) doesn't clear the payload buffer.
Completely closing the browser and re-opening it doesn't solve the issue. I am now blocked from logging into the board. However, if I use a different browser I can login. The only way to login from the first browser is to restart the board.
Has anyone had a similar problem? I believe very few people use the STM32 POST function since no one really understands how it works. Any suggestions on how to clear the p->payload part of the struct?
