JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

URL class timeouts

Open francoisbecker opened this issue 8 years ago • 3 comments

URL class: set the connection timeout for functions that internally use the createInputStream function but do not provide this parameter in their interface, like readEntireTextStream().

francoisbecker avatar Mar 27 '17 08:03 francoisbecker

OK, I see what you're trying to do, but this really doesn't fit for several reasons.. The URL class is a by-value class, so can't have mutating methods, and would need to copy this new member variable.

It could have a withTimeout() method, but at a semantic level, this really goes beyond the responsibility of the URL class, since a timeout isn't a property that goes with the address, it's only of interest to code that's responsible for opening the URL. Not sure what to suggest as a way to get around your problem, but this isn't the place for it. Maybe we just need to add options to other code that opens a URL.

julianstorer avatar Mar 27 '17 10:03 julianstorer

Ok, yes, this doesn't fit very well. It's the smallest workaround patch I could devise. Or maybe use an options struct as a call parameter (including most of the parameters of the URL::createInputStream method)?

francoisbecker avatar Mar 27 '17 14:03 francoisbecker

maybe use an options struct as a call parameter (including most of the parameters of the URL::createInputStream method)?

That would be the cleanest solution in my opinion too, I'm already kinda doing that myself for connections to web APIs and it works quite well

yfede avatar Apr 06 '17 07:04 yfede