I am attempting to download a jpg using HttpURLConnection and am encountering a very peculiar bug.
Here's the url: http://www.vh1.com/sitewide/promoimages/shows/m/my%5Fantonio/video/supertrailer/seg%5F1/320x240.jpg
if you open it in a browser you will see the image.
However, when I use HttpURLConnection I don't get the image... What I get is a 301 which, quite strangely, redirects to http://wap.vh1.com
so
con.setInstanceFollowRedirects(true);
//additional stream code here to go and get the stuff found in con
proceeds to go ahead and download the text from wap.vh1.com, rather than the jpg that you see in the browser.
I'm guessing that there is some header wackiness that's causing this, but I haven't the faintest idea what the host is expecting to see in order to redirect me to the same place as where it's redirecting the browser (and curl and wget and everything else I can think to point at it).
I'm just about ready to shoot myself, so, if you help me you will be preventing my 6 year old daughter from going fatherless.