有人可以帮我从下面的CURL请求创建经典的asp代码吗?
curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/beshared-repos/"
我尝试了下面的示例代码,但它没有用。
Dim http: Set http = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
Dim url: url = "https://cloud.seafile.com/api2/beshared-repos/"
Dim data: data = "token=f2210dacd9c6ccb8133606d94ff8e61d99b477fd"
With http
Call .Open("GET", url, False)
Call .SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
Call .SetRequestHeader("Authorization", "Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd")
Call .Send()
End With
If Left(http.Status, 1) = 2 Then
'Request succeeded with a HTTP 2xx response, do something...
Else
'Output error
Call Response.Write("Server returned: " & http.Status & " " & http.StatusText)
End If
它会在Call.Send()
行抛出以下错误消息WinHttp.WinHttpRequest错误'80090326'
收到的邮件意外或格式错误。
答案 0 :(得分:1)
问题不在于代码,我刚刚使用版本7.56.0测试了您的location = /catalogsearch/result/ {
return 301 /products?keyword=$arg_q;
}
来电,这是结果;
首先,我在您的问题中尝试了该命令,该命令失败了;
curl
我猜测它不喜欢用于HTTP Authorization标头的单引号,所以替换它们并得到它;
>curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/beshared-repos/"
curl: (6) Could not resolve host: Token
curl: (6) Could not resolve host: f2210dacd9c6ccb8133606d94ff8e61d99b477fd'
curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.
这里的问题是错误:
schannel:SNI或证书检查失败:SEC_E_WRONG_PRINCIPAL(0x80090322) - 目标主体名称不正确。
无论您使用何种方法调用API,都会发生这种情况。
检查地址
>curl -H "Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd" "https://cloud.seafile.com/api2/beshared-repos/"
curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.
在浏览器中会发出警告,指出该网站在Google Chrome中不安全,而使用SSL checker时,SSL证书上的名称显示不匹配。
证书中的所有常用名称都与输入的名称(cloud.seafile.com)不匹配。在Web浏览器中访问此站点时可能会收到错误。 Learn more about name mismatch errors 的