mkoehnke / WKZombie

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTPS request unable to parse

avisual opened this issue · comments

Cancelling Rendering - Optional("REQUEST\nhttps://192.168.0.1:12380/")
.2016-10-26 21:09:43.529 DYC[12587:442455] Unable to parse.

I can give you an external address to this if you need it, it is using a self sign cert just wondering how to get round this

Hi @avisual . I haven't tried it yet, but maybe this works:

browser.authenticationHandler = { (challenge) -> (URLSession.AuthChallengeDisposition, URLCredential?) in
   return(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
}

Let me know. Thanks!

No Afraid that didn't work. same issue, tried increasing time out to 60 seconds just incase it was slow to respond.

I also added the suggested to info.plist

Hi @avisual . So, I finally found the time to test it myself. The code I've posted above should work, but only in combination with the NSAppTransportSecurity setting in the Info.plist. For debugging, you can set NSAllowsArbitraryLoads to YES. A better way is to use NSExceptionDomains like this:

screen shot 2016-10-29 at 11 07 33 pm

I've added a test for self signed certificates in the authentication-branch. Take a look.

Hope that helps.

REQUEST
https://xxx.xxx.xxx.xxx:12380
[.An SSL error has occurred and a secure connection to the server cannot be made.
]

.

There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).
View certificate

I'm not an expert regarding App Transport Security, but it should work with self signed certificates. Maybe it's a misconfiguration issue. Anyway, using the option NSAllowsArbitraryLoads should work in any case:

screen shot 2016-10-30 at 9 08 08 pm

Try it and let me know.

Hope that helped. Will close this ticket for now due to inactivity. Feel free to reopen it if you're still seeing this issue.