I don't know why my code breaks. At first I thought it was because parseURL gives [] for the requestHeaders. Okay, so maybe I just need to tell it what the resquestHeaders should be. Well, I examined the requestHeaders generated from my old, working code. It too, returns a []. So now I am out of ideas. Below is the old working code, followed my things I have been trying in GHCi with with new conduits based library.
captureRawJson :: IO Response
captureRawJson = do
nManager <- newManager
jRequest <- parseUrl url :: (IO (Request IO))
jResponse <- httpLbsRedirect jRequest nManager
closeManager nManager
return jResponse
the above works fine, here's what I have been trying to do while migrating, and the error I receive.
Prelude Network.HTTP.Conduit> nManager <- newManager def
Prelude Network.HTTP.Conduit> jRequest <- parseUrl "https://10.69.69.1/cgi-bin/qaLinkEditor.cgi?json=1" :: (IO (Request IO))
Prelude Network.HTTP.Conduit> let response = httpLbs jRequest nManager
Prelude Network.HTTP.Conduit Control.Monad.Trans.Resource> runResourceT response
*** Exception: error unexpected packet: Handshake [ServerHelloDone]
So as you can see, it's almost exactly the same code. So I would like feedback on what has changed, and what I should be looking at more closely. Also, how can I examine the http headers being sent back and forth between my client code and the server?
I believe this was solved with some changes in the tls packages. I just released http-conduit 1.2.5, please have a look and see if it solves the problem.
If you still get an error message, it could be that the SSL cert doesn't match the hostname you're connecting to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With