Hi there,
this is my first post here, so greetings to all.
Since a few days, out of the blue, I’m getting a HttpSendRequest error 12029 when installing a package. That’s from Windows 10 cmd.
The URL works in the browser though.
I did not change anything AFAIK. Might be there was a WIndows update meanwhile.
Any ideas?
HttpSendRequest error 12029
Cause
This problem occurs because Windows is not configured to use TLS 1.2 or 1.3 protocol and the hosted site has disabled support for TLS 1.0 and 1.1 in their on-premises environment (TLS 1.0 and 1.1 are nearing end-of-life, not to mention a security risk and many hosting sites have started disabling/phasing it out).
Error «12029» is a WinHTTP error code that indicates that a socket connection failed because encrypted communication could not be established.
- Your browser (Chrome, Edge, FireFox, Brave, Opera, etc are independently TLS 1.2 and 1.3 enabled) works independently from Windows
- Windows and vcpkg uses the internal winhttp to download files.
TLS 1.1, TLS 1.2, TLS 1.3 all are enabled for winhttp (at least now). I checked the relevant registry keys.
Still no luck.
Btw, the mirror site/file is https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-win32-x86.zip
But then, thanks for your help anyways.
Von: StarGate-One <notifications@github.com>
Gesendet: 08 January 2021 23:49
An: microsoft/vcpkg <vcpkg@noreply.github.com>
Cc: Martin Straub <Develop@worldinone.at>; Author <author@noreply.github.com>
Betreff: Re: [microsoft/vcpkg] HttpSendRequest fails with error code 12029 (#15532)
HttpSendRequest error 12029
Cause
This problem occurs because Windows is not configured to use TLS 1.2 or 1.3 protocol and the hosted site has disabled support for TLS 1.0 and 1.1 in their on-premises environment (TLS 1.0 and 1.1 are nearing end-of-life, not to mention a security risk and many hosting sites have started disabling/phasing it out).
Error «12029» is a WinHTTP error code that indicates that a socket connection failed because encrypted communication could not be established.
* Your browser (Chrome, Edge, FireFox, Brave, Opera, etc are independently TLS 1.2 and 1.3 enabled) works independently from Windows
* Windows and vcpkg uses the internal winhttp to download files.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15532 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACMBSN5B4HVNKBTRBNKYO6TSY6DWJANCNFSM4V2ZG73A> . <https://github.com/notifications/beacon/ACMBSN7HX5U5SEVPIURR2Z3SY6DWJA5CNFSM4V2ZG73KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFUPXLMI.gif>
Ah, one more question. Which IP ports are used for the connection?
Von: StarGate-One <notifications@github.com>
Gesendet: 08 January 2021 23:49
An: microsoft/vcpkg <vcpkg@noreply.github.com>
Cc: Martin Straub <Develop@worldinone.at>; Author <author@noreply.github.com>
Betreff: Re: [microsoft/vcpkg] HttpSendRequest fails with error code 12029 (#15532)
HttpSendRequest error 12029
Cause
This problem occurs because Windows is not configured to use TLS 1.2 or 1.3 protocol and the hosted site has disabled support for TLS 1.0 and 1.1 in their on-premises environment (TLS 1.0 and 1.1 are nearing end-of-life, not to mention a security risk and many hosting sites have started disabling/phasing it out).
Error «12029» is a WinHTTP error code that indicates that a socket connection failed because encrypted communication could not be established.
* Your browser (Chrome, Edge, FireFox, Brave, Opera, etc are independently TLS 1.2 and 1.3 enabled) works independently from Windows
* Windows and vcpkg uses the internal winhttp to download files.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#15532 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACMBSN5B4HVNKBTRBNKYO6TSY6DWJANCNFSM4V2ZG73A> . <https://github.com/notifications/beacon/ACMBSN7HX5U5SEVPIURR2Z3SY6DWJA5CNFSM4V2ZG73KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFUPXLMI.gif>
I’m closing the issue. Obviously vcpkg is not involved. After downloading one or two files manually, package installation miraculously worked. I’m suspecting it’s the virus protection (Bitdefender). Not so much that it would block something (there would be an alert/report), I feel it’s more of a timing issue. Why that should lead to error 12029 I cannot conceive.
- Remove From My Forums
-
Question
-
Hi,
I’m trying to use a service that requires a lot of requests, for which I’m using the WinHttp API.
The general pattern is:
1. Call WinHttpOpen
2. Call WinHttpConnect
3. WinHttpOpenRequest
4. WinHttpSendRequest
5. Close request handle
6. Repeat steps 3, 4, and 5 lots of times for various requests
7. Close connect handle
8. Close session handle
Now the problem I’ve having is that in the loop for steps 3, 4, and 5, the call to WinHttpSendRequest will occassionally return false, with GetLastError returning 12029 (ERROR_WINHTTP_CANNOT_CONNECT). This always happens after a few minutes of it looping
around sending requests, but seems random as to exactly when it occurs.I have tried setting the timeout open on the connection, and tried adding code into the loop to say «every X requests, close the session/connection completely and re-open), but I still get this error after a few minutes.
Help!
Answers
-
Its looking possible that this is an issue with the 3rd party webservice…awaiting confirmation of this. For now it looks like I just have to settle for some ‘retry if failed’ code.
-
Proposed as answer by
Monday, May 26, 2014 6:23 AM
-
Marked as answer by
Marvin_Guo
Monday, June 2, 2014 5:33 AM
-
Proposed as answer by
Содержание
- Error 12029: «We couldn’t connect you to this meeting» in Skype for Business 2016 or 2015
- Symptoms
- Cause
- Resolution
- Ошибка 12029: «Не удалось подключить вас к этому собранию» в Skype для бизнеса 2016 или 2015
- Симптомы
- Причина
- Решение
- Дополнительная информация
- HttpSendRequest fails with error code 12029 #15532
- Comments
- Footer
- Error winhttp cannot connect 12029
- Answered by:
- Question
- Answers
- All replies
- Error Messages (Winhttp.h)
- Remarks
Error 12029: «We couldn’t connect you to this meeting» in Skype for Business 2016 or 2015
Symptoms
A Microsoft Skype for Business 2016 or 2015 session that’s running on Windows 7 fails to join a Federated meeting with a partner who is running Skype for Business Server on-premises.
When this problem occurs, you receive the following error message:
We couldn’t connect you to this meeting because of a network problem. Please try again. If the problem continues, contact your support team.
If you select Show Details, the message window shows error code 12029.
This problem affects both the MSI and C2R versions of Skype for Business 2016 and Skype for Business 2015
Cause
This problem occurs because Windows 7 is not configured to support the TLS 1.2 protocol, and the Federated partner disabled support for TLS 1.0 and 1.1 in their on-premises environment.
Error «12029» is a WinHTTP error code that indicates that a socket connection failed because encrypted communication could not be established.
Resolution
To resolve this problem, enable TLS 1.2 support on Windows 7. To do this, follow the guidance in the following Knowledge Base article, and then, restart the computer:
To resolve the problem, you must also make sure that the Skype for Business installation meets the minimum version requirements, as specified in the following Skype for Business Blog article:
Источник
Ошибка 12029: «Не удалось подключить вас к этому собранию» в Skype для бизнеса 2016 или 2015
Симптомы
Сеанс Microsoft Skype для бизнеса 2016 или 2015, работающий в Windows 7, не может присоединиться к федеративному собранию с партнером, Skype для бизнеса Server локально.
При возникновении этой проблемы вы получите следующее сообщение об ошибке:
Не удалось подключить вас к этому собранию из-за проблемы с сетью. Повторите попытку. Если проблема не исчезнет, обратитесь в службу поддержки.
Если выбрать » Показать сведения«, в окне сообщения отобразится код ошибки 12029.
Эта проблема влияет на версии MSI и C2R Skype для бизнеса 2016 и Skype для бизнеса 2015
Причина
Эта проблема возникает из-за того, что Windows 7 не настроена для поддержки протокола TLS 1.2, а федеративный партнер отключает поддержку TLS 1.0 и 1.1 в локальной среде.
Ошибка «12029» — это код ошибки WinHTTP, указывающий на сбой подключения сокета, так как не удалось установить зашифрованное соединение.
Решение
Чтобы устранить эту проблему, включите поддержку TLS 1.2 в Windows 7. Для этого следуйте инструкциям в следующей статье базы знаний, а затем перезапустите компьютер:
Чтобы устранить проблему, необходимо также убедиться, что установка Skype для бизнеса соответствует минимальным требованиям к версии, как указано в следующей Skype для бизнеса блога:
Дополнительная информация
Требуется дополнительная помощь? Зайдите на сайт сообщества Майкрософт.
Источник
HttpSendRequest fails with error code 12029 #15532
Hi there,
this is my first post here, so greetings to all.
Since a few days, out of the blue, I’m getting a HttpSendRequest error 12029 when installing a package. That’s from Windows 10 cmd.
The URL works in the browser though.
I did not change anything AFAIK. Might be there was a WIndows update meanwhile.
The text was updated successfully, but these errors were encountered:
Cause
This problem occurs because Windows is not configured to use TLS 1.2 or 1.3 protocol and the hosted site has disabled support for TLS 1.0 and 1.1 in their on-premises environment (TLS 1.0 and 1.1 are nearing end-of-life, not to mention a security risk and many hosting sites have started disabling/phasing it out).
Error «12029» is a WinHTTP error code that indicates that a socket connection failed because encrypted communication could not be established.
- Your browser (Chrome, Edge, FireFox, Brave, Opera, etc are independently TLS 1.2 and 1.3 enabled) works independently from Windows
- Windows and vcpkg uses the internal winhttp to download files.
I’m closing the issue. Obviously vcpkg is not involved. After downloading one or two files manually, package installation miraculously worked. I’m suspecting it’s the virus protection (Bitdefender). Not so much that it would block something (there would be an alert/report), I feel it’s more of a timing issue. Why that should lead to error 12029 I cannot conceive.
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Error winhttp cannot connect 12029
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
I’m trying to use a service that requires a lot of requests, for which I’m using the WinHttp API.
The general pattern is:
1. Call WinHttpOpen
2. Call WinHttpConnect
5. Close request handle
6. Repeat steps 3, 4, and 5 lots of times for various requests
7. Close connect handle
8. Close session handle
Now the problem I’ve having is that in the loop for steps 3, 4, and 5, the call to WinHttpSendRequest will occassionally return false, with GetLastError returning 12029 (ERROR_WINHTTP_CANNOT_CONNECT). This always happens after a few minutes of it looping around sending requests, but seems random as to exactly when it occurs.
I have tried setting the timeout open on the connection, and tried adding code into the loop to say «every X requests, close the session/connection completely and re-open), but I still get this error after a few minutes.
Answers
I did some researches for this issue. Here is a summary.
1. Network issue. There is a misconfiguration at Network level. The Public IP was not responding to any traffic coming on 80/443.
2. You could use the Windows Firewall API to check if certain ports are open or if your program has access. You can also use the API to configure the firewall to allow your program access if necessary. Here are a few examples of using the interface:
Have a nice time!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Thanks for the tips, but looking at these, none of this explains the random nature of the problem. The requests will work — for a while — and then randomly fail.
I added a retry loop in at the request level, i.e. so that steps 3,4 and 5 will repeat the same request if WinHttpSendRequests returns error 12029 with a short pause before retrying. And only after 5 attempts will it give up. This seemed to make it last a bit longer, but eventually the same request failed 5 times in a row and my progam still fell over.
From MSDN document, the error code detects that the connection to the server failed.
I searched this topic, I am afraid that it is the root cause of this issue. The website you requested return a 301 Moved Permanently header, to get winhttp to honour that and redirect to the URL in the Location: header (the www.) you need to use WinHttpSetOption to set the appropriate WINHTTP_OPTION_REDIRECT_* option(s).
Have a nice time!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
From MSDN document, the error code detects that the connection to the server failed.
I searched this topic, I am afraid that it is the root cause of this issue. The website you requested return a 301 Moved Permanently header, to get winhttp to honour that and redirect to the URL in the Location: header (the www.) you need to use WinHttpSetOption to set the appropriate WINHTTP_OPTION_REDIRECT_* option(s).
Have a nice time!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Thanks for trying, but this is very unlikely to be the solution as evidenced by the fact that, as already stated, the requests all go to the same host and only occasionally return the 12029 error. At which point repeating the «open request/send request/close request» with the exact same request will usually work (but sometimes requires more than 1 retry).
If the service was returning a 301 error, I would expect this to occur all the time (?)
Its always possible that this is an issue at the web service end of course — unfortunately I currently have only one environment to run on so James-Carter’s suggestions, while perfectly valid, are a bit difficult to try at the moment.
Источник
Error Messages (Winhttp.h)
The error values listed below are returned by GetLastError when one of the Microsoft Windows HTTP Services (WinHTTP) functions fails, and are also returned in the lower 16 bits of HRESULT error returns from the WinHttpRequest object.
Error values whose names begin with «ERROR_WINHTTP_» are specific to the WinHTTP functions. The WinHTTP functions also return Windows error messages where appropriate.
ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR
Returned by WinHttpGetProxyForUrl when a proxy for the specified URL cannot be located.
ERROR_WINHTTP_AUTODETECTION_FAILED
Returned by WinHttpDetectAutoProxyConfigUrl if WinHTTP was unable to discover the URL of the Proxy Auto-Configuration (PAC) file.
ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT
An error occurred executing the script code in the Proxy Auto-Configuration (PAC) file.
ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN
Returned by the HttpRequest object if a specified option cannot be requested after the Open method has been called.
ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND
Returned by the HttpRequest object if a requested operation cannot be performed after calling the Send method.
ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN
Returned by the HttpRequest object if a requested operation cannot be performed before calling the Open method.
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
Returned by the HttpRequest object if a requested operation cannot be performed before calling the Send method.
ERROR_WINHTTP_CANNOT_CONNECT
Returned if connection to the server failed.
ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED
The server requires SSL client Authentication. The application retrieves the list of certificate issuers by calling WinHttpQueryOption with the WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST option. For more information, see the WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST option.
If the server requests the client certificate, but does not require it, the application can alternately call WinHttpSetOption with the WINHTTP_OPTION_CLIENT_CERT_CONTEXT option. In this case, the application specifies the WINHTTP_NO_CLIENT_CERT_CONTEXT macro in the lpBuffer parameter of WinHttpSetOption. For more information, see the WINHTTP_OPTION_CLIENT_CERT_CONTEXT option.
Windows Server 2003 with SP1 and Windows XP with SP2: This error is not supported.
ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY
The application does not have the required privileges to access the private key associated with the client certificate.
Windows Server 2003 with SP1 and Windows XP with SP2: This error is not supported.
ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY
The context for the SSL client certificate does not have a private key associated with it. The client certificate may have been imported to the computer without the private key.
Windows Server 2003 with SP1 and Windows XP with SP2: This error is not supported.
ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW
Returned by WinHttpReceiveResponse when an overflow condition is encountered in the course of parsing chunked encoding.
ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED
Returned by WinHttpReceiveResponse when the server requests client authentication.
Windows Server 2003 with SP1 and Windows XP with SP2: This error is not supported.
ERROR_WINHTTP_CONNECTION_ERROR
The connection with the server has been reset or terminated, or an incompatible SSL protocol was encountered. For example, WinHTTP version 5.1 does not support SSL2 unless the client specifically enables it.
ERROR_WINHTTP_HEADER_ALREADY_EXISTS
Obsolete; no longer used.
ERROR_WINHTTP_HEADER_COUNT_EXCEEDED
Returned by WinHttpReceiveResponse when a larger number of headers were present in a response than WinHTTP could receive.
ERROR_WINHTTP_HEADER_NOT_FOUND
The requested header cannot be located.
ERROR_WINHTTP_HEADER_SIZE_OVERFLOW
Returned by WinHttpReceiveResponse when the size of headers received exceeds the limit for the request handle.
ERROR_WINHTTP_INCORRECT_HANDLE_STATE
The requested operation cannot be carried out because the handle supplied is not in the correct state.
ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
The type of handle supplied is incorrect for this operation.
ERROR_WINHTTP_INTERNAL_ERROR
An internal error has occurred.
ERROR_WINHTTP_INVALID_OPTION
ERROR_WINHTTP_INVALID_QUERY_REQUEST
Obsolete; no longer used.
ERROR_WINHTTP_INVALID_SERVER_RESPONSE
The server response cannot be parsed.
ERROR_WINHTTP_INVALID_URL
The URL is not valid.
ERROR_WINHTTP_LOGIN_FAILURE
The login attempt failed. When this error is encountered, the request handle should be closed with WinHttpCloseHandle. A new request handle must be created before retrying the function that originally produced this error.
ERROR_WINHTTP_NAME_NOT_RESOLVED
The server name cannot be resolved.
ERROR_WINHTTP_NOT_INITIALIZED
Obsolete; no longer used.
ERROR_WINHTTP_OPERATION_CANCELLED
The operation was canceled, usually because the handle on which the request was operating was closed before the operation completed.
ERROR_WINHTTP_OPTION_NOT_SETTABLE
The requested option cannot be set, only queried.
ERROR_WINHTTP_OUT_OF_HANDLES
Obsolete; no longer used.
ERROR_WINHTTP_REDIRECT_FAILED
The redirection failed because either the scheme changed or all attempts made to redirect failed (default is five attempts).
ERROR_WINHTTP_RESEND_REQUEST
The WinHTTP function failed. The desired function can be retried on the same request handle.
ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW
Returned when an incoming response exceeds an internal WinHTTP size limit.
ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR
An error was encountered while executing a script.
ERROR_WINHTTP_SECURE_CERT_CN_INVALID
Returned when a certificate CN name does not match the passed value (equivalent to a CERT_E_CN_NO_MATCH error).
ERROR_WINHTTP_SECURE_CERT_DATE_INVALID
Indicates that a required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file, or that the validity periods of the certification chain do not nest correctly (equivalent to a CERT_E_EXPIRED or a CERT_E_VALIDITYPERIODNESTING error).
ERROR_WINHTTP_SECURE_CERT_REV_FAILED
Indicates that revocation cannot be checked because the revocation server was offline (equivalent to CRYPT_E_REVOCATION_OFFLINE).
ERROR_WINHTTP_SECURE_CERT_REVOKED
Indicates that a certificate has been revoked (equivalent to CRYPT_E_REVOKED).
ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE
Indicates that a certificate is not valid for the requested usage (equivalent to CERT_E_WRONG_USAGE).
ERROR_WINHTTP_SECURE_CHANNEL_ERROR
Indicates that an error occurred having to do with a secure channel (equivalent to error codes that begin with «SEC_E_» and «SEC_I_» listed in the «winerror.h» header file).
ERROR_WINHTTP_SECURE_FAILURE
One or more errors were found in the Secure Sockets Layer (SSL) certificate sent by the server. To determine what type of error was encountered, check for a WINHTTP_CALLBACK_STATUS_SECURE_FAILURE notification in a status callback function. For more information, see WINHTTP_STATUS_CALLBACK.
ERROR_WINHTTP_SECURE_INVALID_CA
Indicates that a certificate chain was processed, but terminated in a root certificate that is not trusted by the trust provider (equivalent to CERT_E_UNTRUSTEDROOT).
ERROR_WINHTTP_SECURE_INVALID_CERT
Indicates that a certificate is invalid (equivalent to errors such as CERT_E_ROLE, CERT_E_PATHLENCONST, CERT_E_CRITICAL, CERT_E_PURPOSE, CERT_E_ISSUERCHAINING, CERT_E_MALFORMED and CERT_E_CHAINING).
ERROR_WINHTTP_SHUTDOWN
The WinHTTP function support is being shut down or unloaded.
ERROR_WINHTTP_TIMEOUT
The request has timed out.
This error can be returned as a result of TCP/IP time-out behavior, regardless of time-out values set in Windows HTTP Services.
ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT
The PAC file cannot be downloaded. For example, the server referenced by the PAC URL may not have been reachable, or the server returned a 404 NOT FOUND response.
ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE
The script type is not supported.
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
The URL specified a scheme other than «http:» or «https:».
ERROR_NOT_ENOUGH_MEMORY
Not enough memory was available to complete the requested operation.
Header: Declared in Winerror.h
ERROR_INSUFFICIENT_BUFFER
The size, in bytes, of the buffer supplied to a function was insufficient to contain the returned data. For more information, see the specific function.
Header: Declared in Winerror.h
ERROR_INVALID_HANDLE
The handle passed to the application programming interface (API) has been either invalidated or closed.
Header: Declared in Winerror.h
ERROR_NO_MORE_FILES
No more files have been found.
Header: Declared in Winerror.h
ERROR_NO_MORE_ITEMS
No more items have been found.
Header: Declared in Winerror.h
ERROR_NOT_SUPPORTED
The required protocol stack is not loaded and the application cannot start WinSock.
Header: Declared in Winerror.h
For Windows XP and Windows 2000, see the Run-Time Requirements section of the WinHttp start page.
Источник
- Remove From My Forums
-
Question
-
Hi,
We have 1 central site and 2 primary child sites. When we deploy updates from the central site to clients in the child sites everything is working fine.
All child sites have a SUP role that connected to the central site (downstream). The central site use proxy to connect to the internet.
My questions are:
Is it possible to manage SU from the child site (create update list and downloading SU for packages)?
if so, do we need to connect the child sites to the internet?
Can we manage SU from a remote console?
Kobi
Answers
-
I am not sure exactly what but something isn’t configured correctly. It shouldn’t be trying to get content from teh internet, it should be going to the parent server. Did you make it active? Was this server a WSUS server before becoming a SUP?
I suggest you uninstall it and reinstall according to the instructions here: http://technet.microsoft.com/en-us/library/bb633236.aspx but make sure that you installed WSUS according to the docs too. http://technet.microsoft.com/en-us/library/bb693980.aspx
If those two docs are followed, WSUS is installed cleanly and never used stand alone on the box and there are not GPO’s software updates are failrly fool proof and always work.
John Marcum | http://www.TrueSec.com/en/Training.htm | http://myitforum.com/cs2/blogs/jmarcum
-
Marked as answer by
Monday, December 21, 2009 5:46 AM
-
Marked as answer by
I am trying to make an http connection to my own domain and return a string. I have it working with www.microsoft.com but when i change the domain to www.atomic-gaming.info (my domain) i get an error 12029 and if i change the link to www.yahoo.com i get an error 12017
code
DWORD dwSize = 0;
DWORD dwDownloaded = 0;
LPSTR pszOutBuffer;
BOOL bResults = FALSE;
HINTERNET hSession = NULL,
hConnect = NULL,
hRequest = NULL;
// 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 );
WinHttpSetOption(hSession, WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS,NULL,NULL);
// Specify an HTTP server.
if( hSession )
hConnect = WinHttpConnect( hSession, L"www.microsoft.com",
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 );
// Send a request.
if( hRequest )
bResults = WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
WINHTTP_NO_REQUEST_DATA, 0,
0, 0 );
// End the request.
if( bResults )
bResults = WinHttpReceiveResponse( hRequest, NULL );
// 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 );
can someone give me an idea why this only works with microsoft.com? and how would i go about fixing it?
|
|
|
HttpSendRequest() FAILED 12029
, фэйлится исключительно под VPN
- Подписаться на тему
- Сообщить другу
- Скачать/распечатать тему
|
|
стоит задача скачать файл с сервака c каким то IP. пусть будет 1.2.3.4 const wchar_t* severname = L»1.2.3.4″; const long bufferlength = 1000000; wchar_t* data = (wchar_t*) malloc( bufferlength ); unsigned int bytesReaded = 0; LoadFileHTTP( severname, L»FILELIST.ZIP», (BYTE*)data, bufferlength, &bytesReaded ); на машинах кторые под VPN сидят в инете после вызова HttpSendRequest ловится ошибка 12029. через IE файл отлично скачивается. где собако могла порытся? вот реализация загрузчика: UINT Setup::LoadFileHTTP(const wchar_t *host, const wchar_t *url, unsigned char *buffer, unsigned int bufferLength, unsigned int *bytesReaded, IProgressBar* progress ) { UINT res = S_OK; HINTERNET hInet = ::InternetOpen( L»Test Application», INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 ); if ( hInet ) { HINTERNET hInetConn = ::InternetConnect( hInet, host, INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0 ); if ( NULL != hInetConn ) { const wchar_t *AcceptTypes[] = { L»*/*», NULL }; HINTERNET hRequest = ::HttpOpenRequest( hInetConn, L»GET», url, NULL, NULL, AcceptTypes, INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_COOKIES, NULL ); if ( NULL != hRequest ) { if ( ::HttpSendRequest( hRequest, L»», -1, NULL, NULL ) ) { if( !::InternetReadFile( hRequest, buffer, bufferLength, (unsigned long*)bytesReaded ) ) { pgLog::error( «::InternetReadFile() FAILED %d», GetLastError() ); res = 5; } } else { pgLog::error( «::HttpSendRequest() FAILED %d», GetLastError() ); res = 4; } ::InternetCloseHandle( hRequest ); } else { pgLog::error( «::HttpOpenRequest( GET, %S) FAILED %d», url, GetLastError() ); res = 3; } ::InternetCloseHandle( hInetConn ); } else { pgLog::error( «::InternetConnect( %S ) FAILED %d», host, GetLastError() ); res = 2; } } else { pgLog::error( «::InternetOpen FAILED %d», GetLastError() ); res = 1; } return res; } Сообщение отредактировано: progman — 10.04.10, 09:27 |
gen.izh |
|
список ошибок в помощь: Цитата Error Code 12138 так перевел промт Цитата Код ошибки системы 12150 средств «требуемый заголовок не мог быть расположен.» Этот код ошибки может также показать как «ERROR_HTTP_HEADER_NOT_FOUND» или как определенная ценность.
вот тут вроде америкосы пытали эту тему Сообщение отредактировано: gen.izh — 25.03.10, 18:45 |
progman |
|
появились уточненния по сабжу |
GoldFinch |
|
Full Member Рейтинг (т): 11 |
посмотрите снифером что происходит %) |
progman |
|
Цитата GoldFinch @ 10.04.10, 10:10 посмотрите снифером что происходит %) проблематично. тестеры это как бы помягче сказать — не обременены мозгом и снифер поставить и запустить ни асилят ((( |
0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
0 пользователей:
- Предыдущая тема
- C/C++: Сетевое программирование
- Следующая тема
[ Script execution time: 0,0211 ] [ 16 queries used ] [ Generated: 9.02.23, 19:54 GMT ]