arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.23k stars 992 forks source link

Some HTTPS trackers doesn't work on Android #6623

Closed proninyaroslav closed 2 years ago

proninyaroslav commented 2 years ago

Please provide the following information

libtorrent version (or branch): master (libtorrent4j 2.0.4-22-RC1)

platform/architecture: Android ARM64

I'm using libtorrent4j (a Java wrapper over libtorrent master) in my Android app. And I see complaints from users that some trackers don't work with HTTPS. For example, we have a private tracker https://tracker.bj-share.info:2053/.../announce. If I add it as HTTP and not HTTPS then it works. But if I add it as HTTPS, the torrent client cannot connect to it (Network is unreachable and unspecified system error [sock_read]), although I tested this tracker in qBittorrent and it seems to work fine. Any ideas why this is so?

[TORRENT_LOG] *** announce: [ announce_to_all_tiers: 1 announce_to_all_trackers: 1 num_trackers: 1 ]
[TORRENT_LOG] *** tracker:  (0) [ep: 0.0.0.0:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [  i->tier: 0 tier: 2147483647 working: 1 limit: 0 can: 1 sent: 0 ]
[TORRENT_LOG] ==> TRACKER REQUEST "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" event: started abort: 0 ssl: 0x0 port: 55652 ssl-port: 0 fails: 0 upd: 0 ep: 0.0.0.0:55652
[TORRENT_LOG] *** QUEUE_TRACKER_REQUEST [ listen_port: 55652 ]
[TORRENT_LOG] ==> TRACKER_REQUEST [ url: https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce?info_hash=%db%aa%cd%ea%fe)B%27%dfn%80%f6%c1%c0%bdt%d6%b3%7d%bc&peer_id=-Lr3300-N6.syMWG.1Ua&port=55652&uploaded=0&downloaded=0&left=14074713&corrupt=0&key=62D153C1&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0 ]
[TORRENT_LOG] *** tracker:  (0) [ep: [::]:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [  i->tier: 0 tier: 2147483647 working: 1 limit: 0 can: 1 sent: 0 ]
[TORRENT_LOG] ==> TRACKER REQUEST "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" event: started abort: 0 ssl: 0x0 port: 55652 ssl-port: 0 fails: 0 upd: 0 ep: [::]:55652
[TORRENT_LOG] *** QUEUE_TRACKER_REQUEST [ listen_port: 55652 ]
[TORRENT_LOG] ==> TRACKER_REQUEST [ url: https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce?info_hash=%db%aa%cd%ea%fe)B%27%dfn%80%f6%c1%c0%bdt%d6%b3%7d%bc&peer_id=-Lr3300-N6.syMWG.1Ua&port=55652&uploaded=0&downloaded=0&left=14074713&corrupt=0&key=62D153C1&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0 ]
[TORRENT_LOG] *** update_tracker_timer: [ announce_to_all_tiers: 1 announce_to_all_trackers: 1 num_trackers: 1 ]
[TORRENT_LOG] *** tracker: (0) [ep: 0.0.0.0:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [ found: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
[TORRENT_LOG] *** tracker: (0) [ep: [::]:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [ found: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
[TORRENT_LOG] *** update tracker timer: next_announce < now 0 m_waiting_tracker: 0 next_announce_in: 2147483334
[TORRENT_LOG] DHT: private torrent, no DHT announce
[TORRENT_LOG] *** set-max-connections: 40
[TORRENT_LOG] *** set-max-uploads: 4
[TORRENT_LOG] *** tracker error: (101) Network is unreachable [sock_read] 
[TORRENT_LOG] *** increment tracker fail count [ep: [::]:55652 url: https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce 1]
[TORRENT_LOG] *** announce: [ announce_to_all_tiers: 1 announce_to_all_trackers: 1 num_trackers: 1 ]
[TORRENT_LOG] *** tracker:  (0) [ep: 0.0.0.0:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [  i->tier: 0 tier: 2147483647 working: 1 limit: 0 can: 0 sent: 0 ]
[TORRENT_LOG] *** tracker:  (0) [ep: [::]:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [  i->tier: 0 tier: 2147483647 working: 0 limit: 0 can: 0 sent: 0 ]
[TORRENT_LOG] *** update_tracker_timer: [ announce_to_all_tiers: 1 announce_to_all_trackers: 1 num_trackers: 1 ]
[TORRENT_LOG] *** tracker: (0) [ep: 0.0.0.0:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [ found: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
[TORRENT_LOG] *** tracker: (0) [ep: [::]:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [ found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
[TORRENT_LOG] *** update tracker timer: next_announce < now 0 m_waiting_tracker: 1 next_announce_in: 17
[TORRENT_LOG] *** update_tracker_timer: [ announce_to_all_tiers: 1 announce_to_all_trackers: 1 num_trackers: 1 ]
[TORRENT_LOG] *** tracker: (0) [ep: 0.0.0.0:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [ found: 0 i->tier: 0 tier: 2147483647 working: 1 fails: 0 limit: 0 upd: 1 ]
[TORRENT_LOG] *** tracker: (0) [ep: [::]:55652 ] "https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce" [ found: 0 i->tier: 0 tier: 2147483647 working: 0 fails: 1 limit: 0 upd: 0 ]
[TORRENT_LOG] *** update tracker timer: next_announce < now 0 m_waiting_tracker: 2 next_announce_in: 17
[SESSION_LOG] aborting DHT announce timer (125): Operation Canceled
[TORRENT_LOG] *** tracker error: (2) unspecified system error [sock_read] 
[TORRENT_LOG] *** increment tracker fail count [ep: 0.0.0.0:55652 url: https://tracker.bj-share.info:2053/e65g19ni52sn5utlrqtaykuegxhp9bmq/announce 1]
[TORRENT_LOG] *** announce: [ announce_to_all_tiers: 1 announce_to_all_trackers: 1 num_trackers: 1 ]
arvidn commented 2 years ago

perhaps the error codes don't translate well across the C++ <-> Java boundary, and those errors are really SSL errors. It might be worth making sure you have the root certificate that your tracker's SSL certificate was signed by.

It needs to be installed on the system for OpenSSL to pick up.

proninyaroslav commented 2 years ago

I will try to disable SSL certificate verification and I will inform you

proninyaroslav commented 2 years ago

Yes, I tried to turn off the validate_https_trackers flag and the tracker worked. I think it's worth making it as an option in my app.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.