Jump to content

[solved] WinHttpRequest Object, ResponseStream, Crash.


MvGulik
 Share

Recommended Posts

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:1.9.0.5) 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 3.3.6.1 & 3.3.7.14 (Win.Xp.32b)
EndFunc
Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Lets put is down to trying to using a feature(IStream) in the wrong mode. (just presuming)

Don't think it should crash AutoIt ... but don't see any other direct downside's to it either. So I leave it at that.

Solved as far I'm concerned.

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...