2013-02-13 76 views
6

我寫了一個CRUD應用程序來與JIRA接口。我最終升級了我的haskell環境,因爲cabal-dev並不能解決所有問題。因此,我有一些破損,每當我嘗試使用任何與JIRA接口的代碼時都會出現此錯誤。突破性變化在哪裏?

Spike: HandshakeFailed (Error_Misc "user error (unexpected type received. expecting 
handshake and got: Alert [(AlertLevel_Warning,UnrecognizedName)])") 

經過一番谷歌搜索之後,我認爲這要麼與使用tls的tls或http-conduit有關。

我目前使用tls-1.1.2http-conduit-1.8.7.1 以前我是用 tls-0.9.11http-conduit >= 1.5 && < 1.7(不知道這究竟,老裝走了。

這是我認爲休息是發生

manSettings :: ManagerSettings 
manSettings = def { managerCheckCerts = \ _ _ _-> return CertificateUsageAccept } 

這是它用來樣子

manSettings :: ManagerSettings 
manSettings = def { managerCheckCerts = \ _ _ -> return CertificateUsageAccept } 

下面是一個使用它

initialRequest :: forall (m :: * -> *). URI -> IO (Request m,Manager) 
initialRequest uri = do 
    initReq <- parseUrl uri -- let the server tell you what the request header 
          -- should look like 
    manager <- newManager manSettings -- a Manager manages http connections 
            -- we mod the settings to handle 
            -- the SSL cert. See manSettings below. 
    return (modReq initReq,manager) 
     where modReq initReq = applyBasicAuth username password initReq 

讓我知道如果我留下的東西了代碼。我不確定此時和現在之間會發生什麼。

回答

4

這是關於誤差來源一個很好的猜測,但可能性非常小:managerCheckCerts簡單地使用證書包來檢查有效期的證書。您看到的錯誤消息似乎來自tls本身,並表示數據傳輸失敗。這可能是一個好主意,通過問題縮小到一個HTTPS調用失敗(或者甚至更好,單獨使用TLS和展示了相同的故障),以便將錯誤報告與TLS,最好是第一。

+0

我會繼續前進,看看我能不能縮小它。 – 2013-02-14 18:07:55