To download the file via http (s) I establish a connection like this:
URL connection = new URL(url); HttpURLConnection urlconn; long size; urlconn = (HttpURLConnection) connection.openConnection(); urlconn.setRequestMethod("GET"); size = urlconn.getContentLengthLong(); urlconn.connect(); InputStream in = null; try { in = urlconn.getInputStream(); } catch (IOException e) { e.printStackTrace(); } It usually works well, but on some files I get:
java.io.IOException: Server returned HTTP response code: 400 the URL for: http://filecdn.to/fsuaget/Y2VkNTFjOTNkN2UzMDk5NmIyMzljMDBmOGZlZWFmZmJmc3RvfDE2MDQyMDI5MzN8MTAwMDB8MHwwfHw3MDU4MDIzZGEzNDQ4NDI5MTZhN2RiNGI4ZGYxMWNlZHwxfDE0Njg3NTM3NTF8dmlkZW8,/The.Walking.Dead.S06E01.1080p.HDTV.FOX HD.ts
If this URL is inserted into the address bar of the browser (Chrome 51.0.2704.103 m), the file is downloaded normally. As far as I understand, Chrome forms the correct request, I do not. What can be done?
%20- Yuriy SPb ♦