AttilaP Posted February 19, 2021 Share Posted February 19, 2021 (edited) Hi! I've created a program which is reading data from the web. The site is using https, and while it works fine for me on Windows 10 x64, it fails on Windows 7 x64 at my partner. I am using ObjCreate("WinHttp.WinHttpRequest.5.1") and the Send method always fails with error: "An error occurred in the secure channel support". I've read through that Win7 does not support TLS1.2 by default, so I tried to fix this first. I followed this article: https://support.microsoft.com/en-us/topic/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-winhttp-in-windows-c4bd73d2-31d7-761e-0178-11268bb10392 - It turned out that kb3140245 is already installed. Checked winhttp.dll and webio.dll files in SysWOW64 and system32 folder in C:\Windows, both are correct (winhttp: 6.1.7601.24xxx, webio: 6.1.7601.23375) - Registry keys seems to be correct. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client and TLS 1.2\Client are there, both having DisabledByDefault as 0. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp has DefaultSecureProtocols with 0xa80, also tried with 0x800, same error - Control Panel's internet settings checked, TLS1.0 to TLS 1.2 enabled, SSL2.0 and SSL3.0 are disabled. Tried to switch on all, enable only 1.2, same error. - Tried to add $objHTTP.option(9) = 2048 to use TLS 1.2, same error - Tried to change the object to ObjCreate("MSXML2.ServerXMLHTTP.6.0"), same error - Tried to change the link to http:// instead of https:// - it has a redirect, page does not support http at all. - Tried to use _IE to navigate to the page and get the content. As I am working with JSONs, it fails - IE shows the download button instead of rendering the JSON text, like Chrome does. I am out of ideas. This is really inconvenient for me, my partner is not even able to use the software. Sure I could say Win7 is old, outdated, should be updated - that's not my choice. Do somebody have idea how to retrieve data from the web w/o winhttp, or how to get rid of this error? Thank you in advance, Attila Edited February 19, 2021 by AttilaP Link to comment Share on other sites More sharing options...
mikell Posted February 19, 2021 Share Posted February 19, 2021 (edited) I have got some issues using winhttp in an old OS too and it worked super nice using curl Edit: example of use #include <AutoItConstants.au3> Func __INetRead($url) Local $cmd = "curl -L -s -k -A 'Mozilla/4.0(compatible;MSIE7.0;WindowsNT5.1)' " & $url Local $iPID = Run($cmd, "", @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) Local $output = StdoutRead($iPID) Return $output EndFunc Edited February 19, 2021 by mikell FrancescoDiMuro and AttilaP 2 Link to comment Share on other sites More sharing options...
Nine Posted February 19, 2021 Share Posted February 19, 2021 I have the same issue as you OP. Didn't find a way to make it work. But gladly, most of the site works well with InetGet and InetRead. AttilaP 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
AttilaP Posted February 19, 2021 Author Share Posted February 19, 2021 Thank you for your suggestions! I have to use GET and POST, so it seems curl might be able to do the job... But it does not handle the cookies like WinHTTP does. If I have to handle the cookies manually, that's really a headache... Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2021 Share Posted February 19, 2021 (edited) @AttilaP Is the COM return code 0x80072F7D (Error 12157), 0x80072F8F (Error 12175), or some other code? The possible root causes and resolutions of the issue is dependent on the specific return code. Edited February 19, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
AttilaP Posted February 19, 2021 Author Share Posted February 19, 2021 It is 0x80072F7D Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2021 Share Posted February 19, 2021 (edited) Good, that one is easier to resolve. Attached are the registry keys that are updated by the MS EasyFix app. These keys assume that the host machine is Win7 x64. It is a .reg file so, after confirming the values are the ones you want, you can merge them by double-clicking on the file or you can manually confirm the values of each key. Can you see if these entries work for you? Edited February 26, 2022 by TheXman AttilaP 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
mLipok Posted February 19, 2021 Share Posted February 19, 2021 We had similar issue and we have it fixed, do not remeber how but I think that I have solution in my office. I would be able to check at monday. AttilaP 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
AttilaP Posted February 19, 2021 Author Share Posted February 19, 2021 1 hour ago, TheXman said: Good, that one is easier to resolve. Attached are the registry keys that are updated by the MS EasyFix app. These keys assume that the host machine is Win7 x64. It is a .reg file so, after confirming the values are the ones you want, you can merge them by double-clicking on the file or you can manually confirm the values of each key. Can you see if these entries work for you? TLS Fix x64.reg 2.03 kB · 3 downloads Unfortunately this fix did not help, the result is the same. Link to comment Share on other sites More sharing options...
TheXman Posted February 19, 2021 Share Posted February 19, 2021 (edited) Can you post your script or at least an example that produces the error? Also, have you tried rerunning the standalone Windows Update? I have also attached the original, signed, EasyFix from Microsoft just in case it did more than set the registry keys that I listed. The EasyFix needs to be run after the Windows Update. Edited February 26, 2022 by TheXman FrancescoDiMuro 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Nine Posted February 19, 2021 Share Posted February 19, 2021 FWIW, the fix from TheXman solves it on my Win7 comp using the code from this topic (both http and https) : https://www.autoitscript.com/forum/topic/205127-i-have-a-problem-with-winhttp/?tab=comments#comment-1475085 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mikell Posted February 19, 2021 Share Posted February 19, 2021 2 hours ago, AttilaP said: curl might be able to do the job... But it does not handle the cookies It does ! just read the documentation Link to comment Share on other sites More sharing options...
mLipok Posted February 21, 2021 Share Posted February 21, 2021 (edited) On 2/19/2021 at 5:40 PM, mLipok said: We had similar issue and we have it fixed, do not remeber how but I think that I have solution in my office. I would be able to check at monday. https://docs.microsoft.com/pl-pl/dotnet/framework/network-programming/tls Quote Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727] "SystemDefaultTlsVersions"=dword:00000001 "SchUseStrongCrypto"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319] "SystemDefaultTlsVersions"=dword:00000001 "SchUseStrongCrypto"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727] "SystemDefaultTlsVersions"=dword:00000001 "SchUseStrongCrypto"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319] "SystemDefaultTlsVersions"=dword:00000001 "SchUseStrongCrypto"=dword:00000001 I was able to find some helpfull information today. I think that there was also other... I will try to find tomorrow. TLS_SSL_NetFramework.reg Edited February 21, 2021 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
AttilaP Posted February 23, 2021 Author Share Posted February 23, 2021 (edited) We tried all registry patches, without result. BUT! Nine's answer pushed me towards the solution: I tried the WinHTTP library. As I mentioned, I used ObjCreate("WinHttp.WinHttpRequest.5.1") to initiate the object, and the result was not working. While, using the WinHTTP library it works flawlessly, even without $WINHTTP_FLAG_SECURE flag (when it was set, nothing returned). So, I've made a small function to be able to GET and POST to different webpages, which you can find here - might be useful for somebody in the future: Global Const $USERAGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36" Global $hOpen = _WinHttpOpen() ... Func Call_HTTP($strBaseURL, $strURL, $strMode, $strData = '', $strContentType = '') Local $hConnect = _WinHttpConnect($hOpen, $strBaseURL) Local $hRequest = _WinHttpOpenRequest($hConnect, $strMode, $strURL) _WinHttpAddRequestHeaders($hRequest, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") If $strContentType <> '' Then _WinHttpAddRequestHeaders($hRequest, "Content-Type: " & $strContentType) _WinHttpAddRequestHeaders($hRequest, "User-Agent: " & $USERAGENT) _WinHttpSendRequest($hRequest, Default, $strMode = 'POST' ? $strData : '') _WinHttpReceiveResponse($hRequest) Local $sReturned = '' If _WinHttpQueryDataAvailable($hRequest) Then Do $sReturned &= _WinHttpReadData($hRequest) Until @error EndIf Return $sReturned EndFunc ;==>Call_HTTP Parameters: $strBaseURL is the base URL, like "http://google.com" $strURL is the rest of the URL (if any), like "/?q=test" $strMode is either GET or POST $strData is the data to be sent when it is a POST request $strContentType is the Content-Type header I know that CrackURL could have been used to split up the URL, but my old function was created like this already. Thank you everybody, really, REALLY appreciated. Edited February 23, 2021 by AttilaP Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now