I have been working on a project and have stumbled upon an issue with the internal HTTP server. It seems when posting multiple variables at once, only the first couple and the last couple work. As an example, I POST'ed 14 variables in a single request. The first 2 variables were sent to the APPS processor, the others never triggered the call-back. The variables are not system reserved ones, but are the following: __SL_P_U.[A-N]
In troubleshooting this, I did minimal modifications to recreate the issue to the httpserver example in the SDK (1.0.0 and 1.1.0 have the same problem with their respective service packs).
I have attached a wireshark capture of what is being sent from the web-browser, the http file with the form as well as a screenshot of the console. At the end, I have shown the changes I made to the httpserver example.
<html> <head> </head> <body> <form method="POST" action="some_page.html"> Field A:<br> <input type="text" name="__SL_P_U.A"> <br> Field B:<br> <input type="text" name="__SL_P_U.B"> <br> Field C:<br> <input type="text" name="__SL_P_U.C"> <br> Field D:<br> <input type="text" name="__SL_P_U.D"> <br> Field E:<br> <input type="text" name="__SL_P_U.E"> <br> Field F:<br> <input type="text" name="__SL_P_U.F"> <br> Field G:<br> <input type="text" name="__SL_P_U.G"> <br> Field H:<br> <input type="text" name="__SL_P_U.H"> <br> Field I:<br> <input type="text" name="__SL_P_U.I"> <br> Field J:<br> <input type="text" name="__SL_P_U.J"> <br> Field K:<br> <input type="text" name="__SL_P_U.K"> <br> Field L:<br> <input type="text" name="__SL_P_U.L"> <br> Field M:<br> <input type="text" name="__SL_P_U.M"> <br> Field N:<br> <input type="text" name="__SL_P_U.N"> <br> <input type="submit" value="Submit"> </form> </body>
Steps to reproduce:
- Open a clean copy of the httpserver example from the SDK.
- Upload the attached form.html file to the serial flash.
- Add the following code right after line 613 of main.c:
unsigned char nullTermArray[11]; unsigned char length = pSlHttpServerEvent->EventData.httpPostData.token_name.len; memcpy(nullTermArray, ptr, length); nullTermArray[length] = 0x00; UART_PRINT("Received POST token: %s\n\r", nullTermArray);
- Ensure the force AP jumper is inserted onto the board.
- Debug the program
- Start serial console to watch program output
- Connect to the board's WiFi and request the /form.html page.
- Enter data into the form and click submit
- Notice on the serial console output, that the "SimpleLinkHttpServerCallback()" function is only called for the first and last 2 tokens. In other tests I have done, I had it output a simple "!" character whenever the callback function was entered and did not see it being called at all for the tokens that are being skipped.
Let me know if there is difficulty in reproducing what I am seeing. Again, this problem is present in both versions of the SDK and with either of the production-quality service packs.
UPDATE:
It seems that 12 tokens in a single request is ok, but 13 causes only the first 2 and the last 1 to be processed. Is there a limit on the number of tokens that can be POST'ed in a single request that I have missed?
NOTE: I am only sending a single character as the data for each token in my tests, but the problem has been present regardless of the number of characters in the token data.