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.

SIMPLELINK-CC32XX-SDK: HTTPClient_sendRequest Function Sends Extra CRLF

Part Number: SIMPLELINK-CC32XX-SDK
Other Parts Discussed in Thread: CC3235MODSF

Hi,

We are developing with CC3235MODSF and using the latest Simplelink SDK Version: 6.10.00.05. We are using HTTP GET and POST requests within our application.

While comparing Wireshark captures of sending these requests over CC3235MODSF and Postman, we realized that CC3235MODSF is sending an extra HTTP "Continuation" packet. This packet is basically sending CRLF (2 bytes) to the server after the actual HTTP request:

Here is the difference screenshot on Wireshark:

After looking into the code in httpclient.c, I can see that the HTTPClient_sendRequest function calls the static sendRequest function and within that function, here is the part where sending the body happens:

/* in case a body exists send it */
if(body)
{
    /* In case of chunk, add the chunk length add the beginning of the body */
    if ((flags & HTTPClient_CHUNK_START) || (getCliState(cli, CHUNKED_REQ_STATE)))
    {
        ret = sprsend(cli, 0, "%x \r\n",bodyLen);
        if (ret < 0)
        {
            return (ret);
        }
    }
    /* Send the buf */
    ret = sprsend(cli, SENDBUF,NULL);
    if (ret < 0)
    {
        return (ret);
    }
    /* Send the body payload */
    while(bytesToSend != 0)
    {
        ret = SlNetSock_send(cli->ssock, bodyPtr, bytesToSend, 0);
        if (ret < 0)
        {
            return (ret);
        }
        bytesToSend-=ret;
        if (ret < bytesToSend)
        {
            bodyPtr+=ret;
        }
    }
    ret = sprsend(cli, 0, "\r\n");
    if (ret < 0)
    {
        return (ret);
    }
    if (flags & HTTPClient_CHUNK_START)
    {
        setCliState(cli,CHUNKED_REQ_STATE,true);
    }
    else if (flags & HTTPClient_CHUNK_END)
    {
        ret = sprsend(cli, 0, "0\r\n\r\n");
        if (ret < 0)
        {
            return (ret);
        }
        setCliState(cli,CHUNKED_REQ_STATE,false);
        waitBlocked = true;
    }
    /* Send the buffer */
    ret = sprsend(cli, SENDBUF,NULL);
    if (ret < 0)
    {
        return (ret);
    }
}
else
{
    /* There is no body, send the start line and headers */
    ret = sprsend(cli, SENDBUF,NULL);
    if (ret < 0)
    {
        return (ret);
    }
}

You can see on line 33 above (line 2263 on httpclient.c) that there is a call to sprsend with CRLF. If I comment this line, I don't see the extra CRLF continuation packet anymore.

So, why do we have this line of code? Is this a bug? Is this packet needed when the request is chunked? I don't see any reason to send extra bytes of data if they are not necessary.

Thank you very much for your help.

Best,

Ogulcan