I want use WinHttpRequest to access a OpenShift API server, it use a self signed certificate.
Does now work...
I never try with a self signed certificate, how do this?
Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://openshift.domain:1234/api/", False) $oHttp.Option(4) = 0x0100 + 0x0200 + 0x1000 + 0x2000 $oHTTP.Option(9) = 0x0080 ;WinHttpRequestOption_SecureProtocols ;~ $oHttp.SetClientCertificate("LOCAL_MACHINE\\Personal\\certificado.crt") $oHttp.Send() $oHttp.WaitForResponse() Local $oAllHeaders = $oHttp.GetAllResponseHeaders() $oReceived = $oHttp.ResponseText $oStatusCode = $oHttp.Status $oHttp = 0 If $oStatusCode = 200 Then ConsoleWrite("$oAllHeaders--------------------" & @LF & $oAllHeaders & "$oAllHeaders--------------------" & @LF) Else ConsoleWrite("< error = " & $oReceived & @LF & $oAllHeaders & @LF) EndIf
I am having an issue with multiple Windows 10 systems (actually all systems running Windows 10 running the same script have this issue) I have a script which calls the winhttp.winhttprequest.5.1 object and allows me to get sites HTML source, I am using multiple Open commands on the same object which I didn't assume would be an issue.
The issue I am getting is quite often the Send command to the object will fail (in fact I have not been able to finish running the script because it fails everytime) with an Error
Now this exact code was working fine in Windows 8/8.1 and Windows 7 before I upgraded the systems to Windows 10, anybody know what's going on here?
P.S when I say I use multiple Open and Send commands I mean I have two instances of winhttprequest objects open and it probably does a total of about 600 Open and Sends but as I mentioned this had never been an issue until Windows 10.
Not familiar with "winhttp.winhttprequest.5.1" Object, Ergo: Just experimenting a bit with it.
When using the 'ResponseStream' option ... AutoIt crashes.
- Anything I'm doing wrong (or missed) ? (or potential issue/bug)
Don't know much about a 'IStream', other than that 'ResponseStream' is supposed to return a pointer to it.
msdn: WinHttpRequest Object
main() Func main() Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") Local $sType = 'GET' Local $sUrl = 'http://www.autoitscript.com/site/' Local $sData = '' ;; optional parm. _HTTPRequest($oHTTP, $sType, $sUrl, $sData) EndFunc Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "") ;; http://msdn.microsoft.com/en-us/library/aa384106 Local $iResult = 0 ;; debug $oHTTP.Open($oMethod, $oURL, False) ;; empty -> ok. $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:126.96.36.199) Gecko/2008120122 Firefox/3.0.5") ;; empty -> ok. If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ;; empty -> ok. EndIf $oHTTP.Send($oData) ;; empty -> ok. ;~ ;; options: ResponseBody, ResponseStream, ResponseText, Status, StatusText ;~ $iResult = $oHTTP.StatusText ;; "OK" -> ok. ;~ $iResult = $oHTTP.Status ;; 200 -> ok. ;~ $iResult = $oHTTP.ResponseBody ;; binary(ResponseText) -> ok. ;~ $iResult = $oHTTP.ResponseText ;; html page/content -> ok. $iResult = $oHTTP.ResponseStream ;; crash with 188.8.131.52 & 184.108.40.206 (Win.Xp.32b) EndFunc