URL crash (bug?)


I needed to check the security behaviour for HTTPS connections. So I’ve written this tiny bit of code, and I’m surprised to see it crash (see debugger screenshot). It only crashes once in every 3 or 4 runs, I suspect it’s to do with opening the stream and not reading and data, or perhaps a timing/race condition of some kind.

Am I doing something wrong, or is it a genuine bug?

#include “…/JuceLibraryCode/JuceHeader.h”

using std::cout;

void testConnection(URL url)
    cout << url.toString(true) << "\n";

    int statusCode;

    StringPairArray responseHeaders;
    ScopedPointer<InputStream> stream = url.createInputStream(false, nullptr, nullptr, String::empty, 4000, &responseHeaders, &statusCode);

    if (stream)
        cout << "* OK, status code:" << statusCode << "\n";
        cout << "* FAIL, status code:" << statusCode << "\n";

    cout << "\n";

 int main (int argc, char* argv[])

    cout << SystemStats::getOperatingSystemName() << "\n";
    cout << "HTTPS Behaviour Testing" << "\n";
    cout << "Expect: OK\n";

    cout << "---Expect: STRONG FAIL\n";

    cout << "---Expect: STRONG FAIL\n";

    cout << "---Expect: FAIL (expired cert)\n";

    cout << "---Expect: FAIL (rubbish cipher)\n";

    cout << "---Expect: FAIL (rubbish security setting)\n";

    return 0;



We hit the same thing here - will be posting a fix later today!