Closing prevous connection if redirect (#1314)

CODENVY-538:Closing previous connection if redirect
Signed-off-by: Vitaly Parfonov <vparfonov@codenvy.com>
6.19.x
Vitalii Parfonov 2016-05-20 14:44:01 +03:00
parent cd418b35c6
commit 5e8d7d42d8
1 changed files with 3 additions and 1 deletions

View File

@ -278,7 +278,9 @@ public class IoUtil {
if (redirect) {
String newUrl = conn.getHeaderField("Location");
// open the new connection again
http = (HttpURLConnection)new URL(newUrl).openConnection();
http.disconnect();
conn = new URL(newUrl).openConnection();
http = (HttpURLConnection)conn;
http.setRequestMethod(HttpMethod.GET);
}
}