mit-cml / appinventor-sources

MIT App Inventor Public Open Source
http://appinventor.mit.edu/appinventor-sources/
Apache License 2.0
1.47k stars 2.05k forks source link

Web component GotText/GotFile does not catch 301 #1244

Open ColinTree opened 6 years ago

ColinTree commented 6 years ago

301 may be returned when a request is sended, but GotText/GotFile does not catch this for user. As a result of this, the returning url argument of events are probebly not up to date with the request.

BTW, this seems to be only happened when the original url and the targeting url are in a same protocal. With my test result (website host anonymized):

ewpatton commented 6 years ago

Based on the Android Documentation, this is the expected behavior of HttpURLConnection (which Web uses). It specifically does not handle redirects from HTTP to HTTPS (and vice versa), but otherwise follows up to five redirect requests. I do not think we want to change the behavior of the Web component to silently follow changes in the protocol, except maybe adding a property that would allow upgrades from HTTP to HTTPS if enabled.

ColinTree commented 6 years ago

What about just add a property for this, like named CatchRedirect