arduino-libraries/ArduinoHttpClient

Is there any limited number to attach the body in POTS ?

vkcorp opened this issue · 1 comments

I'm testing POST with SIM7000G and TinyGSM, and I found I coudn't attach my text string if it's over 1460 bytes.
My test code :

    String txtData = "";
    uint32_t strLen = 0;
    unsigned int nCount = 0;

    for(int i=0;i<1459;i++)
    {
        txtData += "1";
    }
    
    while(true)
    {
        txtData += "2";
        uint32_t strLen = txtData.length();
        
        HttpClient http(client, SERVER_URL, 80);
    
        http.beginRequest();
        http.post("/debug");
        http.sendHeader("Content-Type", "text/plain");
        http.sendHeader("Content-Length", strLen);
        http.beginBody();
        http.print(txtData);
        http.endRequest();
    
        int httpResponseCode = http.responseStatusCode();
        String body = http.responseBody();

        http.stop();
        if(httpResponseCode == 200)
        {
            DBG("POST.OK");

            nCount++;
            if(nCount >= 500)
            {
                DBG("Breaking test, nCount=", nCount);
                break;
            }
            else
            {
                delay(1000);
            }
        }
        else
        {
            DBG("ERR: Failed to POST=", httpResponseCode);
            break;
        }
    }

From 1461 bytes, I usually I got -3 as error code in my 'httpResponseCode', I think it's 'Timeout'.

I found it's limited by MTU and MODEM, 1460 bytes.

https://stackoverflow.com/a/67336657

We need to support multipl chunks to send more...