This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem POST'ing multiple variables at once

Other Parts Discussed in Thread: CC3200

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.

failed_post.zip                                                 

<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:

  1. Open a clean copy of the httpserver example from the SDK.
  2. Upload the attached form.html file to the serial flash.
  3. 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);
  4. Ensure the force AP jumper is inserted onto the board.
  5. Debug the program
  6. Start serial console to watch program output
  7. Connect to the board's WiFi and request the /form.html page.
  8. Enter data into the form and click submit
  9. 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.

  • Hi Trevor,

    Thanks for highlight this issue.

    In general the limitation in the number of tokens depends how busy is your system and what is the speed of your Host.

    The number might vary in average between 6-12 tokens.

    If you need more than few tokens in a single post you can either:

    1) Bind few token into one token (for example coma delimiter etc) using java script as long as the total values will not exceed 64 characters

    or

    2) Split the POST  into few different post transactions (using ajax for example).

    We will highlight this limitation in the programmer's guide

    Thanks again and hope it helps,

    Barak

  • Hello Barak,

    Thanks for the reply, just a few follow up questions. In the test I did, it would simply print out the token name and then return, so the APP processor should be fairly responsive at 80MHz.
    (1) Were you meaning how busy the network processor is?
    (2) Would turning off features such as DNS/mDNS and related features help the issue?
    (3) If we can process up to 12 tokens at once, does this mean that we will always be able to process that many at once. Said differently, is there any promise that if it worked once with 12 tokens, it will work reliably always with 12 tokens?


    Thanks again
  • Hi Trevor,
    The number of tokens that are supported at once is not guaranteed and even if it is working in one scenario it doesn't means it will work the same in other scenarios.
    Turning off the internal application will not increase the number of tokens and it is more relates to the communication load on the interface between the Device and the Host.
    If there are no other activities between the Device and the Host, the 12 tokens are expected to work correctly. More than that might cause to token loss as you experienced.

    However, even if your scenario allow using 12 tokens, my recommendation is to take a safe zone and to make sure that other communications between the Device and the Host will not cause any interference (for example Async events etc) and therefore not to use more than 9-10 tokens anyway (The final number should be decided by analyzing the worst case scenario for your system in that matter, which means you should find the scenario in which the communication between the device and the Host will be the most loaded and validate that in this scenario)

    Hope it make things more clear
    Barak
  • Hi Barak,

    Thanks for clarifying, just one final question for clarity. The Device and Host are referring to the NWP and APPs processors, right? (in the case of the CC3200 that is). I have a feeling it is, but just want to be certain.

    We'll look in to working around this or potentially using our own HTTP server in its place. We are finding more and more that using a different HTTP server will fit our application better.

    Thanks,
    Trevor
  • Hi Trevor,

    Yes, I was referring to the NWP and APPs processor.

    The internal HTTP server, at this phase was intended to provide ability to add simple configurations and statuses pages. There are some limitations with the Tokens method and using the Tokens method alone might not be enough for complex web applications. You can workaround some of these limitation using java script but not all of them and indeed at some point it might be easier for you to use your own HTTP server that is tailored for your exact needs. 

    Thanks again for pointing this issue up,

    Barak

  • Hi Barak,

    Thanks for answering my questions. I'll keep going forward and let you know if I hit any other snags. Thanks again for all your help.

    Trevor