marcosdiez / shareviahttp

Share Via Http - Android
Other
175 stars 37 forks source link

when sharing URL via shareviahttp, it is inappropriately encoded so it fails #63

Open mnalis opened 3 years ago

mnalis commented 3 years ago

Since redirect header Location: does not begin with protocol:// (like https://), it is assumed to be local file (with relative path in current directory) residing on same web server (your mobile phone). The result is that your web browser enters infinite redirect loop...

version is 2.0.8 from f-droid (latest, as newer ones cannot be built due to https://github.com/marcosdiez/shareviahttp/issues/56)

for example, sharing URL from mobile phone web browser results is:

--2021-03-10 12:01:08--  http://192.168.0.172:9999/
Connecting to 192.168.0.172:9999... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 302 Moved Temporarily
  Date: Wed, 10 Mar 2021 12:01:10 GMT+01:00
  Connection: close
  Server: ShareViaHttp 2.0.8
  Location: https%3A%2F%2Fwww.bloomberg.com%2Fgraphics%2Fcovid-vaccine-tracker-global-distribution%2F%23global-time-series-rates
  Expires: Tue, 03 Jul 2001 06:00:00 GMT
  Cache-Control: no-store, no-cache, must-revalidate, max-age=0
  Cache-Control: post-check=0, pre-check=0
  Pragma: no-cache
Location: https%3A%2F%2Fwww.bloomberg.com%2Fgraphics%2Fcovid-vaccine-tracker-global-distribution%2F%23global-time-series-rates [following]
--2021-03-10 12:01:08--  http://192.168.0.172:9999/https%3A%2F%2Fwww.bloomberg.com%2Fgraphics%2Fcovid-vaccine-tracker-global-distribution%2F%23global-time-series-rates
Connecting to 192.168.0.172:9999... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 302 Moved Temporarily
  Date: Wed, 10 Mar 2021 12:01:10 GMT+01:00
  Connection: close
  Server: ShareViaHttp 2.0.8
  Location: https%3A%2F%2Fwww.bloomberg.com%2Fgraphics%2Fcovid-vaccine-tracker-global-distribution%2F%23global-time-series-rates
  Expires: Tue, 03 Jul 2001 06:00:00 GMT
  Cache-Control: no-store, no-cache, must-revalidate, max-age=0
  Cache-Control: post-check=0, pre-check=0
  Pragma: no-cache

[...]
woheller69 commented 3 years ago

the problem seems to be the "%3A%2F%2F" stuff instead of "://" The above commit should fix this because it does not encode URLs starting with "http" again. Should I add it to the open PR?