HTTP POST in Windows and Linux with large files


In the Linux and win32 versions of JUCE URL the headers are sent in fixed size 1024 byte chunks. I have found a hack from back in the day in our code base that could be interesting for upstream. I am pretty sure it was for uploading large files via POST.

In sendHeader in juce_linux_Network.cpp and openHTTPConnection in juce_win32_network.cpp the fixed 1024 is increased to 8192 if the requestHeader.getSize() is bigger than 1MB. I do not know how these numbers were chosen.

This might be a case for some upload benchmarking?


At least on linux, you really shouldn’t be using juce_linux_Network.cpp. It’s only for fallback and doesn’t even support https. Use juce_curl_Network.cpp instead by enabling curl in the Projucer:


Thinking about it we are using the CURL one now (we needed HTTPS). I am doing an audit on our internal JUCE changes and this one must be form a long time ago. I think the theory of the change still stands. I assume the CURL interface (like the mac one) uses its internal calculations for buffer sending size.