-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Labels
ethEthernetEthernetlwipLightweight TCP/IPLightweight TCP/IPneeds clarificationNeeds clarification or inputs from the userNeeds clarification or inputs from the userprojectsProjects-related (demos, applications, examples) issue or pull-request.Projects-related (demos, applications, examples) issue or pull-request.
Description
I think there is a potential bug in the HTTP IAP example. In the web server, there this code:
STM32CubeF7/Projects/STM32756G_EVAL/Applications/LwIP/LwIP_IAP/Src/httpserver.c
Lines 232 to 269 in f8bda02
if (strncmp(data, "GET /", 5) == 0) | |
{ | |
if ((strncmp(data, "GET /resetmcu.cgi", 17) ==0)&&(htmlpage == UploadDonePage)) | |
{ | |
htmlpage = ResetDonePage; | |
fs_open("/reset.html", &file); | |
hs->file = file.data; | |
hs->left = file.len; | |
pbuf_free(p); | |
/* send reset.html page */ | |
send_data(pcb, hs); | |
resetpage = 1; | |
/* 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); | |
} | |
else | |
{ | |
if (alreadyLoggedIn == 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
STM32CubeF7/Projects/STM32F769I_EVAL/Applications/LwIP/LwIP_IAP/Src/httpserver.c
Lines 232 to 269 in f8bda02
if (strncmp(data, "GET /", 5) == 0) | |
{ | |
if ((strncmp(data, "GET /resetmcu.cgi", 17) ==0)&&(htmlpage == UploadDonePage)) | |
{ | |
htmlpage = ResetDonePage; | |
fs_open("/reset.html", &file); | |
hs->file = file.data; | |
hs->left = file.len; | |
pbuf_free(p); | |
/* send reset.html page */ | |
send_data(pcb, hs); | |
resetpage = 1; | |
/* 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); | |
} | |
else | |
{ | |
if (alreadyLoggedIn == 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 is used for handling GET request. POST requests are handled in
else if()
clause on lines 272 and 308. However, when sending of the binary is already happening, this can cause problem when the binary will contain string GET /
and it will be just at the beginning of the data packet (it happened to me). Then we will skip this one packet and won't write the data at all.My proposal for solution would be either add a check for which page are we on to the line 232, or move the clause that is handling the raw data (from line 308) to the beginning of the if.
Similar problem is also in the STM32CubeF4 project, I'll make separate issue there as the code is a little bit different.
Metadata
Metadata
Assignees
Labels
ethEthernetEthernetlwipLightweight TCP/IPLightweight TCP/IPneeds clarificationNeeds clarification or inputs from the userNeeds clarification or inputs from the userprojectsProjects-related (demos, applications, examples) issue or pull-request.Projects-related (demos, applications, examples) issue or pull-request.
Type
Projects
Status
To do