Weird and rare WinHttpRequest error

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
venaci
Posts: 10
Joined: 25 Jul 2020, 07:05

Weird and rare WinHttpRequest error

05 Aug 2020, 10:30

I very rarely get an error (0x80072F46) saying WinHttpRequest can't call SetRequestHeader function after calling Send function. It's weird because my code looks like this:

Code: Select all

global whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")

f() {
whr.Open(...)
whr.SetRequestHeader(...)
whr.Send(...)
whr.WaitForResponse(...)
...
}
Code looks completely synchronous for me and I don't know why it sometimes doesn't work (like once in a hundred requests).
Maybe it's caused by multiple f function calls? Or it's because whr is a global variable?
It's very hard to debug an error when it occurs so rare and I don't know by what circumstances it's caused. Nevertheless an error message always points the line with whr.SetRequestHeader(...) call.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Weird and rare WinHttpRequest error

15 Aug 2020, 19:14

this code may be synchronous. ur actual script needn't be, we dont know what it looks like
Maybe it's caused by multiple f function calls?
maybe, maybe not. where is f called? who calls it? how was it called? we cant know
Or it's because whr is a global variable?
its suspect but that on its own doesnt mean much. again we cant know, show something more closely resembling an actual runnable script

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee and 311 guests