woheller69 / omweather

GNU General Public License v3.0
401 stars 17 forks source link

Bypasses configured proxy #76

Closed eku closed 9 months ago

eku commented 9 months ago

Describe the bug Using the app behind a proxy results in an error "Das Gerät ist nicht mit dem Internet verbunden". The main gateway logs direct access of the app to the internet.

How to Reproduce Steps to reproduce the behavior:

  1. Configure WLAN profile with proxy
  2. Do not allow direct internet acces on the network gateway
  3. Start app and refresh
  4. See error

Expected behavior The app uses the configure WLAN proxy.

Screenshots N/A

Environment (please complete the following information):

I can provide a network sniffer log, if needed.

woheller69 commented 9 months ago

the app needs to ping the internet. So you need to fix it your proxy

eku commented 9 months ago

@woheller69 ICMP echo request/reply is not allowed behind a proxy, only HTTP(S) connection. That's the idea of a proxy.

Please do not test the connection status in the app yourself, but use the information from Android.

woheller69 commented 9 months ago

Which information?

eku commented 9 months ago

https://developer.android.com/training/monitoring-device-state/connectivity-status-type https://developer.android.com/develop/connectivity/network-ops/reading-network-state

woheller69 commented 9 months ago

That stuff is not reliable

eku commented 9 months ago

That stuff is not reliable

Why not. Just connect to the weather server when Android sends connected callback. If failed, try when app get's callback again. And so on.

As we can see, the ICMP test is even less reliable.

woheller69 commented 9 months ago

Feel free to implement and test accross a wide range of devices. Then open a PR

eku commented 9 months ago

Feel free to implement and test accross a wide range of devices. Then open a PR

I will replace your app with a different one.

eku commented 9 months ago

As far as I understand the code at https://github.com/woheller69/omweather/blob/master/app/src/main/java/org/woheller69/weather/services/UpdateDataService.java#L130 it does a DNS lookup for api.open-meteo.com. As the result may already be cached on the device, this is not a reliable test for an existing Internet connection.

The question still remains as to why omWeather does not use the proxy configured in the WLAN profile. This could be due to the com.android.volley library.

See

Once the cause has been clarified, it should be easy for you to correct the error.

woheller69 commented 9 months ago

You can simply remove the check and compile your own version. The currently implemented solution has been working for years over a wide range of devices and Android versions. Now there is one user where it is not working. I will not spend time in investigating this and I will not risk a degradation for other users.