JUCE does not seem to close HTTP connections (but should)


Hi everyone,

I noticed that JUCE, at least on OS X, seems to rely on HTTP servers for closing HTTP connections.

If I do this:

InputStream *in = url.createInputStream(isPost, NULL, NULL, headers, 10000, NULL, NULL, 5, "");
if (in != nullptr) {
    var v = JSON::parse(*in);
    delete in;

all I ever see is an InputStream, implemented by a WebInputStream. Unlike in Java, it doesn’t have close(), and as far as I can tell from digging around in the sources, there’s no other way I can tell the underlying OS objects to close the HTTP connection, once I’m done reading bytes.

What seems to happen instead is that the HTTP connection hangs around (blocking its worker thread and thus other clients) until the server hits its keep alive timeout, shrugs and frees the connection (and the corresponding worker thread).

Is there a way to close an HTTP connection that I missed? Can I fix this with a cast?
Or should InputStreams, like in Java, have a close() method that could close connections?