Using new SoftAP Http pages to configure other settings

I have an issue if I try to load a lot of data.
I’m trying to send a firmware upgrade via a form to the device in softap mode.
I’m able to receive around half of data (11k over 27k) and after that the connection close and body->read return zero but body->bytes_left return 14863.

I did a wireshark and I can see that all the data is send correctly to the photon.

I’m doing this code in myPage function.

I’m not sure what else I can do because I’m in listening mode and the main loop is not executed
I tried to add delays and Particle.Process() without success…

btw I tried with 0.5.2 and 0.6.0 rc2

if (urlString.indexOf("/upgrade") != -1) {
//Serial.println(body->bytes_left, DEC);

// voici le output:
/*
POST Data: ------WebKitFormBoundaryEEbsS0VLVz50qOeT
Content-Disposition: form-data; name="myfile"; filename="binfile"
Content-Type: application/octet-stream

content file here...
*/

uint8_t contentData[512];
int dataPos;
int datalength = body->read(contentData, sizeof(contentData));
String contentString = String((const char*)contentData);
Serial.print((const char*)&contentData[0]);

dataPos = contentString.indexOf("filename=");
Serial.printlnf("Index of filename: %d", dataPos);

if(dataPos != -1)
{
    // Get filename here if we want
    String filename = contentString.substring(dataPos + 10, contentString.indexOf("Content-Type")-1);
    Serial.printlnf("Filename: %s", filename.c_str());
}


dataPos = contentString.indexOf("octet-stream");
Serial.printlnf("Index of octet-stream: %d", dataPos);
if(dataPos != -1)
{
    dataPos += 12 + 4;            
    Serial.println("Data start here:");
    datalength -= dataPos;

    while (body->bytes_left)
{
                // dump data on serial port for now
                Serial.printf("%.2x", contentData[dataPos]);
                dataPos++;
                if (dataPos == datalength)
                {
                    //for (uint32_t ms = millis(); millis() - ms <= 100; Particle.process());
                    datalength = body->read(contentData, sizeof(contentData));
                    do
                    {
                        if(datalength == -1)
                            Serial.println("Datalength -1");
                        delay(50);
                        datalength = body->read(contentData, sizeof(contentData));
                        if (datalength == 0)
                        {
                            Serial.printlnf("Length = 0, Bytes left: %d", body->bytes_left);
                        }
                    } while (datalength <= 0 && body->bytes_left);
                    dataPos = 0;
                }
            }
        Serial.println("No more data");
        delay(20);    
    }

Thanks!