WinHTTP.WinHTTPRequest.5.1和TLS

时间:2018-07-09 19:22:12

标签: paypal tls1.2 winhttprequest

我有一个用经典ASP编写的网站。在PayPal和我的ISP执行TLS 1.2的升级后,以下代码在'objHttp.Send nvpStrComplete'行失败,并显示以下错误:'安全通道支持中发生错误'。整个功能代码如下所示。有人建议吗?

    Function hash_call (nvpStr, unique_id)

    Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")

    nvpStrComplete = "USER=" & gv_APIUser & "&VENDOR=" & gv_APIVendor & "&PARTNER=" & gv_APIPartner & "&PWD=" & gv_APIPassword & nvpStr 
    nvpStrComplete  = nvpStrComplete & "&BUTTONSOURCE=" & Server.URLEncode( gv_BNCode )

    Set SESSION("nvpReqArray")= deformatNVP( nvpStrComplete )
    objHttp.open "POST", gv_APIEndpoint, False
    WinHttpRequestOption_SslErrorIgnoreFlags=4
    objHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300

    objHttp.SetRequestHeader "Content-Type", "text/namevalue"
    objHttp.SetRequestHeader "Content-Length", Len(nvpStrComplete)
    objHttp.SetRequestHeader "X-VPS-CLIENT-TIMEOUT", "45" 
    objHttp.SetRequestHeader "X-VPS-REQUEST-ID", unique_id 
    ' set the host header
    If Env = "pilot" Then
        objHttp.SetRequestHeader "Host", "pilot-payflowpro.paypal.com"
    Else
        objHttp.SetRequestHeader "Host", "payflowpro.paypal.com"
    End If

    If gv_UseProxy Then
        'Proxy Call
        objHttp.SetProxy gv_Proxy,  gv_ProxyServer& ":" &gv_ProxyServerPort
    End If

    on error resume next
    objHttp.Send nvpStrComplete  '<--- failing line

    if Err.Nuber <> 0 Then
        Response.Redirect("ErrorPage.asp?msg=No Purchases can be made at this time on our website. To make a purchase please call our store at: 732-549-4343")
    Else        
        Set nvpResponseCollection = deformatNVP(objHttp.responseText)
        Set hash_call = nvpResponseCollection
        Set objHttp = Nothing 

        If Err.Number <> 0 Then 
            SESSION("Message")  = ErrorFormatter(Err.Description,Err.Number,Err.Source,"hash_call")
            SESSION("nvpReqArray") =  Null
        Else
            SESSION("Message")  = Null
        End If
    End If
End Function

0 个答案:

没有答案