Project

General

Profile

Bug #725

View Source crashes when connecting through a proxy

Added by Tommy Towards 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Next Release
Start date:
06/02/2021
Due date:
% Done:

0%

Estimated time:

Description

When using the Tor or I2P proxy options in the |Proxy| tab (the one with None, Tor, I2P and Custom), and then going to |Page -> View Source| the app crashes (be it on any web page or even on a new tab).
The only way to use |View Source| with Tor or I2P, is to configure and use the Custom proxy, or a VPN.

Also, when connecting to Tor with |Proxy -> Tor| if Orbot is working but doesn't have active the option Allow Background Starts, the popup "Waiting for Orbot to connect" doesn't go away naturally (or it doesn't detect Orbot correctly).

Also also, if using another application to access Tor or I2P, such as TorServices or InviZible Pro, the popup "Proxying through Orbot/I2P will not work unless the Orbot/I2P app is installed." is really annoying as it constantly popup when switching from something else back to Privacy Browser, despite having access to both networks. A way to fix this would be to offer an option to "Never show this again".

TorServices - https://f-droid.org/en/packages/org.torproject.torservices/

InviZible Pro - https://f-droid.org/en/packages/pan.alexander.tordnscrypt.stable/

History

#1

Updated by Tommy Towards 5 months ago

I just realized that when I have |Settings -> Proxy -> Tor or I2P| and the popup "Proxying through Orbot/I2P will not work unless the Orbot/I2P app is installed" appears, on this conditions, if I go to |Settings| and then I close |Settings| via the left arrow on the top left or the back button of the navigation bar, the app crashes, independently if I make a change or not in |Settings| (except changing the Proxy to None or Custom)

#2

Updated by Soren Stoutner 5 months ago

  • Subject changed from Tor and I2P Proxy Problems to View Source crashes when connecting through a proxy
  • Priority changed from 3.x to Next Release

Please only submit one topic per bug report. This is the only way to track fixes. I will address the first topic in this bug report and ignore the rest. If you would like to open new bug reports for those issues I will take a look at them.

The root of this problem is `android.os.NetworkOnMainThreadException` caused by line 253 in ProxyHelper.java:

https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=blob;f=app/src/main/java/com/stoutner/privacybrowser/helpers/ProxyHelper.java;h=f30d71a8f42ba4f184ffcd8ba2c54564f42c60c2;hb=568ac6354411aa26c42077d2b80f8770f6e64695

Called from line 259 of ViewSourceActivity.kt:

https://gitweb.stoutner.com/?p=PrivacyBrowser.git;a=blob;f=app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt;h=b2d50e7c79e96f56fc15c82a51588d73aadd95ff;hb=568ac6354411aa26c42077d2b80f8770f6e64695

It looks like this behavior started when ViewSourceActivity was converted from Java to Kotlin. My guess is that for some reason Kotlin is more strict about this, which in this case is silly, because creating an InetSocketAddress is not in and of itself network activity.

Thanks for catching this bug. I will fix it for the next release.

#3

Updated by Soren Stoutner 5 months ago

Actually, I was wrong. InetSoketAddress performs a DNS lookup on the hostname at creation. However, it is possible to bypass this behavior and reserve the DNS lookup for when the actual network request happens by using InetSocketAddress.createUnresolved.

Also available in: Atom PDF