IBurpExtenderCallbacks.makeHttpRequest() throws RuntimeException
If the network connection fails, callbacks.makeHttpRequest throws a RuntimeException. Any way we could get that method to declare that it throws a proper subclass of (presumably) IOException so we could check for and handle it in code?
Thanks for your message. I agree, it would be better to throw some kind of IOException in this scenario.
I’ve created a story on our development backlog for this. I’m afraid this won’t get particularly high priority, and there are concerns about breaking compatibility. But we’ll get to it eventually.
Please let us know if you need any further assistance.
URL url = new URL(requestUrl);
IHttpService service = new HttpService(url);
IHttpRequestResponse ihrr = callbacks.makeHttpRequest(service, requestBytes);
byte responseBytes = ihrr.getResponse();
I'd be interested to know which cases produce which results. In my testing I simulated a bad network connection by turning WiFi completely off. Is there a bug in the API?
I tried out some examples and it depends on the type of error. DNS failure produces an exception, while a closed port produces a null response.
While this isn’t an ideal interface, you should be able to use it fine if you check for both exceptions and null.
At some point we’ll be doing a refactor of the API and we’ll endeavor to make error handling clearer then.