deal with createInputRaw() casting issue (#3514)

This commit is contained in:
Ben Fry
2015-07-31 11:50:08 -04:00
parent 9c2763d691
commit 971f692e65
3 changed files with 20 additions and 12 deletions
+14 -11
View File
@@ -6664,18 +6664,21 @@ public class PApplet implements PConstants {
try {
URL url = new URL(filename);
URLConnection conn = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) conn;
// Will not handle a protocol change (see below)
httpConn.setInstanceFollowRedirects(true);
int response = httpConn.getResponseCode();
// Normally will not follow HTTPS redirects from HTTP due to security concerns
// http://stackoverflow.com/questions/1884230/java-doesnt-follow-redirect-in-urlconnection/1884427
if (response >= 300 && response < 400) {
String newLocation = httpConn.getHeaderField("Location");
return createInputRaw(newLocation);
if (conn instanceof HttpURLConnection) {
HttpURLConnection httpConn = (HttpURLConnection) conn;
// Will not handle a protocol change (see below)
httpConn.setInstanceFollowRedirects(true);
int response = httpConn.getResponseCode();
// Normally will not follow HTTPS redirects from HTTP due to security concerns
// http://stackoverflow.com/questions/1884230/java-doesnt-follow-redirect-in-urlconnection/1884427
if (response >= 300 && response < 400) {
String newLocation = httpConn.getHeaderField("Location");
return createInputRaw(newLocation);
}
return conn.getInputStream();
} else if (conn instanceof JarURLConnection) {
return url.openStream();
}
return conn.getInputStream();
} catch (MalformedURLException mfue) {
// not a url, that's fine
+2
View File
@@ -4,6 +4,8 @@ X tweak implementation of PVector.heading()
X https://github.com/processing/processing/issues/3511
X make PFont.size protected again
X https://github.com/processing/processing/issues/3519
X fix problem with JAR loading inside createInputRaw()
o https://github.com/processing/processing/pull/3514
opengl
+4 -1
View File
@@ -5,6 +5,9 @@ X Add message that says it's safe to ignore the tools.jar warning
X add new lower console/errors icons
_ don't show display warning when display 1 doesn't exist
_ can't install processing-java into /usr/bin with El Capitan
_ https://github.com/processing/processing/issues/3497
fixed earlier
X font fixes for Georgia in the examples
X contribs listed multiple times
@@ -21,7 +24,7 @@ X https://github.com/processing/processing/issues/3481
X https://github.com/processing/processing/pull/3489
X include mode imports when rewriting .properties file
X https://github.com/processing/processing/pull/3499
_ https://github.com/processing/processing/issues/3492
X https://github.com/processing/processing/issues/3492
beta