создать соединение по http протоколу с удаленным сервером
От: игппук Беларусь  
Дата: 05.03.07 15:41
Оценка:
комрады, подскажите, как правильно сконфигурировать http соединение с удаленным сервером.

я делаю так


string BlogDispatcher::SendXMLService( string _xml )
{
    string reply = "";
    ULONG err = 0;

    HTTPAPI_VERSION hv = HTTPAPI_VERSION_1;
    
    if( ( err = HttpInitialize( hv, HTTP_INITIALIZE_CONFIG, NULL ) ) != NO_ERROR )
    {
        return reply;
    }

    HANDLE httpResponce = NULL;

    HTTP_SERVICE_CONFIG_URLACL_KEY su = { 0 };
    su.pUrlPrefix = L"http://blog.inf.by:80/xmlrpc.php";

    HTTP_SERVICE_CONFIG_URLACL_PARAM sp = { 0 };
    sp.pStringSecurityDescriptor = L"D:(A;;GX;;;S-1-0-0)(A;;GA;;;S-1-5-11)";

    HTTP_SERVICE_CONFIG_URLACL_SET sc = { 0 };
    sc.KeyDesc = su;
    sc.ParamDesc = sp;

    err = HttpSetServiceConfiguration( NULL,
                                       HttpServiceConfigUrlAclInfo,
                                       &sc,
                                       sizeof( sc ),
                                       NULL );

    if( ( err = HttpCreateHttpHandle( &httpResponce, 0 ) ) == NO_ERROR )
    {
        //string url = "http://blog.inf.by/xmlrpc.php";// + "?" + _xml;
        err = HttpAddUrl( httpResponce, L"http://blog.inf.by:80/xmlrpc.php", NULL );

        ULONG bytesSent = 0;
        HTTP_RESPONSE hr = { 0 };

        RtlZeroMemory( &hr, sizeof( hr ) );
        hr.StatusCode = 200;
        hr.pReason = "OK";
         hr.ReasonLength = ( USHORT )strlen( "OK" );

        err = HttpSendHttpResponse( httpResponce,
                                    1,
                                    0,
                                    &hr,
                                    NULL,
                                    &bytesSent,
                                    NULL,
                                    0,
                                    NULL,
                                    NULL );

        CloseHandle( httpResponce );
    }

    HttpTerminate( HTTP_INITIALIZE_SERVER, NULL );

    return reply;
}


HttpSetServiceConfiguration выдает ошибку ERROR_INVALID_PARAMETER
если же в функции HttpInitialize использовать параметр HTTP_INITIALIZE_SERVER и не конфигурировать систему при помощи HttpSetServiceConfiguration, то
ту же ошибку выдает функция HttpAddUrl.

где тут собака порылась?
спасибо.
проклятый антисутенерский закон
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.