Skip to content
This repository was archived by the owner on Apr 10, 2026. It is now read-only.
This repository was archived by the owner on Apr 10, 2026. It is now read-only.

Onion pages are not rendered correctly (DuckDuckGo: http://3g2upl4pq6kufc4m.onion) #90

@CeCallejas

Description

@CeCallejas

Onion pages are not rendered correctly. I am using UIWebView but I also did a test with WKWebView

    func loadTor() {
        
        let cpaProxyBundleURL: URL = Bundle.init(for: CPAProxyManager.self).url(forResource: "CPAProxy", withExtension: "bundle")!
        let cpaProxyBundle: Bundle = Bundle.init(url: cpaProxyBundleURL)!
        
        let torrcPath: String = cpaProxyBundle.path(forResource: "torrc", ofType: nil)!
        let geoipPath: String = cpaProxyBundle.path(forResource: "geoip", ofType: nil)!
        
        let documentsDirectory: String = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
        let torDataDir: String = (NSURL(fileURLWithPath: documentsDirectory).appendingPathComponent("tor")?.absoluteString)!
        
        let configuration: CPAConfiguration = CPAConfiguration(torrcPath: torrcPath, geoipPath: geoipPath, torDataDirectoryPath: torDataDir)
        
        let cpaProxyManager: CPAProxyManager = CPAProxyManager(configuration: configuration)
        cpaProxyManager.setup(completion: {socksHost,socksPort,error in
            if(error == nil) {
                self.setupCompleted(SOCKSHost: socksHost!, SOCKSPort: Int(socksPort))
            }else {
                print(error!)
                self.infoLabel.text = error.debugDescription
            }
        }, progress: {progress,summaryString in
            self.infoLabel.text = "Progress: \(progress) \(summaryString!)"
            print(cpaProxyManager.status)
        })
        
    }
    
    func setupCompleted(SOCKSHost: String, SOCKSPort: Int) {
        let proxyDict: Dictionary = [kCFStreamPropertySOCKSProxyHost: SOCKSHost,
                                     kCFStreamPropertySOCKSProxyPort: SOCKSPort ] as [CFString : Any]
        
        let configuration: URLSessionConfiguration = URLSessionConfiguration.ephemeral
        configuration.connectionProxyDictionary = proxyDict
        let urlSession: URLSession = URLSession(configuration: configuration, delegate: self, delegateQueue: OperationQueue.main)
        
        // DuckDuckGo
        let url: URL = URL(string: "http://3g2upl4pq6kufc4m.onion/")!
        
        let dataTask = urlSession.dataTask(with: url){ (data, response, error) in
            if error == nil {
                self.torWebView.load(data!, mimeType: "text/html", textEncodingName: "", baseURL: url)
            } else {
                print("ERROR: \(String(describing: error))")
                self.connectButton.isEnabled = true
            }
            
        }
        dataTask.resume()
    }

Debug Console:

2019-10-18 20:09:59.377030-0600 CPAProxyApp[70312:661447] Connection 4: received failure notification
2019-10-18 20:09:59.377294-0600 CPAProxyApp[70312:661447] Connection 4: failed to connect 12:8, reason -1
2019-10-18 20:09:59.377521-0600 CPAProxyApp[70312:661447] Connection 4: encountered error(12:8)
2019-10-18 20:09:59.383605-0600 CPAProxyApp[70312:661447] Connection 5: received failure notification
2019-10-18 20:09:59.383776-0600 CPAProxyApp[70312:661448] Task <9CF51D92-E974-4A2F-956F-13C93941C6E3>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-10-18 20:09:59.384269-0600 CPAProxyApp[70312:661447] Connection 5: failed to connect 12:8, reason -1
2019-10-18 20:09:59.384906-0600 CPAProxyApp[70312:661447] Connection 5: encountered error(12:8)
2019-10-18 20:09:59.391110-0600 CPAProxyApp[70312:661451] NSURLConnection finished with error - code -1003
2019-10-18 20:09:59.393630-0600 CPAProxyApp[70312:661449] Task <38B74AA8-7084-491C-A342-506B49C3F652>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-10-18 20:09:59.404710-0600 CPAProxyApp[70312:661449] NSURLConnection finished with error - code -1003
2019-10-18 20:09:59.416372-0600 CPAProxyApp[70312:661447] Connection 6: received failure notification
2019-10-18 20:09:59.416661-0600 CPAProxyApp[70312:661447] Connection 6: failed to connect 12:8, reason -1
2019-10-18 20:09:59.417252-0600 CPAProxyApp[70312:661447] Connection 6: encountered error(12:8)
2019-10-18 20:09:59.428005-0600 CPAProxyApp[70312:661448] Task <BBFB7F1B-2268-4011-8653-8786C9EF1517>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-10-18 20:09:59.430944-0600 CPAProxyApp[70312:661447] Connection 7: received failure notification
2019-10-18 20:09:59.431291-0600 CPAProxyApp[70312:661447] Connection 7: failed to connect 12:8, reason -1
2019-10-18 20:09:59.431826-0600 CPAProxyApp[70312:661447] Connection 7: encountered error(12:8)
2019-10-18 20:09:59.439004-0600 CPAProxyApp[70312:661447] Connection 8: received failure notification
2019-10-18 20:09:59.439795-0600 CPAProxyApp[70312:661451] Task <E4959707-64D9-4EC9-8752-E09A485441BA>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-10-18 20:09:59.440168-0600 CPAProxyApp[70312:661447] Connection 8: failed to connect 12:8, reason -1
2019-10-18 20:09:59.440250-0600 CPAProxyApp[70312:661449] NSURLConnection finished with error - code -1003
2019-10-18 20:09:59.440864-0600 CPAProxyApp[70312:661447] Connection 8: encountered error(12:8)
2019-10-18 20:09:59.447683-0600 CPAProxyApp[70312:661447] Connection 9: received failure notification
2019-10-18 20:09:59.448166-0600 CPAProxyApp[70312:661447] Connection 9: failed to connect 12:8, reason -1
2019-10-18 20:09:59.448544-0600 CPAProxyApp[70312:661448] Task <304D4982-DF57-4FA0-8BDF-42E00C0A7CF7>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-10-18 20:09:59.449642-0600 CPAProxyApp[70312:661447] Connection 9: encountered error(12:8)
2019-10-18 20:09:59.454632-0600 CPAProxyApp[70312:661447] Task <9AFABA70-F83F-41DB-833C-6BFE4754ED3E>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-10-18 20:09:59.454916-0600 CPAProxyApp[70312:661448] NSURLConnection finished with error - code -1003
2019-10-18 20:09:59.455517-0600 CPAProxyApp[70312:661448] NSURLConnection finished with error - code -1003
2019-10-18 20:09:59.457919-0600 CPAProxyApp[70312:661448] NSURLConnection finished with error - code -1003

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions