現在,在你說有這樣的問題之前,我想指出我已經看過他們大部分沒有任何運氣。我也是第一次來這裏,所以要溫柔。java.io.IOException:無效的Http響應
我現在已經在我目前的計劃這個煩惱:
基本上我的這部分程序使用搜索引擎查找torrent文件。
public static ArrayList<String> search(String args) throws IOException {
args = args.replace(":", "");
ArrayList<String> list = new ArrayList<String>();
URL url = new URL("http://pirateproxy.net/search/" + args + "/");
URLConnection con = url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); <---- THIS
}
public static void main(String[] args) {
try {
search("The Hobbit: The Desolation of Smaug");
} catch (IOException e) {
e.printStackTrace();
}
}
出現錯誤:
java.io.IOException: Invalid Http response
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at service.ServiceDownloader.search(ServiceDownloader.java:20)
at service.ServiceDownloader.main(ServiceDownloader.java:45)
現在最有趣的部分是,它僅出錯這部電影(「霍比特人:史矛革的荒涼」),所有其他的電影作品完美。我不明白這一點。請幫忙。 (我也刪除搜索方法中的每一個不必要的代碼)
如果我沒有在這裏提供足夠的信息,請向我詢問更多信息。
什麼是您在運行時傳遞的參數值?您是否手動檢查了是否打開您嘗試訪問您的代碼 – Stunner
「http://pirateproxy.net/search/The Hobbit The Smaolation of Smaug /」 其中,如果我複製粘貼到地址欄中工作正常。 – AlexP