Well, long story short, today i managed to strip everything down to this:
Code: Select all
EnableExplicit
InitNetwork()
OpenWindow(0,0,0,400,300,"HTTPRequest test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
EditorGadget(0,0,0,400,300,#PB_Editor_WordWrap|#PB_Editor_ReadOnly)
; spawn various async HTTP requests
NewList requests.i()
; #1 a simple get request
AddElement(requests())
requests() = HTTPRequest(#PB_HTTP_Get,"https://httpbin.org/get?var=value","",#PB_HTTP_Asynchronous)
; #2 a simple post request
AddElement(requests())
requests() = HTTPRequest(#PB_HTTP_Post,"https://httpbin.org/post","var=value",#PB_HTTP_Asynchronous)
; #3 a request with redirect
AddElement(requests())
requests() = HTTPRequest(#PB_HTTP_Get,"http://httpstat.us/301","",#PB_HTTP_Asynchronous)
; #4 a request which will be completed after 30 seconds
AddElement(requests())
requests() = HTTPRequest(#PB_HTTP_Get,"http://httpstat.us/200?sleep=30000","",#PB_HTTP_Asynchronous)
; #5 a request to a non-existent domain
AddElement(requests())
requests() = HTTPRequest(#PB_HTTP_Get,"https://nodomain.d7.wtf","",#PB_HTTP_Asynchronous)
; #6 a request which will timeout
AddElement(requests())
requests() = HTTPRequest(#PB_HTTP_Get,"http://www.google.com:81/","",#PB_HTTP_Asynchronous)
Define ev,log.s
Repeat
ev = WaitWindowEvent(100)
ForEach requests()
If requests() > 0
Select HTTPProgress(requests())
Case #PB_HTTP_Success,#PB_HTTP_Failed,#PB_HTTP_Aborted
log = "[" + FormatDate("%hh:%ii:%ss",Date()) + "] Finished #" + Str(ListIndex(requests()) + 1)
If HTTPInfo(requests(),#PB_HTTP_StatusCode)
log + ", http code: " + HTTPInfo(requests(),#PB_HTTP_StatusCode)
EndIf
If HTTPInfo(requests(),#PB_HTTP_ErrorMessage)
log + ", error: " + HTTPInfo(requests(),#PB_HTTP_ErrorMessage)
EndIf
AddGadgetItem(0,0,log)
FinishHTTP(requests())
requests() = 0
EndSelect
EndIf
Next
Until ev = #PB_Event_CloseWindow
2. Run and wait for it to finish the requests (in about 100 seconds).
3. Let it sit there doing completely nothing for the next several minutes, just leave the window active or switch to something else.
4. It will crash.
The debugger isn't catching anything, but on the system level i get various errors, starting from "segmentation fault" and "illegal instruction" to "alarm" (whatever the last one means).
Can please anyone confirm this? Am i doing something wrong again? If so, what exactly?