0

TIdHTTP::GetEAccessViolation尝试发送GET请求时抛出异常。实际上,我需要检索网页 html-content。我决定使用TIdHTML+ SSL 套接字处理程序(那是因为我需要访问 https)。这是我的代码:

int Foo::bar()
{
    try
    {
        std::auto_ptr<TIdHTTP> idHttp(new TIdHTTP(NULL));
        std::auto_ptr<TIdSSLIOHandlerSocketOpenSSL>
                sslSock(new TIdSSLIOHandlerSocketOpenSSL(NULL));

        idHttp->HandleRedirects = true;        
        idHttp->IOHandler       = sslSock.get();

        AnsiString reply;
        // right there exception is being thrown
        reply = idHttp->Get("https://www.yandex.com/");

        ShowMessage(reply);
    }
    catch(EIdException & e)
    {            
        ShowMessage(e.Message);
    }
    catch(Exception & e)
    {
        ShowMessage(e.Message);
    }
}

实际上,事情是这样的:我的应用程序非常多线程。所有这些东西都在非主线程中执行。根据这篇文章,可能是关于IsMultiThread变量(但我已经将它设置为true),所以我不知道为什么TIdHTTP每次都尝试Read memory at 00000008

4

0 回答 0