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.

POST using HTTPClient_sendRequest() getting stuck for larger body length

Other Parts Discussed in Thread: CC3220SF

Dear all,

during my tests I found problem when initiating a POST request using a function HTTPClient_sendRequest(); With body length up to 32 764 bytes it works fine. I can POST data to server and get response 200OK back. For body length between 32 765 and 32 767 bytes the function terminates with error -2005: [ERROR] - FATAL ERROR: Driver Abort detected. For body length 32 768 bytes and larger the function gets stuck and never returns.

The device I'm using is CC3220SF.

Any advice on this issue will be appreciated.

Thank you

  • Hi Daniel,

    I was able to re-create your issue. Unfortunately I currently do not have the capacity to debug further so I submitted an internal ticket for this bug. You can try to debug yourself since the source code is available. Just add files like httpclient.c to your local project so you can step through HTTPClient_sendRequest and add any other dependencies it might need. 

    Thanks for sharing. Will update when I have new information.

    Jesu

  • Hi Jesu,

    thanks for answer. I've done some debugging and it comes down to a function sl_Send() in sl_socket.c. This function accepts only data with max length _i16 (should be 32767 bytes, but based on my tests it actually is only 32764 bytes). In case of supplying longer data, it returns zero which propagates upwards and causes the function SlNetSock_send() returning zero as well. The zero return causes the function sendRequest() in httpclient.c to lock up. The problem is in the following section:

            /* 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;
                }
            }

    Zero return causes that the loop never terminates.

    After modifying it as below, I was able to send data with any length (using HTTPClient_sendRequest()).

            uint32_t len;
            /* Send the body payload */
            while(bytesToSend != 0)
            {
                if(bytesToSend > 32000)
                {
                    len = 32000;
                }
                else
                {
                    len = bytesToSend;
                }
    
                ret = SlNetSock_send(cli->ssock, bodyPtr, len, 0);
                if (ret < 0)
                {
                    return (ret);
                }
                bytesToSend-=ret;
                bodyPtr+=ret;
            }

    Hope it helps.

    Daniel