Вызов httpsendrequest вернул ошибку 12002

Появилась ошибка «WinHTTP 12002» или «WinHTTP 12152»

При отправке документа в окне мониторинга СБИС Коннекта появилась ошибка. В логах указано «Ошибка WinHTTP 12002» или «Ошибка WinHTTP 12152».

Причина

  • «WinHTTP 12002» — превышен тайм-аут. Ответ от online.sbis.ru не был получен в течение минуты. Есть проблемы с интернет-соединением.
  • «WinHTTP 12152» — на запрос пришел неправильный ответ. Прокси-сервер не может установить соединение с online.sbis.ru или сервер провайдера блокирует доступ.

Решение

Откройте online.sbis.ru в браузере Internet Explorer без использования СБИС Коннекта или SDK. Если в браузере появилось сообщение:

  • «Вы не подключены к сети» — проверьте интернет-соединение. Попробуйте настроить браузер для работы со СБИС.
  • «Не удается отобразить эту страницу» — проверьте настройки СБИС Коннекта и прокси-сервера. После этого повторно откройте сайт.

Добейтесь, чтобы в Internet Explorer открылся сайт online.sbis.ru. После этого запустите СБИС Коннект или SDK. Отправьте или получите документы.

Нашли неточность? Выделите текст с ошибкой и нажмите ctrl + enter.

Hi,

I’m trying to configure the the client side WinHTTP connect/send/receive timeout on Windows 7/2008. However they don’t seem to take effect.

Instead WinHttpSendRequest comes back with 12002 always after 21 seconds when trying with a fake IP as destination (not sure how else to simulate).

It may worth mentioning that I tried both by using WinHttpSetTimeouts and by setting each option individually with WinHttpSetOption with no difference.

The results of my quick test look like this:

WinHttpUsageExample.exe «10.20.30.40» 50 (timeout in secs)

default WINHTTP_OPTION_RESOLVE_TIMEOUT: -1
default WINHTTP_OPTION_CONNECT_TIMEOUT: 60000
default WINHTTP_OPTION_SEND_TIMEOUT: 30000
default WINHTTP_OPTION_RECEIVE_TIMEOUT: 30000
——————————————————————————-

current WINHTTP_OPTION_RESOLVE_TIMEOUT: 50000
current WINHTTP_OPTION_CONNECT_TIMEOUT: 50000
current WINHTTP_OPTION_SEND_TIMEOUT: 50000
current WINHTTP_OPTION_RECEIVE_TIMEOUT: 50000
——————————————————————————-

Before WinHttpSendRequest time is 16:36:28
After WinHttpSendRequest time is 16:36:49, errno: 12002
Error 12002 has occurred.

Could this be a WinHTTP bug?

Am I not simulating correctly? How to then?

Could it be in this case that the ERROR_WINHTTP_TIMEOUT is returned as result of lower tcp level timeout(s) expiration (not mentioned in WinHTTP doc)?

Pretty much in the dark here. Any help would be highly appreciated.

Cheers,
Bogdan

Also, in case one may be curious, here’s the source of my small test program:

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <windows.h>
#include <winhttp.h>
#include <time.h>

static wchar_t* charToWChar(const char* text)
{
    size_t size = strlen(text) + 1;
    wchar_t* wa = new wchar_t[size];
    mbstowcs(wa,text,size);
    return wa;
}

int main(int argc, char* argv[])
{
  DWORD dwSize = 0;
  DWORD dwDownloaded = 0;
  LPSTR pszOutBuffer;
  BOOL  bResults = FALSE;
  HINTERNET  hSession = NULL,
             hConnect = NULL,
             hRequest = NULL;

  DWORD timeoutval = 0;
  DWORD size = sizeof(DWORD);
  wchar_t *httpserver = NULL;  
  char timeStr [9];    

  if(argc < 3)
  {
          printf( «usage: WinHttpUsageExample.exe <http server name/address> <winhttp global timeout in seconds>n»);

          return 0;
  }

  // Use WinHttpOpen to obtain a session handle.
  hSession = WinHttpOpen( L»WinHTTP Example/1.0″,  
                          WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,

                          WINHTTP_NO_PROXY_NAME,

                          WINHTTP_NO_PROXY_BYPASS, 0 );

  WinHttpQueryOption(hSession, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);

  printf( «——————————————————————————-n»);

  timeoutval = atol(argv[2]) * 1000; //convert seconds to milliseconds
  httpserver = charToWChar( argv[1] ); // convert the string type

  /* Use WinHttpSetTimeouts to set a new time-out values (resolve, connect, send, receive) */

  if (!WinHttpSetTimeouts( hSession, timeoutval, timeoutval, timeoutval, timeoutval))

  {
       printf(«Error %u in WinHttpSetTimeouts.n», GetLastError());

  }

  // Specify an HTTP server.
  if( hSession )
    hConnect = WinHttpConnect( hSession, httpserver,
                               INTERNET_DEFAULT_HTTPS_PORT, 0 );

  // Create an HTTP request handle.
  if( hConnect )
    hRequest = WinHttpOpenRequest( hConnect, L»GET», NULL,
                                   NULL, WINHTTP_NO_REFERER,

                                   WINHTTP_DEFAULT_ACCEPT_TYPES,

                                   WINHTTP_FLAG_SECURE );

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);  

  printf( «——————————————————————————-n»);

  _strtime_s( timeStr );
  printf( «Before WinHttpSendRequest time is %s n», timeStr);  

  // Send a request.
  if( hRequest )
  {
          bResults = WinHttpSendRequest( hRequest,

                                   WINHTTP_NO_ADDITIONAL_HEADERS, 0,

                                   WINHTTP_NO_REQUEST_DATA, 0,

                                   0, 0 );

          _strtime_s( timeStr );
          printf( «After WinHttpSendRequest time is %s, errno: %d n», timeStr, GetLastError( ));

  }

 

  // Receive response
  if( bResults )
  {
        bResults = WinHttpReceiveResponse( hRequest, NULL );

        _strtime_s( timeStr );
        printf( «Afer WinHttpReceiveResponse time is %s, errno: %d n», timeStr, GetLastError( ));

  }

  // Keep checking for data until there is nothing left.
  if( bResults )
  {
    do
    {
      // Check for available data.
      dwSize = 0;
      if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )
        printf( «Error %u in WinHttpQueryDataAvailable.n»,

                GetLastError( ) );

      // Allocate space for the buffer.
      pszOutBuffer = new char[dwSize+1];
      if( !pszOutBuffer )
      {
        printf( «Out of memoryn» );
        dwSize=0;
      }
      else
      {
        // Read the data.
        ZeroMemory( pszOutBuffer, dwSize+1 );

        if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,

                              dwSize, &dwDownloaded ) )

          printf( «Error %u in WinHttpReadData.n», GetLastError( ) );

        else
          printf( «%s», pszOutBuffer );

        // Free the memory allocated to the buffer.
        delete [] pszOutBuffer;
      }
    } while( dwSize > 0 );
  }

 
  // Report any errors.
  if( !bResults )
    printf( «Error %d has occurred.n», GetLastError( ) );

  // Close any open handles.
  if( hRequest ) WinHttpCloseHandle( hRequest );
  if( hConnect ) WinHttpCloseHandle( hConnect );
  if( hSession ) WinHttpCloseHandle( hSession );

 
  return 0;
}

The Client sends some data to Server via HttpSendRequest:

            if (!HttpSendRequest(request.get(), NULL, 0,
                     const_cast<char *>(request_body.data()),
                     static_cast<DWORD>(request_body.size()))) {
                // return false;
            }

My Server received all data in request_body then send response:

            char success_message[] =
                    "HTTP/1.1 200 OK" "n"
                    "Content-Type: text/xml; charset=utf-8" "n"
                    "Content-Length: 0" "n";

(I send this response via socket)
but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

So my question is:

  1. Is my reponse message in wrong format?
  2. When HttpSendRequest return from blocking?

Edit 1:
this is the request from client, there are more data but not need, i though

    POST / HTTP/1.1
    Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
    User-Agent: Breakpad/1.0 (Windows)
    Host: 127.0.0.1:1519
    Content-Length: 437805
    Cache-Control: no-cache

    -----------------------------0000002900004823
    Content-Disposition: form-data; name="channel"


    -----------------------------0000002900004823

The Client sends some data to Server via HttpSendRequest:

            if (!HttpSendRequest(request.get(), NULL, 0,
                     const_cast<char *>(request_body.data()),
                     static_cast<DWORD>(request_body.size()))) {
                // return false;
            }

My Server received all data in request_body then send response:

            char success_message[] =
                    "HTTP/1.1 200 OK" "n"
                    "Content-Type: text/xml; charset=utf-8" "n"
                    "Content-Length: 0" "n";

(I send this response via socket)
but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

So my question is:

  1. Is my reponse message in wrong format?
  2. When HttpSendRequest return from blocking?

Edit 1:
this is the request from client, there are more data but not need, i though

    POST / HTTP/1.1
    Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
    User-Agent: Breakpad/1.0 (Windows)
    Host: 127.0.0.1:1519
    Content-Length: 437805
    Cache-Control: no-cache

    -----------------------------0000002900004823
    Content-Disposition: form-data; name="channel"


    -----------------------------0000002900004823
Icon Ex Номер ошибки: Ошибка 12002
Название ошибки: IE Error 12002
Описание ошибки: Ошибка 12002: Возникла ошибка в приложении Internet Explorer. Приложение будет закрыто. Приносим извинения за неудобства.
Разработчик: Microsoft Corporation
Программное обеспечение: Internet Explorer
Относится к: Windows XP, Vista, 7, 8, 10, 11

«IE Error 12002» Введение

Как правило, практикующие ПК и сотрудники службы поддержки знают «IE Error 12002» как форму «ошибки во время выполнения». Разработчики программного обеспечения пытаются обеспечить, чтобы программное обеспечение было свободным от этих сбоев, пока оно не будет публично выпущено. К сожалению, такие проблемы, как ошибка 12002, могут не быть исправлены на этом заключительном этапе.

Ошибка 12002 также отображается как «IE Error 12002». Это распространенная ошибка, которая может возникнуть после установки программного обеспечения. Если происходит «IE Error 12002», разработчикам будет сообщено об этой проблеме, хотя отчеты об ошибках встроены в приложение. Microsoft Corporation вернется к коду и исправит его, а затем сделает обновление доступным для загрузки. Таким образом, когда ваш компьютер выполняет обновления, как это, это, как правило, чтобы исправить проблемы ошибки 12002 и другие ошибки внутри Internet Explorer.

Проблема с исходным кодом Internet Explorer приведет к этому «IE Error 12002», чаще всего на этапе запуска. Мы можем определить происхождение ошибок ошибки 12002 во время выполнения следующим образом:

Ошибка 12002 Crash — она называется «Ошибка 12002», когда программа неожиданно завершает работу во время работы (во время выполнения). Эти ошибки обычно возникают, когда входы Internet Explorer не могут быть правильно обработаны, или они смущены тем, что должно быть выведено.

Утечка памяти «IE Error 12002» — при утечке памяти Internet Explorer это может привести к медленной работе устройства из-за нехватки системных ресурсов. Повреждение памяти и другие потенциальные ошибки в коде могут произойти, когда память обрабатывается неправильно.

Ошибка 12002 Logic Error — логическая ошибка Internet Explorer возникает, когда она производит неправильный вывод, несмотря на то, что пользователь предоставляет правильный ввод. Это связано с ошибками в исходном коде Microsoft Corporation, обрабатывающих ввод неправильно.

Основные причины Microsoft Corporation ошибок, связанных с файлом IE Error 12002, включают отсутствие или повреждение файла, или, в некоторых случаях, заражение связанного Internet Explorer вредоносным ПО в прошлом или настоящем. Возникновение подобных проблем является раздражающим фактором, однако их легко устранить, заменив файл Microsoft Corporation, из-за которого возникает проблема. Если ошибка IE Error 12002 возникла в результате его удаления по причине заражения вредоносным ПО, мы рекомендуем запустить сканирование реестра, чтобы очистить все недействительные ссылки на пути к файлам, созданные вредоносной программой.

Типичные ошибки IE Error 12002

Обнаруженные проблемы IE Error 12002 с Internet Explorer включают:

  • «Ошибка IE Error 12002. «
  • «Ошибка программного обеспечения Win32: IE Error 12002»
  • «Извините, IE Error 12002 столкнулся с проблемой. «
  • «К сожалению, мы не можем найти IE Error 12002. «
  • «Отсутствует файл IE Error 12002.»
  • «Ошибка запуска программы: IE Error 12002.»
  • «IE Error 12002 не выполняется. «
  • «IE Error 12002 остановлен. «
  • «Ошибка в пути к программному обеспечению: IE Error 12002. «

Ошибки IE Error 12002 EXE возникают во время установки Internet Explorer, при запуске приложений, связанных с IE Error 12002 (Internet Explorer), во время запуска или завершения работы или во время установки ОС Windows. При появлении ошибки IE Error 12002 запишите вхождения для устранения неполадок Internet Explorer и чтобы HelpMicrosoft Corporation найти причину.

Источники проблем IE Error 12002

Эти проблемы IE Error 12002 создаются отсутствующими или поврежденными файлами IE Error 12002, недопустимыми записями реестра Internet Explorer или вредоносным программным обеспечением.

В частности, проблемы IE Error 12002 возникают через:

  • Недопустимая (поврежденная) запись реестра IE Error 12002.
  • Загрязненный вирусом и поврежденный IE Error 12002.
  • Другая программа злонамеренно или по ошибке удалила файлы, связанные с IE Error 12002.
  • Другое приложение, конфликтующее с IE Error 12002 или другими общими ссылками.
  • Internet Explorer/IE Error 12002 поврежден от неполной загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

@ras0219-msft is it ok that vcpkg is still broken when installed behind a proxy?

A clean vcpkg installation on windows fails to download powershell, 7-zip and nuget just at the beginning, when installing your first library.

Subsequent downloads are working (they still often fail for no apparent reason at all) , the first three nope and I have to download them manually from a browser and move them inside the vcpkg/downloads folder.
I still didn’t inspect why, but these downloads are done in a different way (broken, it seems), because they are totally not tested for proxy support. Also the fact that proxy support is so weak that usually I prefer to do the «download-only» part on the WSL side is depressing (same pc, same proxy, somehow the linux part is more proxy resilient), so that I don’t fear of finding the update stopped because one of the library failed to download (never happened when not using proxy).

Just to let you know, vcpkg on windows is the only program that gives me any problem with «dropped internet connection», so i’d not declare our proxy as guilty. Also, even when vcpkg is failing repeatedly, any browser installed can download the tar.gz with no problem, and as I said also the WSL version can, without any annoyance.

Please fix it. For any enterprise adoption of vcpkg, a proper proxy support is a deal breaker. It’s still far from being here.

Подскажите пожалуйста, что означает ошибка 12002 полученная с помощью GetLastError() после HttpSendRequest()?
В MSDN (апрель 2003) ничего про эту ошибку не нашел . Код вызвавший ошибку:

    fprintf(streamLog,"Sending POST to server %s, script %sn",m_sURL,m_sScript);
    static TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencodedrn");
    LPCSTR acc = "Accept: */*";
    HINTERNET hSession = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
    if(hSession != NULL) {
        HINTERNET hConnect = InternetConnect(hSession, m_sURL,INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
        if(hConnect != NULL) {
            HINTERNET hRequest = HttpOpenRequest(hConnect, "POST", m_sScript,NULL, NULL, &acc, INTERNET_FLAG_SECURE, 1);
            if(hRequest != NULL) { 
                BOOL res = HttpSendRequest(hRequest, hdrs, strlen(hdrs), m_sPOST.GetBuffer(), m_sPOST.GetLength());
                if (res) {
                    fprintf(streamLog,"Sending request validn");
                    bFlag = true;
                } else {
                    DWORD dw = GetLastError();

                    LPVOID lpMsgBuf;
                    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
                                FORMAT_MESSAGE_FROM_SYSTEM | 
                                FORMAT_MESSAGE_IGNORE_INSERTS,
                                NULL,
                                dw,
                                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                                (LPTSTR) &lpMsgBuf,
                                0,
                                NULL);
                    fprintf(streamLog,"Error during sending request (%s): [%d] %sn",m_sPOST,dw,(LPCTSTR)lpMsgBuf);        
                    LocalFree( lpMsgBuf );
                }

                const DWORD sz = 1000;
                char     Buffer[sz];
                DWORD    bytesRead ;

                BOOL readFile = InternetReadFile(hRequest, Buffer, sz, &bytesRead);
                fprintf(streamLog,"nnReceived:n");
                for (int j=0;j<bytesRead;j++)
                    fprintf(streamLog,"%c",Buffer[j]);
                
                InternetCloseHandle(hRequest);
            } else
                fprintf(streamLog,"Request failedn");
            InternetCloseHandle(hConnect);
        } else
            fprintf(streamLog,"Connect not openedn");
        InternetCloseHandle(hSession);
    } else 
        fprintf(streamLog,"Session not openedn");

Заранее большое спасибо, за помощь!

… << RSDN@Home 1.1.3 stable >>

12002 ERROR_INTERNET_TIMEOUT
The request has timed out.
Плохо ищите — это нашел в МСДН

The Client sends some data to Server via HttpSendRequest:

            if (!HttpSendRequest(request.get(), NULL, 0,
                     const_cast<char *>(request_body.data()),
                     static_cast<DWORD>(request_body.size()))) {
                // return false;
            }

My Server received all data in request_body then send response:

            char success_message[] =
                    "HTTP/1.1 200 OK" "\n"
                    "Content-Type: text/xml; charset=utf-8" "\n"
                    "Content-Length: 0" "\n";

(I send this response via socket)
but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

So my question is:

  1. Is my reponse message in wrong format?
  2. When HttpSendRequest return from blocking?

Edit 1:
this is the request from client, there are more data but not need, i though

    POST / HTTP/1.1
    Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
    User-Agent: Breakpad/1.0 (Windows)
    Host: 127.0.0.1:1519
    Content-Length: 437805
    Cache-Control: no-cache

    -----------------------------0000002900004823
    Content-Disposition: form-data; name="channel"


    -----------------------------0000002900004823

Появилась ошибка «WinHTTP 12002» или «WinHTTP 12152»

При отправке документа в окне мониторинга СБИС Коннекта появилась ошибка. В логах указано «Ошибка WinHTTP 12002» или «Ошибка WinHTTP 12152».

Причина

  • «WinHTTP 12002» — превышен тайм-аут. Ответ от online.sbis.ru не был получен в течение минуты. Есть проблемы с интернет-соединением.
  • «WinHTTP 12152» — на запрос пришел неправильный ответ. Прокси-сервер не может установить соединение с online.sbis.ru или сервер провайдера блокирует доступ.

Решение

Откройте online.sbis.ru в браузере Internet Explorer без использования СБИС Коннекта или SDK. Если в браузере появилось сообщение:

  • «Вы не подключены к сети» — проверьте интернет-соединение. Попробуйте настроить браузер для работы со СБИС.
  • «Не удается отобразить эту страницу» — проверьте настройки СБИС Коннекта и прокси-сервера. После этого повторно откройте сайт.

Добейтесь, чтобы в Internet Explorer открылся сайт online.sbis.ru. После этого запустите СБИС Коннект или SDK. Отправьте или получите документы.

Нашли неточность? Выделите текст с ошибкой и нажмите ctrl + enter.

Hi,

I’m trying to configure the the client side WinHTTP connect/send/receive timeout on Windows 7/2008. However they don’t seem to take effect.

Instead WinHttpSendRequest comes back with 12002 always after 21 seconds when trying with a fake IP as destination (not sure how else to simulate).

It may worth mentioning that I tried both by using WinHttpSetTimeouts and by setting each option individually with WinHttpSetOption with no difference.

The results of my quick test look like this:

WinHttpUsageExample.exe «10.20.30.40» 50 (timeout in secs)

default WINHTTP_OPTION_RESOLVE_TIMEOUT: -1
default WINHTTP_OPTION_CONNECT_TIMEOUT: 60000
default WINHTTP_OPTION_SEND_TIMEOUT: 30000
default WINHTTP_OPTION_RECEIVE_TIMEOUT: 30000
——————————————————————————-

current WINHTTP_OPTION_RESOLVE_TIMEOUT: 50000
current WINHTTP_OPTION_CONNECT_TIMEOUT: 50000
current WINHTTP_OPTION_SEND_TIMEOUT: 50000
current WINHTTP_OPTION_RECEIVE_TIMEOUT: 50000
——————————————————————————-

Before WinHttpSendRequest time is 16:36:28
After WinHttpSendRequest time is 16:36:49, errno: 12002
Error 12002 has occurred.

Could this be a WinHTTP bug?

Am I not simulating correctly? How to then?

Could it be in this case that the ERROR_WINHTTP_TIMEOUT is returned as result of lower tcp level timeout(s) expiration (not mentioned in WinHTTP doc)?

Pretty much in the dark here. Any help would be highly appreciated.

Cheers,
Bogdan

Also, in case one may be curious, here’s the source of my small test program:

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <windows.h>
#include <winhttp.h>
#include <time.h>

static wchar_t* charToWChar(const char* text)
{
    size_t size = strlen(text) + 1;
    wchar_t* wa = new wchar_t[size];
    mbstowcs(wa,text,size);
    return wa;
}

int main(int argc, char* argv[])
{
  DWORD dwSize = 0;
  DWORD dwDownloaded = 0;
  LPSTR pszOutBuffer;
  BOOL  bResults = FALSE;
  HINTERNET  hSession = NULL,
             hConnect = NULL,
             hRequest = NULL;

  DWORD timeoutval = 0;
  DWORD size = sizeof(DWORD);
  wchar_t *httpserver = NULL;  
  char timeStr [9];    

  if(argc < 3)
  {
          printf( «usage: WinHttpUsageExample.exe <http server name/address> <winhttp global timeout in seconds>n»);

          return 0;
  }

  // Use WinHttpOpen to obtain a session handle.
  hSession = WinHttpOpen( L»WinHTTP Example/1.0″,  
                          WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,

                          WINHTTP_NO_PROXY_NAME,

                          WINHTTP_NO_PROXY_BYPASS, 0 );

  WinHttpQueryOption(hSession, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

  printf(«default WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);

  printf( «——————————————————————————-n»);

  timeoutval = atol(argv[2]) * 1000; //convert seconds to milliseconds
  httpserver = charToWChar( argv[1] ); // convert the string type

  /* Use WinHttpSetTimeouts to set a new time-out values (resolve, connect, send, receive) */

  if (!WinHttpSetTimeouts( hSession, timeoutval, timeoutval, timeoutval, timeoutval))

  {
       printf(«Error %u in WinHttpSetTimeouts.n», GetLastError());

  }

  // Specify an HTTP server.
  if( hSession )
    hConnect = WinHttpConnect( hSession, httpserver,
                               INTERNET_DEFAULT_HTTPS_PORT, 0 );

  // Create an HTTP request handle.
  if( hConnect )
    hRequest = WinHttpOpenRequest( hConnect, L»GET», NULL,
                                   NULL, WINHTTP_NO_REFERER,

                                   WINHTTP_DEFAULT_ACCEPT_TYPES,

                                   WINHTTP_FLAG_SECURE );

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

  WinHttpQueryOption(hRequest, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

  printf(«current WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);  

  printf( «——————————————————————————-n»);

  _strtime_s( timeStr );
  printf( «Before WinHttpSendRequest time is %s n», timeStr);  

  // Send a request.
  if( hRequest )
  {
          bResults = WinHttpSendRequest( hRequest,

                                   WINHTTP_NO_ADDITIONAL_HEADERS, 0,

                                   WINHTTP_NO_REQUEST_DATA, 0,

                                   0, 0 );

          _strtime_s( timeStr );
          printf( «After WinHttpSendRequest time is %s, errno: %d n», timeStr, GetLastError( ));

  }

 

  // Receive response
  if( bResults )
  {
        bResults = WinHttpReceiveResponse( hRequest, NULL );

        _strtime_s( timeStr );
        printf( «Afer WinHttpReceiveResponse time is %s, errno: %d n», timeStr, GetLastError( ));

  }

  // Keep checking for data until there is nothing left.
  if( bResults )
  {
    do
    {
      // Check for available data.
      dwSize = 0;
      if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )
        printf( «Error %u in WinHttpQueryDataAvailable.n»,

                GetLastError( ) );

      // Allocate space for the buffer.
      pszOutBuffer = new char[dwSize+1];
      if( !pszOutBuffer )
      {
        printf( «Out of memoryn» );
        dwSize=0;
      }
      else
      {
        // Read the data.
        ZeroMemory( pszOutBuffer, dwSize+1 );

        if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,

                              dwSize, &dwDownloaded ) )

          printf( «Error %u in WinHttpReadData.n», GetLastError( ) );

        else
          printf( «%s», pszOutBuffer );

        // Free the memory allocated to the buffer.
        delete [] pszOutBuffer;
      }
    } while( dwSize > 0 );
  }

 
  // Report any errors.
  if( !bResults )
    printf( «Error %d has occurred.n», GetLastError( ) );

  // Close any open handles.
  if( hRequest ) WinHttpCloseHandle( hRequest );
  if( hConnect ) WinHttpCloseHandle( hConnect );
  if( hSession ) WinHttpCloseHandle( hSession );

 
  return 0;
}

The Client sends some data to Server via HttpSendRequest:

            if (!HttpSendRequest(request.get(), NULL, 0,
                     const_cast<char *>(request_body.data()),
                     static_cast<DWORD>(request_body.size()))) {
                // return false;
            }

My Server received all data in request_body then send response:

            char success_message[] =
                    "HTTP/1.1 200 OK" "n"
                    "Content-Type: text/xml; charset=utf-8" "n"
                    "Content-Length: 0" "n";

(I send this response via socket)
but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

So my question is:

  1. Is my reponse message in wrong format?
  2. When HttpSendRequest return from blocking?

Edit 1:
this is the request from client, there are more data but not need, i though

    POST / HTTP/1.1
    Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
    User-Agent: Breakpad/1.0 (Windows)
    Host: 127.0.0.1:1519
    Content-Length: 437805
    Cache-Control: no-cache

    -----------------------------0000002900004823
    Content-Disposition: form-data; name="channel"


    -----------------------------0000002900004823

The Client sends some data to Server via HttpSendRequest:

            if (!HttpSendRequest(request.get(), NULL, 0,
                     const_cast<char *>(request_body.data()),
                     static_cast<DWORD>(request_body.size()))) {
                // return false;
            }

My Server received all data in request_body then send response:

            char success_message[] =
                    "HTTP/1.1 200 OK" "n"
                    "Content-Type: text/xml; charset=utf-8" "n"
                    "Content-Length: 0" "n";

(I send this response via socket)
but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

So my question is:

  1. Is my reponse message in wrong format?
  2. When HttpSendRequest return from blocking?

Edit 1:
this is the request from client, there are more data but not need, i though

    POST / HTTP/1.1
    Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
    User-Agent: Breakpad/1.0 (Windows)
    Host: 127.0.0.1:1519
    Content-Length: 437805
    Cache-Control: no-cache

    -----------------------------0000002900004823
    Content-Disposition: form-data; name="channel"


    -----------------------------0000002900004823
Icon Ex Номер ошибки: Ошибка 12002
Название ошибки: IE Error 12002
Описание ошибки: Ошибка 12002: Возникла ошибка в приложении Internet Explorer. Приложение будет закрыто. Приносим извинения за неудобства.
Разработчик: Microsoft Corporation
Программное обеспечение: Internet Explorer
Относится к: Windows XP, Vista, 7, 8, 10, 11

«IE Error 12002» Введение

Как правило, практикующие ПК и сотрудники службы поддержки знают «IE Error 12002» как форму «ошибки во время выполнения». Разработчики программного обеспечения пытаются обеспечить, чтобы программное обеспечение было свободным от этих сбоев, пока оно не будет публично выпущено. К сожалению, такие проблемы, как ошибка 12002, могут не быть исправлены на этом заключительном этапе.

Ошибка 12002 также отображается как «IE Error 12002». Это распространенная ошибка, которая может возникнуть после установки программного обеспечения. Если происходит «IE Error 12002», разработчикам будет сообщено об этой проблеме, хотя отчеты об ошибках встроены в приложение. Microsoft Corporation вернется к коду и исправит его, а затем сделает обновление доступным для загрузки. Таким образом, когда ваш компьютер выполняет обновления, как это, это, как правило, чтобы исправить проблемы ошибки 12002 и другие ошибки внутри Internet Explorer.

Проблема с исходным кодом Internet Explorer приведет к этому «IE Error 12002», чаще всего на этапе запуска. Мы можем определить происхождение ошибок ошибки 12002 во время выполнения следующим образом:

Ошибка 12002 Crash — она называется «Ошибка 12002», когда программа неожиданно завершает работу во время работы (во время выполнения). Эти ошибки обычно возникают, когда входы Internet Explorer не могут быть правильно обработаны, или они смущены тем, что должно быть выведено.

Утечка памяти «IE Error 12002» — при утечке памяти Internet Explorer это может привести к медленной работе устройства из-за нехватки системных ресурсов. Повреждение памяти и другие потенциальные ошибки в коде могут произойти, когда память обрабатывается неправильно.

Ошибка 12002 Logic Error — логическая ошибка Internet Explorer возникает, когда она производит неправильный вывод, несмотря на то, что пользователь предоставляет правильный ввод. Это связано с ошибками в исходном коде Microsoft Corporation, обрабатывающих ввод неправильно.

Основные причины Microsoft Corporation ошибок, связанных с файлом IE Error 12002, включают отсутствие или повреждение файла, или, в некоторых случаях, заражение связанного Internet Explorer вредоносным ПО в прошлом или настоящем. Возникновение подобных проблем является раздражающим фактором, однако их легко устранить, заменив файл Microsoft Corporation, из-за которого возникает проблема. Если ошибка IE Error 12002 возникла в результате его удаления по причине заражения вредоносным ПО, мы рекомендуем запустить сканирование реестра, чтобы очистить все недействительные ссылки на пути к файлам, созданные вредоносной программой.

Типичные ошибки IE Error 12002

Обнаруженные проблемы IE Error 12002 с Internet Explorer включают:

  • «Ошибка IE Error 12002. «
  • «Ошибка программного обеспечения Win32: IE Error 12002»
  • «Извините, IE Error 12002 столкнулся с проблемой. «
  • «К сожалению, мы не можем найти IE Error 12002. «
  • «Отсутствует файл IE Error 12002.»
  • «Ошибка запуска программы: IE Error 12002.»
  • «IE Error 12002 не выполняется. «
  • «IE Error 12002 остановлен. «
  • «Ошибка в пути к программному обеспечению: IE Error 12002. «

Ошибки IE Error 12002 EXE возникают во время установки Internet Explorer, при запуске приложений, связанных с IE Error 12002 (Internet Explorer), во время запуска или завершения работы или во время установки ОС Windows. При появлении ошибки IE Error 12002 запишите вхождения для устранения неполадок Internet Explorer и чтобы HelpMicrosoft Corporation найти причину.

Источники проблем IE Error 12002

Эти проблемы IE Error 12002 создаются отсутствующими или поврежденными файлами IE Error 12002, недопустимыми записями реестра Internet Explorer или вредоносным программным обеспечением.

В частности, проблемы IE Error 12002 возникают через:

  • Недопустимая (поврежденная) запись реестра IE Error 12002.
  • Загрязненный вирусом и поврежденный IE Error 12002.
  • Другая программа злонамеренно или по ошибке удалила файлы, связанные с IE Error 12002.
  • Другое приложение, конфликтующее с IE Error 12002 или другими общими ссылками.
  • Internet Explorer/IE Error 12002 поврежден от неполной загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

@ras0219-msft is it ok that vcpkg is still broken when installed behind a proxy?

A clean vcpkg installation on windows fails to download powershell, 7-zip and nuget just at the beginning, when installing your first library.

Subsequent downloads are working (they still often fail for no apparent reason at all) , the first three nope and I have to download them manually from a browser and move them inside the vcpkg/downloads folder.
I still didn’t inspect why, but these downloads are done in a different way (broken, it seems), because they are totally not tested for proxy support. Also the fact that proxy support is so weak that usually I prefer to do the «download-only» part on the WSL side is depressing (same pc, same proxy, somehow the linux part is more proxy resilient), so that I don’t fear of finding the update stopped because one of the library failed to download (never happened when not using proxy).

Just to let you know, vcpkg on windows is the only program that gives me any problem with «dropped internet connection», so i’d not declare our proxy as guilty. Also, even when vcpkg is failing repeatedly, any browser installed can download the tar.gz with no problem, and as I said also the WSL version can, without any annoyance.

Please fix it. For any enterprise adoption of vcpkg, a proper proxy support is a deal breaker. It’s still far from being here.

Подскажите пожалуйста, что означает ошибка 12002 полученная с помощью GetLastError() после HttpSendRequest()?
В MSDN (апрель 2003) ничего про эту ошибку не нашел . Код вызвавший ошибку:

    fprintf(streamLog,"Sending POST to server %s, script %sn",m_sURL,m_sScript);
    static TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencodedrn");
    LPCSTR acc = "Accept: */*";
    HINTERNET hSession = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
    if(hSession != NULL) {
        HINTERNET hConnect = InternetConnect(hSession, m_sURL,INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
        if(hConnect != NULL) {
            HINTERNET hRequest = HttpOpenRequest(hConnect, "POST", m_sScript,NULL, NULL, &acc, INTERNET_FLAG_SECURE, 1);
            if(hRequest != NULL) { 
                BOOL res = HttpSendRequest(hRequest, hdrs, strlen(hdrs), m_sPOST.GetBuffer(), m_sPOST.GetLength());
                if (res) {
                    fprintf(streamLog,"Sending request validn");
                    bFlag = true;
                } else {
                    DWORD dw = GetLastError();

                    LPVOID lpMsgBuf;
                    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
                                FORMAT_MESSAGE_FROM_SYSTEM | 
                                FORMAT_MESSAGE_IGNORE_INSERTS,
                                NULL,
                                dw,
                                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                                (LPTSTR) &lpMsgBuf,
                                0,
                                NULL);
                    fprintf(streamLog,"Error during sending request (%s): [%d] %sn",m_sPOST,dw,(LPCTSTR)lpMsgBuf);        
                    LocalFree( lpMsgBuf );
                }

                const DWORD sz = 1000;
                char     Buffer[sz];
                DWORD    bytesRead ;

                BOOL readFile = InternetReadFile(hRequest, Buffer, sz, &bytesRead);
                fprintf(streamLog,"nnReceived:n");
                for (int j=0;j<bytesRead;j++)
                    fprintf(streamLog,"%c",Buffer[j]);
                
                InternetCloseHandle(hRequest);
            } else
                fprintf(streamLog,"Request failedn");
            InternetCloseHandle(hConnect);
        } else
            fprintf(streamLog,"Connect not openedn");
        InternetCloseHandle(hSession);
    } else 
        fprintf(streamLog,"Session not openedn");

Заранее большое спасибо, за помощь!

… << RSDN@Home 1.1.3 stable >>

12002 ERROR_INTERNET_TIMEOUT
The request has timed out.
Плохо ищите — это нашел в МСДН

За последние несколько недель некоторые пользователи сообщали об ошибке httpsendrequest 12002.

ПК работает медленно?

  • 1. Загрузите ASR Pro с веб-сайта
  • 2. Установите его на свой компьютер.
  • 3. Запустите сканирование, чтобы найти вредоносные программы или вирусы, которые могут скрываться в вашей системе.
  • Улучшите скорость своего компьютера сегодня, загрузив это программное обеспечение — оно решит проблемы с вашим ПК. г.

    Различные проблемы при обучении на веб-сайтах на самом деле могут быть вызваны тем, что ваши текущие индивидуальные системные часы Windows обычно настроены на неправильное время, дату или часовой пояс. Вы захотите получить одно из следующих электронных писем Roblox: Ваше системное время неверно.

    Я проверяю производительность одного из наших внутренних интернет-приложений. Я могу успешно запустить сценарий, представленный в VuGen (9.52), затем Performance Center (9.5) снова выдает следующие ошибки:

    Action.c(1288): Ошибка -27492: “HttpSendRequest” не удалось, код ошибки Windows = 12002 Превышен предел повторных попыток (0) для URL=”https://xxx/yyy/zzz/aaa /bbb /cccc/ portpo_performance.do?”, обзорная информация

    Есть еще много ошибок, указывающих на различия. URL-адреса. Я всегда пытался достичь 30, хотя многие пользователи иногда видят ошибки при посещении 10 пользователей, или это могут быть пользователи, которым 15, а иногда и 21 лет. Я использую 1 LG.

    К вашему сведению, лично я использую Механизм воспроизведения WinInet является стандартной ошибкой сокета 401 (даже в отношении, я бы сказал, функции web_set_user) из-за некоторых безопасных апплетов JAVA. Я даже не могу отключить аутентификацию поля со списком, потому что она выдает ошибки исключения.

    Action.c(52): Error-27492: Failed, “httpsendrequest” код ошибки Windows = 12002 и максимальное число повторных попыток (0) превышено для URL=”https:/xxx/yyyy/zzzz/ homePage.do”, информация о снимке [mx 1 1]

    У меня возникли проблемы с надежной загрузкой обновлений с этой консоли SCCM. Выберите этот параметр, если вы, несомненно, используете ADR при загрузке или физической загрузке. Использование Ie для ручной настройки чувствительности URL дает следующие результаты:

    <ул>

  • httpsendrequest failed 12002

    Когда я открываю IE на SCCM SUP/Primary Server и открываю конкретный URL-адрес обновления, который именно не работает, он подключается (с задержкой 1-2 минуты или две) и успешно загружается.

    l>

  • Когда я использую один конкретный персональный (домашний) компьютер с замещающим URL-адресом, который не работает, он сразу же подключается без дополнительных усилий.

  • Если вы используете все URL-адреса для обновления загрузки цен на данном SUP/основном сервере интернет-хостинга SCCM, оно будет загружено как можно скорее

  • Не удалось выполнить операцию WinHttp, ошибка 12002?

    Та же проблема возникает, когда я использую своего пользователя учетную запись и блок управления SCCM на моем компьютере, используя учетную запись администратора сразу на всех основных серверах SUP/SCCM.

    Некоторые обновления ни в коем случае не работают, некоторые работают. Я думаю, что обновления Edge, а также обновления Windows 10 LCU обычно работают. Примером может быть «Microsoft Edge-Stable Version Channel восемьдесят шесть обновлений для выпусков на базе x64 (сборка 86.0.622.63)»

    <ул>

  • 0x87D20417

  • <ул>

  • Не удалось реализовать обновление контента с идентификатором 17248647, созданное в сети. Ошибка=12002

  • <ул>

  • Ошибка HttpSendRequest 12002

  • ПК работает медленно?

    ASR Pro — идеальное решение для ремонта вашего ПК! Он не только быстро и безопасно диагностирует и устраняет различные проблемы с Windows, но также повышает производительность системы, оптимизирует память, повышает безопасность и точно настраивает ваш компьютер для максимальной надежности. Так зачем ждать? Начните сегодня!

    Загрузить http://download.windowsupdate.com/c/msdownload/update/software/updt/2020/11/microsoftedgeenterprisex64_d5fddf397a9f1cbd48f036c426fab97a24a7f7a2.cab в C:WindowsTEMPCAB280D .tmp и классификация 12002 назад

  • <ул>

  • Как исправить код ошибки 12002?

    Скачать Outbyte PC Repair Узнайте больше об Outbyte; инструкции по удалению; ЛСКП; Политика конфиденциальности.Установите приложение.Нажмите «Сканировать сейчас» на любом устройстве, чтобы обнаружить проблемы и аномалии.Нажмите кнопку «Исправить все», чтобы устранить проблемы.

    Ошибка: невозможно загрузить контент с сайта с идентификатором 17248647. Ошибка: произошла ужасная ошибка при загрузке обновления приложений. (12007)

  • <ул>

  • Я временно предоставил всем полный доступ к этой папке, которая состоит из подпапок, являющихся частью местоположения пакета развертывания, и C:WindowsTemp

  • httpsendrequest error 12002

    Я создал дополнительные пакеты развертывания для тестирования без вашего участия.

  • Что такое код ошибки 12002?

    Улучшите скорость своего компьютера сегодня, загрузив это программное обеспечение — оно решит проблемы с вашим ПК. г.

    Solution For Httpsenrequest 12002 Error
    Solution Relative à L’erreur Httpsenrequest 12002
    Httpsenrequest 12002 오류에 대한 솔루션
    Lösning För Att Göra Httpsenrequest 12002-fel
    Soluzione In Ordine Per Httpsenrequest Errore 12002
    Solución Para Lograr El Error Httpsenrequest 12002
    Solução Para O Erro Httpsenrequest 12002
    Rozwiązanie Błędu Httpsenrequest 12002
    Lösung Wegen Httpsenrequest 12002-Fehler
    Oplossing Voor Httpsenrequest 12002-fout
    г.

    The Client sends some data to Server via HttpSendRequest:

                if (!HttpSendRequest(request.get(), NULL, 0,
                         const_cast<char *>(request_body.data()),
                         static_cast<DWORD>(request_body.size()))) {
                    // return false;
                }
    

    My Server received all data in request_body then send response:

                char success_message[] =
                        "HTTP/1.1 200 OK" "n"
                        "Content-Type: text/xml; charset=utf-8" "n"
                        "Content-Length: 0" "n";
    

    (I send this response via socket)
    but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

    So my question is:

    1. Is my reponse message in wrong format?
    2. When HttpSendRequest return from blocking?

    Edit 1:
    this is the request from client, there are more data but not need, i though

        POST / HTTP/1.1
        Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
        User-Agent: Breakpad/1.0 (Windows)
        Host: 127.0.0.1:1519
        Content-Length: 437805
        Cache-Control: no-cache
    
        -----------------------------0000002900004823
        Content-Disposition: form-data; name="channel"
    
    
        -----------------------------0000002900004823
    

    Hi,

    I’m trying to configure the the client side WinHTTP connect/send/receive timeout on Windows 7/2008. However they don’t seem to take effect.

    Instead WinHttpSendRequest comes back with 12002 always after 21 seconds when trying with a fake IP as destination (not sure how else to simulate).

    It may worth mentioning that I tried both by using WinHttpSetTimeouts and by setting each option individually with WinHttpSetOption with no difference.

    The results of my quick test look like this:

    WinHttpUsageExample.exe «10.20.30.40» 50 (timeout in secs)

    default WINHTTP_OPTION_RESOLVE_TIMEOUT: -1
    default WINHTTP_OPTION_CONNECT_TIMEOUT: 60000
    default WINHTTP_OPTION_SEND_TIMEOUT: 30000
    default WINHTTP_OPTION_RECEIVE_TIMEOUT: 30000
    ——————————————————————————-

    current WINHTTP_OPTION_RESOLVE_TIMEOUT: 50000
    current WINHTTP_OPTION_CONNECT_TIMEOUT: 50000
    current WINHTTP_OPTION_SEND_TIMEOUT: 50000
    current WINHTTP_OPTION_RECEIVE_TIMEOUT: 50000
    ——————————————————————————-

    Before WinHttpSendRequest time is 16:36:28
    After WinHttpSendRequest time is 16:36:49, errno: 12002
    Error 12002 has occurred.

    Could this be a WinHTTP bug?

    Am I not simulating correctly? How to then?

    Could it be in this case that the ERROR_WINHTTP_TIMEOUT is returned as result of lower tcp level timeout(s) expiration (not mentioned in WinHTTP doc)?

    Pretty much in the dark here. Any help would be highly appreciated.

    Cheers,
    Bogdan

    Also, in case one may be curious, here’s the source of my small test program:

    #define _CRT_SECURE_NO_WARNINGS
    #include <stdio.h>
    #include <windows.h>
    #include <winhttp.h>
    #include <time.h>

    static wchar_t* charToWChar(const char* text)
    {
        size_t size = strlen(text) + 1;
        wchar_t* wa = new wchar_t[size];
        mbstowcs(wa,text,size);
        return wa;
    }

    int main(int argc, char* argv[])
    {
      DWORD dwSize = 0;
      DWORD dwDownloaded = 0;
      LPSTR pszOutBuffer;
      BOOL  bResults = FALSE;
      HINTERNET  hSession = NULL,
                 hConnect = NULL,
                 hRequest = NULL;

      DWORD timeoutval = 0;
      DWORD size = sizeof(DWORD);
      wchar_t *httpserver = NULL;  
      char timeStr [9];    

      if(argc < 3)
      {
              printf( «usage: WinHttpUsageExample.exe <http server name/address> <winhttp global timeout in seconds>n»);

              return 0;
      }

      // Use WinHttpOpen to obtain a session handle.
      hSession = WinHttpOpen( L»WinHTTP Example/1.0″,  
                              WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,

                              WINHTTP_NO_PROXY_NAME,

                              WINHTTP_NO_PROXY_BYPASS, 0 );

      WinHttpQueryOption(hSession, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);

      printf( «——————————————————————————-n»);

      timeoutval = atol(argv[2]) * 1000; //convert seconds to milliseconds
      httpserver = charToWChar( argv[1] ); // convert the string type

      /* Use WinHttpSetTimeouts to set a new time-out values (resolve, connect, send, receive) */

      if (!WinHttpSetTimeouts( hSession, timeoutval, timeoutval, timeoutval, timeoutval))

      {
           printf(«Error %u in WinHttpSetTimeouts.n», GetLastError());

      }

      // Specify an HTTP server.
      if( hSession )
        hConnect = WinHttpConnect( hSession, httpserver,
                                   INTERNET_DEFAULT_HTTPS_PORT, 0 );

      // Create an HTTP request handle.
      if( hConnect )
        hRequest = WinHttpOpenRequest( hConnect, L»GET», NULL,
                                       NULL, WINHTTP_NO_REFERER,

                                       WINHTTP_DEFAULT_ACCEPT_TYPES,

                                       WINHTTP_FLAG_SECURE );

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);  

      printf( «——————————————————————————-n»);

      _strtime_s( timeStr );
      printf( «Before WinHttpSendRequest time is %s n», timeStr);  

      // Send a request.
      if( hRequest )
      {
              bResults = WinHttpSendRequest( hRequest,

                                       WINHTTP_NO_ADDITIONAL_HEADERS, 0,

                                       WINHTTP_NO_REQUEST_DATA, 0,

                                       0, 0 );

              _strtime_s( timeStr );
              printf( «After WinHttpSendRequest time is %s, errno: %d n», timeStr, GetLastError( ));

      }

     

      // Receive response
      if( bResults )
      {
            bResults = WinHttpReceiveResponse( hRequest, NULL );

            _strtime_s( timeStr );
            printf( «Afer WinHttpReceiveResponse time is %s, errno: %d n», timeStr, GetLastError( ));

      }

      // Keep checking for data until there is nothing left.
      if( bResults )
      {
        do
        {
          // Check for available data.
          dwSize = 0;
          if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )
            printf( «Error %u in WinHttpQueryDataAvailable.n»,

                    GetLastError( ) );

          // Allocate space for the buffer.
          pszOutBuffer = new char[dwSize+1];
          if( !pszOutBuffer )
          {
            printf( «Out of memoryn» );
            dwSize=0;
          }
          else
          {
            // Read the data.
            ZeroMemory( pszOutBuffer, dwSize+1 );

            if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,

                                  dwSize, &dwDownloaded ) )

              printf( «Error %u in WinHttpReadData.n», GetLastError( ) );

            else
              printf( «%s», pszOutBuffer );

            // Free the memory allocated to the buffer.
            delete [] pszOutBuffer;
          }
        } while( dwSize > 0 );
      }

     
      // Report any errors.
      if( !bResults )
        printf( «Error %d has occurred.n», GetLastError( ) );

      // Close any open handles.
      if( hRequest ) WinHttpCloseHandle( hRequest );
      if( hConnect ) WinHttpCloseHandle( hConnect );
      if( hSession ) WinHttpCloseHandle( hSession );

     
      return 0;
    }

    Появилась ошибка «WinHTTP 12002» или «WinHTTP 12152»

    При отправке документа в окне мониторинга СБИС Коннекта появилась ошибка. В логах указано «Ошибка WinHTTP 12002» или «Ошибка WinHTTP 12152».

    Причина

    • «WinHTTP 12002» — превышен тайм-аут. Ответ от online.sbis.ru не был получен в течение минуты. Есть проблемы с интернет-соединением.
    • «WinHTTP 12152» — на запрос пришел неправильный ответ. Прокси-сервер не может установить соединение с online.sbis.ru или сервер провайдера блокирует доступ.

    Решение

    Откройте online.sbis.ru в браузере Internet Explorer без использования СБИС Коннекта или SDK. Если в браузере появилось сообщение:

    • «Вы не подключены к сети» — проверьте интернет-соединение. Попробуйте настроить браузер для работы со СБИС.
    • «Не удается отобразить эту страницу» — проверьте настройки СБИС Коннекта и прокси-сервера. После этого повторно откройте сайт.

    Добейтесь, чтобы в Internet Explorer открылся сайт online.sbis.ru. После этого запустите СБИС Коннект или SDK. Отправьте или получите документы.

    Нашли неточность? Выделите текст с ошибкой и нажмите ctrl + enter.

    Hi,

    I’m trying to configure the the client side WinHTTP connect/send/receive timeout on Windows 7/2008. However they don’t seem to take effect.

    Instead WinHttpSendRequest comes back with 12002 always after 21 seconds when trying with a fake IP as destination (not sure how else to simulate).

    It may worth mentioning that I tried both by using WinHttpSetTimeouts and by setting each option individually with WinHttpSetOption with no difference.

    The results of my quick test look like this:

    WinHttpUsageExample.exe «10.20.30.40» 50 (timeout in secs)

    default WINHTTP_OPTION_RESOLVE_TIMEOUT: -1
    default WINHTTP_OPTION_CONNECT_TIMEOUT: 60000
    default WINHTTP_OPTION_SEND_TIMEOUT: 30000
    default WINHTTP_OPTION_RECEIVE_TIMEOUT: 30000
    ——————————————————————————-

    current WINHTTP_OPTION_RESOLVE_TIMEOUT: 50000
    current WINHTTP_OPTION_CONNECT_TIMEOUT: 50000
    current WINHTTP_OPTION_SEND_TIMEOUT: 50000
    current WINHTTP_OPTION_RECEIVE_TIMEOUT: 50000
    ——————————————————————————-

    Before WinHttpSendRequest time is 16:36:28
    After WinHttpSendRequest time is 16:36:49, errno: 12002
    Error 12002 has occurred.

    Could this be a WinHTTP bug?

    Am I not simulating correctly? How to then?

    Could it be in this case that the ERROR_WINHTTP_TIMEOUT is returned as result of lower tcp level timeout(s) expiration (not mentioned in WinHTTP doc)?

    Pretty much in the dark here. Any help would be highly appreciated.

    Cheers,
    Bogdan

    Also, in case one may be curious, here’s the source of my small test program:

    #define _CRT_SECURE_NO_WARNINGS
    #include <stdio.h>
    #include <windows.h>
    #include <winhttp.h>
    #include <time.h>

    static wchar_t* charToWChar(const char* text)
    {
        size_t size = strlen(text) + 1;
        wchar_t* wa = new wchar_t[size];
        mbstowcs(wa,text,size);
        return wa;
    }

    int main(int argc, char* argv[])
    {
      DWORD dwSize = 0;
      DWORD dwDownloaded = 0;
      LPSTR pszOutBuffer;
      BOOL  bResults = FALSE;
      HINTERNET  hSession = NULL,
                 hConnect = NULL,
                 hRequest = NULL;

      DWORD timeoutval = 0;
      DWORD size = sizeof(DWORD);
      wchar_t *httpserver = NULL;  
      char timeStr [9];    

      if(argc < 3)
      {
              printf( «usage: WinHttpUsageExample.exe <http server name/address> <winhttp global timeout in seconds>n»);

              return 0;
      }

      // Use WinHttpOpen to obtain a session handle.
      hSession = WinHttpOpen( L»WinHTTP Example/1.0″,  
                              WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,

                              WINHTTP_NO_PROXY_NAME,

                              WINHTTP_NO_PROXY_BYPASS, 0 );

      WinHttpQueryOption(hSession, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);

      printf( «——————————————————————————-n»);

      timeoutval = atol(argv[2]) * 1000; //convert seconds to milliseconds
      httpserver = charToWChar( argv[1] ); // convert the string type

      /* Use WinHttpSetTimeouts to set a new time-out values (resolve, connect, send, receive) */

      if (!WinHttpSetTimeouts( hSession, timeoutval, timeoutval, timeoutval, timeoutval))

      {
           printf(«Error %u in WinHttpSetTimeouts.n», GetLastError());

      }

      // Specify an HTTP server.
      if( hSession )
        hConnect = WinHttpConnect( hSession, httpserver,
                                   INTERNET_DEFAULT_HTTPS_PORT, 0 );

      // Create an HTTP request handle.
      if( hConnect )
        hRequest = WinHttpOpenRequest( hConnect, L»GET», NULL,
                                       NULL, WINHTTP_NO_REFERER,

                                       WINHTTP_DEFAULT_ACCEPT_TYPES,

                                       WINHTTP_FLAG_SECURE );

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);  

      printf( «——————————————————————————-n»);

      _strtime_s( timeStr );
      printf( «Before WinHttpSendRequest time is %s n», timeStr);  

      // Send a request.
      if( hRequest )
      {
              bResults = WinHttpSendRequest( hRequest,

                                       WINHTTP_NO_ADDITIONAL_HEADERS, 0,

                                       WINHTTP_NO_REQUEST_DATA, 0,

                                       0, 0 );

              _strtime_s( timeStr );
              printf( «After WinHttpSendRequest time is %s, errno: %d n», timeStr, GetLastError( ));

      }

     

      // Receive response
      if( bResults )
      {
            bResults = WinHttpReceiveResponse( hRequest, NULL );

            _strtime_s( timeStr );
            printf( «Afer WinHttpReceiveResponse time is %s, errno: %d n», timeStr, GetLastError( ));

      }

      // Keep checking for data until there is nothing left.
      if( bResults )
      {
        do
        {
          // Check for available data.
          dwSize = 0;
          if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )
            printf( «Error %u in WinHttpQueryDataAvailable.n»,

                    GetLastError( ) );

          // Allocate space for the buffer.
          pszOutBuffer = new char[dwSize+1];
          if( !pszOutBuffer )
          {
            printf( «Out of memoryn» );
            dwSize=0;
          }
          else
          {
            // Read the data.
            ZeroMemory( pszOutBuffer, dwSize+1 );

            if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,

                                  dwSize, &dwDownloaded ) )

              printf( «Error %u in WinHttpReadData.n», GetLastError( ) );

            else
              printf( «%s», pszOutBuffer );

            // Free the memory allocated to the buffer.
            delete [] pszOutBuffer;
          }
        } while( dwSize > 0 );
      }

     
      // Report any errors.
      if( !bResults )
        printf( «Error %d has occurred.n», GetLastError( ) );

      // Close any open handles.
      if( hRequest ) WinHttpCloseHandle( hRequest );
      if( hConnect ) WinHttpCloseHandle( hConnect );
      if( hSession ) WinHttpCloseHandle( hSession );

     
      return 0;
    }

    The Client sends some data to Server via HttpSendRequest:

                if (!HttpSendRequest(request.get(), NULL, 0,
                         const_cast<char *>(request_body.data()),
                         static_cast<DWORD>(request_body.size()))) {
                    // return false;
                }
    

    My Server received all data in request_body then send response:

                char success_message[] =
                        "HTTP/1.1 200 OK" "n"
                        "Content-Type: text/xml; charset=utf-8" "n"
                        "Content-Length: 0" "n";
    

    (I send this response via socket)
    but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

    So my question is:

    1. Is my reponse message in wrong format?
    2. When HttpSendRequest return from blocking?

    Edit 1:
    this is the request from client, there are more data but not need, i though

        POST / HTTP/1.1
        Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
        User-Agent: Breakpad/1.0 (Windows)
        Host: 127.0.0.1:1519
        Content-Length: 437805
        Cache-Control: no-cache
    
        -----------------------------0000002900004823
        Content-Disposition: form-data; name="channel"
    
    
        -----------------------------0000002900004823
    

    The Client sends some data to Server via HttpSendRequest:

                if (!HttpSendRequest(request.get(), NULL, 0,
                         const_cast<char *>(request_body.data()),
                         static_cast<DWORD>(request_body.size()))) {
                    // return false;
                }
    

    My Server received all data in request_body then send response:

                char success_message[] =
                        "HTTP/1.1 200 OK" "n"
                        "Content-Type: text/xml; charset=utf-8" "n"
                        "Content-Length: 0" "n";
    

    (I send this response via socket)
    but in client HttpSendRequest block ~10 seconds then return FALSE with error 12002 return from GetLastError().

    So my question is:

    1. Is my reponse message in wrong format?
    2. When HttpSendRequest return from blocking?

    Edit 1:
    this is the request from client, there are more data but not need, i though

        POST / HTTP/1.1
        Content-Type: multipart/form-data; boundary=---------------------------0000002900004823
        User-Agent: Breakpad/1.0 (Windows)
        Host: 127.0.0.1:1519
        Content-Length: 437805
        Cache-Control: no-cache
    
        -----------------------------0000002900004823
        Content-Disposition: form-data; name="channel"
    
    
        -----------------------------0000002900004823
    
    Icon Ex Номер ошибки: Ошибка 12002
    Название ошибки: IE Error 12002
    Описание ошибки: Ошибка 12002: Возникла ошибка в приложении Internet Explorer. Приложение будет закрыто. Приносим извинения за неудобства.
    Разработчик: Microsoft Corporation
    Программное обеспечение: Internet Explorer
    Относится к: Windows XP, Vista, 7, 8, 10, 11

    Как правило, практикующие ПК и сотрудники службы поддержки знают «IE Error 12002» как форму «ошибки во время выполнения». Разработчики программного обеспечения пытаются обеспечить, чтобы программное обеспечение было свободным от этих сбоев, пока оно не будет публично выпущено. К сожалению, такие проблемы, как ошибка 12002, могут не быть исправлены на этом заключительном этапе.

    Ошибка 12002 также отображается как «IE Error 12002». Это распространенная ошибка, которая может возникнуть после установки программного обеспечения. Если происходит «IE Error 12002», разработчикам будет сообщено об этой проблеме, хотя отчеты об ошибках встроены в приложение. Microsoft Corporation вернется к коду и исправит его, а затем сделает обновление доступным для загрузки. Таким образом, когда ваш компьютер выполняет обновления, как это, это, как правило, чтобы исправить проблемы ошибки 12002 и другие ошибки внутри Internet Explorer.

    Проблема с исходным кодом Internet Explorer приведет к этому «IE Error 12002», чаще всего на этапе запуска. Мы можем определить происхождение ошибок ошибки 12002 во время выполнения следующим образом:

    Ошибка 12002 Crash — она называется «Ошибка 12002», когда программа неожиданно завершает работу во время работы (во время выполнения). Эти ошибки обычно возникают, когда входы Internet Explorer не могут быть правильно обработаны, или они смущены тем, что должно быть выведено.

    Утечка памяти «IE Error 12002» — при утечке памяти Internet Explorer это может привести к медленной работе устройства из-за нехватки системных ресурсов. Повреждение памяти и другие потенциальные ошибки в коде могут произойти, когда память обрабатывается неправильно.

    Ошибка 12002 Logic Error — логическая ошибка Internet Explorer возникает, когда она производит неправильный вывод, несмотря на то, что пользователь предоставляет правильный ввод. Это связано с ошибками в исходном коде Microsoft Corporation, обрабатывающих ввод неправильно.

    Основные причины Microsoft Corporation ошибок, связанных с файлом IE Error 12002, включают отсутствие или повреждение файла, или, в некоторых случаях, заражение связанного Internet Explorer вредоносным ПО в прошлом или настоящем. Возникновение подобных проблем является раздражающим фактором, однако их легко устранить, заменив файл Microsoft Corporation, из-за которого возникает проблема. Если ошибка IE Error 12002 возникла в результате его удаления по причине заражения вредоносным ПО, мы рекомендуем запустить сканирование реестра, чтобы очистить все недействительные ссылки на пути к файлам, созданные вредоносной программой.

    Типичные ошибки IE Error 12002

    Обнаруженные проблемы IE Error 12002 с Internet Explorer включают:

    • «Ошибка IE Error 12002. «
    • «Ошибка программного обеспечения Win32: IE Error 12002»
    • «Извините, IE Error 12002 столкнулся с проблемой. «
    • «К сожалению, мы не можем найти IE Error 12002. «
    • «Отсутствует файл IE Error 12002.»
    • «Ошибка запуска программы: IE Error 12002.»
    • «IE Error 12002 не выполняется. «
    • «IE Error 12002 остановлен. «
    • «Ошибка в пути к программному обеспечению: IE Error 12002. «

    Ошибки IE Error 12002 EXE возникают во время установки Internet Explorer, при запуске приложений, связанных с IE Error 12002 (Internet Explorer), во время запуска или завершения работы или во время установки ОС Windows. При появлении ошибки IE Error 12002 запишите вхождения для устранения неполадок Internet Explorer и чтобы HelpMicrosoft Corporation найти причину.

    Источники проблем IE Error 12002

    Эти проблемы IE Error 12002 создаются отсутствующими или поврежденными файлами IE Error 12002, недопустимыми записями реестра Internet Explorer или вредоносным программным обеспечением.

    В частности, проблемы IE Error 12002 возникают через:

    • Недопустимая (поврежденная) запись реестра IE Error 12002.
    • Загрязненный вирусом и поврежденный IE Error 12002.
    • Другая программа злонамеренно или по ошибке удалила файлы, связанные с IE Error 12002.
    • Другое приложение, конфликтующее с IE Error 12002 или другими общими ссылками.
    • Internet Explorer/IE Error 12002 поврежден от неполной загрузки или установки.

    Продукт Solvusoft

    Загрузка
    WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

    Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

    Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

    @ras0219-msft is it ok that vcpkg is still broken when installed behind a proxy?

    A clean vcpkg installation on windows fails to download powershell, 7-zip and nuget just at the beginning, when installing your first library.

    Subsequent downloads are working (they still often fail for no apparent reason at all) , the first three nope and I have to download them manually from a browser and move them inside the vcpkg/downloads folder.
    I still didn’t inspect why, but these downloads are done in a different way (broken, it seems), because they are totally not tested for proxy support. Also the fact that proxy support is so weak that usually I prefer to do the «download-only» part on the WSL side is depressing (same pc, same proxy, somehow the linux part is more proxy resilient), so that I don’t fear of finding the update stopped because one of the library failed to download (never happened when not using proxy).

    Just to let you know, vcpkg on windows is the only program that gives me any problem with «dropped internet connection», so i’d not declare our proxy as guilty. Also, even when vcpkg is failing repeatedly, any browser installed can download the tar.gz with no problem, and as I said also the WSL version can, without any annoyance.

    Please fix it. For any enterprise adoption of vcpkg, a proper proxy support is a deal breaker. It’s still far from being here.

    Подскажите пожалуйста, что означает ошибка 12002 полученная с помощью GetLastError() после HttpSendRequest()?
    В MSDN (апрель 2003) ничего про эту ошибку не нашел . Код вызвавший ошибку:

        fprintf(streamLog,"Sending POST to server %s, script %sn",m_sURL,m_sScript);
        static TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencodedrn");
        LPCSTR acc = "Accept: */*";
        HINTERNET hSession = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
        if(hSession != NULL) {
            HINTERNET hConnect = InternetConnect(hSession, m_sURL,INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
            if(hConnect != NULL) {
                HINTERNET hRequest = HttpOpenRequest(hConnect, "POST", m_sScript,NULL, NULL, &acc, INTERNET_FLAG_SECURE, 1);
                if(hRequest != NULL) { 
                    BOOL res = HttpSendRequest(hRequest, hdrs, strlen(hdrs), m_sPOST.GetBuffer(), m_sPOST.GetLength());
                    if (res) {
                        fprintf(streamLog,"Sending request validn");
                        bFlag = true;
                    } else {
                        DWORD dw = GetLastError();
    
                        LPVOID lpMsgBuf;
                        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
                                    FORMAT_MESSAGE_FROM_SYSTEM | 
                                    FORMAT_MESSAGE_IGNORE_INSERTS,
                                    NULL,
                                    dw,
                                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                                    (LPTSTR) &lpMsgBuf,
                                    0,
                                    NULL);
                        fprintf(streamLog,"Error during sending request (%s): [%d] %sn",m_sPOST,dw,(LPCTSTR)lpMsgBuf);        
                        LocalFree( lpMsgBuf );
                    }
    
                    const DWORD sz = 1000;
                    char     Buffer[sz];
                    DWORD    bytesRead ;
    
                    BOOL readFile = InternetReadFile(hRequest, Buffer, sz, &bytesRead);
                    fprintf(streamLog,"nnReceived:n");
                    for (int j=0;j<bytesRead;j++)
                        fprintf(streamLog,"%c",Buffer[j]);
                    
                    InternetCloseHandle(hRequest);
                } else
                    fprintf(streamLog,"Request failedn");
                InternetCloseHandle(hConnect);
            } else
                fprintf(streamLog,"Connect not openedn");
            InternetCloseHandle(hSession);
        } else 
            fprintf(streamLog,"Session not openedn");

    Заранее большое спасибо, за помощь!

    … << RSDN@Home 1.1.3 stable >>

    12002 ERROR_INTERNET_TIMEOUT
    The request has timed out.
    Плохо ищите — это нашел в МСДН

    Hi,

    I’m trying to configure the the client side WinHTTP connect/send/receive timeout on Windows 7/2008. However they don’t seem to take effect.

    Instead WinHttpSendRequest comes back with 12002 always after 21 seconds when trying with a fake IP as destination (not sure how else to simulate).

    It may worth mentioning that I tried both by using WinHttpSetTimeouts and by setting each option individually with WinHttpSetOption with no difference.

    The results of my quick test look like this:

    WinHttpUsageExample.exe «10.20.30.40» 50 (timeout in secs)

    default WINHTTP_OPTION_RESOLVE_TIMEOUT: -1
    default WINHTTP_OPTION_CONNECT_TIMEOUT: 60000
    default WINHTTP_OPTION_SEND_TIMEOUT: 30000
    default WINHTTP_OPTION_RECEIVE_TIMEOUT: 30000
    ——————————————————————————-

    current WINHTTP_OPTION_RESOLVE_TIMEOUT: 50000
    current WINHTTP_OPTION_CONNECT_TIMEOUT: 50000
    current WINHTTP_OPTION_SEND_TIMEOUT: 50000
    current WINHTTP_OPTION_RECEIVE_TIMEOUT: 50000
    ——————————————————————————-

    Before WinHttpSendRequest time is 16:36:28
    After WinHttpSendRequest time is 16:36:49, errno: 12002
    Error 12002 has occurred.

    Could this be a WinHTTP bug?

    Am I not simulating correctly? How to then?

    Could it be in this case that the ERROR_WINHTTP_TIMEOUT is returned as result of lower tcp level timeout(s) expiration (not mentioned in WinHTTP doc)?

    Pretty much in the dark here. Any help would be highly appreciated.

    Cheers,
    Bogdan

    Also, in case one may be curious, here’s the source of my small test program:

    #define _CRT_SECURE_NO_WARNINGS
    #include <stdio.h>
    #include <windows.h>
    #include <winhttp.h>
    #include <time.h>

    static wchar_t* charToWChar(const char* text)
    {
        size_t size = strlen(text) + 1;
        wchar_t* wa = new wchar_t[size];
        mbstowcs(wa,text,size);
        return wa;
    }

    int main(int argc, char* argv[])
    {
      DWORD dwSize = 0;
      DWORD dwDownloaded = 0;
      LPSTR pszOutBuffer;
      BOOL  bResults = FALSE;
      HINTERNET  hSession = NULL,
                 hConnect = NULL,
                 hRequest = NULL;

      DWORD timeoutval = 0;
      DWORD size = sizeof(DWORD);
      wchar_t *httpserver = NULL;  
      char timeStr [9];    

      if(argc < 3)
      {
              printf( «usage: WinHttpUsageExample.exe <http server name/address> <winhttp global timeout in seconds>n»);

              return 0;
      }

      // Use WinHttpOpen to obtain a session handle.
      hSession = WinHttpOpen( L»WinHTTP Example/1.0″,  
                              WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,

                              WINHTTP_NO_PROXY_NAME,

                              WINHTTP_NO_PROXY_BYPASS, 0 );

      WinHttpQueryOption(hSession, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

      printf(«default WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);

      printf( «——————————————————————————-n»);

      timeoutval = atol(argv[2]) * 1000; //convert seconds to milliseconds
      httpserver = charToWChar( argv[1] ); // convert the string type

      /* Use WinHttpSetTimeouts to set a new time-out values (resolve, connect, send, receive) */

      if (!WinHttpSetTimeouts( hSession, timeoutval, timeoutval, timeoutval, timeoutval))

      {
           printf(«Error %u in WinHttpSetTimeouts.n», GetLastError());

      }

      // Specify an HTTP server.
      if( hSession )
        hConnect = WinHttpConnect( hSession, httpserver,
                                   INTERNET_DEFAULT_HTTPS_PORT, 0 );

      // Create an HTTP request handle.
      if( hConnect )
        hRequest = WinHttpOpenRequest( hConnect, L»GET», NULL,
                                       NULL, WINHTTP_NO_REFERER,

                                       WINHTTP_DEFAULT_ACCEPT_TYPES,

                                       WINHTTP_FLAG_SECURE );

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_RESOLVE_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_CONNECT_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_SEND_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_SEND_TIMEOUT: %dn», timeoutval);

      WinHttpQueryOption(hRequest, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeoutval, &size);

      printf(«current WINHTTP_OPTION_RECEIVE_TIMEOUT: %dn», timeoutval);  

      printf( «——————————————————————————-n»);

      _strtime_s( timeStr );
      printf( «Before WinHttpSendRequest time is %s n», timeStr);  

      // Send a request.
      if( hRequest )
      {
              bResults = WinHttpSendRequest( hRequest,

                                       WINHTTP_NO_ADDITIONAL_HEADERS, 0,

                                       WINHTTP_NO_REQUEST_DATA, 0,

                                       0, 0 );

              _strtime_s( timeStr );
              printf( «After WinHttpSendRequest time is %s, errno: %d n», timeStr, GetLastError( ));

      }

     

      // Receive response
      if( bResults )
      {
            bResults = WinHttpReceiveResponse( hRequest, NULL );

            _strtime_s( timeStr );
            printf( «Afer WinHttpReceiveResponse time is %s, errno: %d n», timeStr, GetLastError( ));

      }

      // Keep checking for data until there is nothing left.
      if( bResults )
      {
        do
        {
          // Check for available data.
          dwSize = 0;
          if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )
            printf( «Error %u in WinHttpQueryDataAvailable.n»,

                    GetLastError( ) );

          // Allocate space for the buffer.
          pszOutBuffer = new char[dwSize+1];
          if( !pszOutBuffer )
          {
            printf( «Out of memoryn» );
            dwSize=0;
          }
          else
          {
            // Read the data.
            ZeroMemory( pszOutBuffer, dwSize+1 );

            if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,

                                  dwSize, &dwDownloaded ) )

              printf( «Error %u in WinHttpReadData.n», GetLastError( ) );

            else
              printf( «%s», pszOutBuffer );

            // Free the memory allocated to the buffer.
            delete [] pszOutBuffer;
          }
        } while( dwSize > 0 );
      }

     
      // Report any errors.
      if( !bResults )
        printf( «Error %d has occurred.n», GetLastError( ) );

      // Close any open handles.
      if( hRequest ) WinHttpCloseHandle( hRequest );
      if( hConnect ) WinHttpCloseHandle( hConnect );
      if( hSession ) WinHttpCloseHandle( hSession );

     
      return 0;
    }

    How to fix the issue reported by error code «http error 12002»

    Special Offer

    Outbyte PC Repair

    Windows 11, 10, 8, 7

    Trusted and Monitored

    The following steps should fix the http error 12002 issue:

    • Step 1.


      Download Outbyte PC Repair application


      See more information about Outbyte; uninstall instructions; EULA; Privacy Policy.

    • Step 2.
      Install and launch the application
    • Step 3.
      Click the Scan Now button to detect issues and abnormalities
    • Step 4.
      Click the Repair All button to fix the issues
    Compatibility Win 11, 10, 8, 7
    Download Size 21.2 MB
    Requirements 300 MHz Processor, 256 MB RAM, 50 MB HDD space

    Limitations: trial version offers an unlimited number of scans, backups and restores of your Windows system elements for free. Registration for the full version starts from USD 29.95.

    Installation: When you install software, it gives our advertisers a chance to speak to you. ALL OFFERS ARE OPTIONAL. There is no obligation to accept. Simply choose to decline the offer if you are not interested. If you are interested and choose to accept, you’ll help us to offer more software in the future. Again, there is no obligation to accept any offers. You have the option to decline all advertisements and still install and use the software for free.

    Web Companion is your first line of defence. With hundreds of thousands of new virus strands created every day, Ad-Aware Web Companion is the perfect complement to your antivirus and web browser security.

    A malfunction reported by error code «http error 12002» may happen due to a number of different factors. Common causes include incorrectly configured system settings or irregular entries in the system elements, to name a few. Such issues may be resolved with special software that repairs system elements and tunes system settings to restore stability.

    The article provides details on what the issue means, potential causes, and ways to resolve the issue.

    • 1
      Ways to repair error code «http error 12002»

    • 2
      Meaning of error code «http error 12002»

    • 3
      Causes of error code «http error 12002»

    Ways to repair error code «http error 12002»

    Advanced PC users may be able to repair the issue with this code by manually editing system elements, while other users may want to hire a technician to do it for them. However, since any manipulations with Windows system elements carry a risk of rendering the operating system unbootable, whenever a user is in any doubt of their technical skills or knowledge, they should use a special type of software that is meant to repair Windows system elements without requiring any special skills from the user.

    The following steps should help fix the issue:

    • Download Outbyte PC Repair application

      Special offer. See more information about Outbyte; uninstall instructions; EULA; Privacy Policy.
    • Install and launch the application
    • Click the Scan Now button to detect potential issue causes
    • Click the Repair All button to fix detected abnormalities

    The same application can be used to run preventative measures to reduce the chance of this or other system issues appearing in the future.

    Meaning of error code «http error 12002»

    Error code «http error 12002» is an issue name that contains details of the malfunction, including why it occurred, which system component or application malfunctioned, along with some other information. The numerical code in the issue name usually contains data that can be deciphered by the manufacturer of the component or application that malfunctioned. The issue with this code may occur in different locations within the system, so even though it carries some details in its name, it is still difficult for a user to pinpoint and fix the issue cause without specific technical knowledge or appropriate software.

    Causes of error code «http error 12002»

    If you have received this warning on your PC, it means that there was a malfunction in your system operation. Error code «http error 12002» is one of the issues that users may get as a result of incorrect or failed installation or uninstallation of software that may have left invalid entries in system elements. Other potential causes may include improper system shutdown, such as due to a power failure, someone with little technical knowledge accidentally deleting a necessary system file or system element entry, as well as a number of other factors.

    If you call the function as you say, then you are using a proxy, which in this case is installed on the local machine (127.0.0.1) and TCP port 9090.

    Are you sure that the proxy is still up and running?

    If don’t want to use this proxy, then you have to call the function with 'False' as the first parameter.

    A more simplified code, could be the following:

    function CheckIp(UseProxy:Boolean=True; Host:String='https://api.ipify.org/'; ProxyHost:String='127.0.0.1'; ProxyPort:Integer=9090): String;
    var
     Cli:   THttpClient;
    begin
     Cli:=THTTPClient.Create;
     Cli.SecureProtocols:=[THTTPSecureProtocol.SSL2,THTTPSecureProtocol.SSL3,
                           THTTPSecureProtocol.TLS1,THTTPSecureProtocol.TLS11,
                           THTTPSecureProtocol.TLS12,THTTPSecureProtocol.TLS13];
     try
        if UseProxy=True then Cli.ProxySettings.Create(ProxyHost,ProxyPort);
        Result := Cli.Get(Host).ContentAsString;
     finally
        Cli.Free;
     end;
    
    end;
    
    
    procedure TForm1.Button3Click(Sender: TObject);
    begin
      ShowMessage(CheckIP(False, 'https://api.ipify.org/'));
    end;
    

    Also, you are saying that when you are using the proxy server, the connection is establishing successfully. But when you are not using the proxy, you are getting the error.

    Something like this, is possible if the PC you are working on, has connection issues (eg: firewall, routing table, bad dns configuration etc). In this case, the direct connections from the PC doesn’t work, but the connections made through proxy works.

    While running an internal application using the load runner Controller i was getting the «HttpSendRequest» failed, Windows error code=12002 — Perf Center Error .I solved these by following the below steps:


    1.Check Vugen runs script as a process or running  vusers asa  thread?

    You can check this in Run time settings-General-Miscellaneous-Multithreading then uncheck the value

    2.Are you working with WinInet, and the error itself comes from WinInet API not specifically Vugen.We can see in part of the replay  errors comes from resources during the replay where they were timed out.

    If we are forced to use WinInet then this will occur, but if you can use Sockets you may want to try that option instead or a Click and Script protocol.

    you can uncheck the WinInet replay instead of sockets (Windows only) in the runtime settings-preferences.This will solve the problem.

    3.And the another option is to use web_set_max_retries («X») to increase the limit of 30 sec.You can place this before the action which is failing but  I wouldn’t recommend that.

    HttpSendRequest time out only occurres when any transaction takes more than 30 sec to connect to server. This default 30 sec time is because of the use of WinInet Replay engine. Thus this error pops up when you are running script with winInet replay and transactions are taking more than 30 sec. Only thing to get rid of this error is to fine tune the whole system and check the backend and servers to see any request que has formed up.

    While
    running an internal application using the load runner Controller i was
    getting the «HttpSendRequest» failed, Windows error code=12002 — Perf
    Center Error .I solved these by following the below steps:


    1.Check Vugen runs script as a process or running  vusers asa  thread?

    You can check this in Run time settings-General-Miscellaneous-Multithreading then uncheck the value

    2.Are
    you working with WinInet, and the error itself comes from WinInet API
    not specifically Vugen.We can see in part of the replay  errors comes
    from resources during the replay where they were timed out.

    If we are
    forced to use WinInet then this will occur, but if you can use Sockets
    you may want to try that option instead or a Click and Script protocol.

    you can uncheck the WinInet replay instead of sockets (Windows only) in the runtime settings-preferences.This will solve the problem.

    3.And the another option is to use web_set_max_retries («X») to increase the limit of 30 sec.You can place this before the action which is failing but  I wouldn’t recommend that.

    HttpSendRequest
    time out only occurres when any transaction takes more than 30 sec to
    connect to server. This default 30 sec time is because of the use of
    WinInet Replay engine. Thus this error pops up when you are running
    script with winInet replay and transactions are taking more than 30 sec.
    Only thing to get rid of this error is to fine tune the whole system
    and check the backend and servers to see any request que has formed up.

    Понравилась статья? Поделить с друзьями:

    Интересное по теме:

  • Вызванный врачебной ошибкой термин на латинском
  • Выезжая на дорогу будьте внимательны ошибка
  • Выделить причины дисграфических ошибок
  • Выделить ошибку на сайте клавиши
  • Выделите грубые ошибки сущности бд

  • Добавить комментарий

    ;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: