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.

StellarisWare LWIP SSI causes ACK issue

I am having problems with LWIP Server Side Includes. Some includes work whilst others don't.
A failure results in the PC re-sending the GET command.
The target then continues to retransmit its data.
There appears to be a mismatch in sequence numbers.
For example: Wireshark shows that the target's next sequence number is expected to be 337 but the target next sends 338.

FAILS: sprintf(pcInsert, "");
OK: sprintf(pcInsert, "a");
FAILS: sprintf(pcInsert, "ab");
FAILS: sprintf(pcInsert, "abc");
FAILS: sprintf(pcInsert, "abcd");
OK: sprintf(pcInsert, "abcde");

But the word alignment pattern does not always hold.... Also the target's output is correct, no funnies in the text.

I am using the keil uVision 'enet_lwip' project supplied with StellarisWare (LWIP 1.3.2).
Running on LM3S9D96 compiled using Keil uVision 5.11.1.0 (Armcc V5.04.0.49)

My server side include processing:

static const char *tags[] = {"mytag"};

http_set_ssi_handler(SSIHandler, tags, 1);

int SSIHandler(int iIndex, char *pcInsert, int iInsertLen)
{
int len;

len = api_lru(iIndex, pcInsert, iInsertLen);
return len;
}

Where I have boiled api_lru() down to the lines above.
I have a much larger api_lwip() function that dumps lwip statistics & this function always seems to work. That despite the fact that LWIP statistic increment & so all modulo(4) outputs sizes are generated.
I have made the SSI TAG SIZE 400 bytes.

Also see this issue with NXP examples (LWIP 1.4.1) which suggest that I have something wrong.

Pulling my hair out on this issue.

  • Sorry, the SSI outputs are:

    FAILS: sprintf(pcInsert, "<ptp></ptp>");
    OK: sprintf(pcInsert, "<ptp>a</ptp>");
    FAILS: sprintf(pcInsert,"<ptp>ab</ptp>");
    FAILS: sprintf(pcInsert, "<ptp>abc></ptp>");
    FAILS: sprintf(pcInsert,"<ptp>abcd</ptp>");
    OK: sprintf(pcInsert, "<ptp>abcde</ptp>");