When given a pdf file(And most likely other files)JSoup download the entire file, before it look at the content-type and find out it can’t parse it.
Is there any way to prevent the download of the pdf file itself, so it throws the “Unhandled content type” exception as soon as it have read the http header?
My current code looks like this:
connection = Jsoup.connect(uri.toString());
Document doc=connection.get();
The only solution I can think about, is to read the header myself, and then user parseBodyFragment but that seems like a lot of work, if I also need to calculate the correct charset.
Yes, downloading 1.6.4-Pending solved that problem.