【发布时间】:2013-12-06 10:28:10
【问题描述】:
我正在尝试实现一个 c++ 应用程序,该应用程序将使用 IServerXMLHTTPRequest 访问 HTTPS 服务器。
我当前的代码是:
CComPtr<MSXML2::IServerXMLHTTPRequest> xmlHttp;
HRESULT hr = xmlHttp.CoCreateInstance(__uuidof(ServerXMLHTTP));
hr = xmlHttp->open(_T("POST"),_T("https://someurl.com/somepath"),false);
hr = xmlHttp->setTimeouts( 100000,
50000,
100000,
100000
);
hr = xmlHttp->setOption(SXH_OPTION_SELECT_CLIENT_SSL_CERT,
xmlHttp->getOption(SXH_OPTION_SELECT_CLIENT_SSL_CERT));
hr = xmlHttp->setRequestHeader(_T("Content-Type"),_T("application/x-www-form-urlencoded"));
sPostData = ...;
hr = xmlHttp->send((BSTR)sPostData);
当我尝试运行上述代码时,服务器返回 403 (Forbidden) 错误。
这可能是什么原因?还有,我该怎么办?
【问题讨论】:
标签: ssl-certificate http-status-code-403 serverxmlhttp msxml3