Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP IAP bug #137

Open
khevessy opened this issue Jul 13, 2022 · 1 comment
Open

HTTP IAP bug #137

khevessy opened this issue Jul 13, 2022 · 1 comment
Assignees
Labels
eth Ethernet needs clarification Needs clarification or inputs from the user projects Projects-related (demos, applications, examples) issue or pull-request.

Comments

@khevessy
Copy link

There is a potential bug in the HTTP IAP example. In the web server, there this this if clause:

if (strncmp(data, "GET / HTTP", 10) == 0)
{
/*send the login page (which is the index page) */
htmlpage = LoginPage;
fs_open("/index.html", &file);
hs->file = file.data;
hs->left = file.len;
pbuf_free(p);
/* send index.html page */
send_data(pcb, hs);
/* Tell TCP that we wish be to informed of data that has been
successfully sent by a call to the http_sent() function. */
tcp_sent(pcb, http_sent);
}

and
if (strncmp(data, "GET / HTTP", 10) == 0)
{
/*send the login page (which is the index page) */
htmlpage = LoginPage;
fs_open("/index.html", &file);
hs->file = file.data;
hs->left = file.len;
pbuf_free(p);
/* send index.html page */
send_data(pcb, hs);
/* Tell TCP that we wish be to informed of data that has been
successfully sent by a call to the http_sent() function. */
tcp_sent(pcb, http_sent);
}

which handles GET request. POST request and subsequent data frames are handled in an else if on line 302. However, when we will be receiving data and the binary that we are trying to load is containing the exact string GET / HTTP and it will be at the beginning of the packet (it happened to me in slight variation), we will reset the site prior to writing the whole binary. My suggestion would be to either move the else if for POST request to the beginning of the if, or add check for which htmlpage we are on to the line 231.

I have made an issue in the STM32CubeF7 project, where there is a similar problem. I do not know if there is any other MCU family with this HTTP IAP example, but if there is and you will decide to fix this, please propagate the solution there.
The same problem is in the STSW-STM32069 package that implements this exact same functionality.

@ASELSTM
Copy link
Contributor

ASELSTM commented Aug 16, 2022

See also STM32CubeF7#69.

@ASELSTM ASELSTM added duplicate This issue or pull request already exists needs clarification Needs clarification or inputs from the user projects Projects-related (demos, applications, examples) issue or pull-request. labels Aug 16, 2022
@ASELSTM ASELSTM added the mw Middleware-related issue or pull-request. label Aug 16, 2022
@TOUNSTM TOUNSTM assigned ASEHSTM and unassigned ASELSTM Jun 5, 2024
@ASEHSTM ASEHSTM added eth Ethernet and removed duplicate This issue or pull request already exists mw Middleware-related issue or pull-request. labels Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eth Ethernet needs clarification Needs clarification or inputs from the user projects Projects-related (demos, applications, examples) issue or pull-request.
Projects
None yet
Development

No branches or pull requests

3 participants