HTTPProxy() + async HTTPRequest() error

Just starting out? Need help? Post your questions and find answers here.
zikitrake
Enthusiast
Enthusiast
Posts: 738
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain
Contact:

HTTPProxy() + async HTTPRequest() error

Post by zikitrake »

Hello :D

This code fails randomly when I activate HTTPProxy() with a
the debugged executable quit unexpectedly
(if I deactivate it it is executed correctly)

PB 5.71 LTS x64, Windows 10 x64

Code: Select all

InitNetwork()

Repeat
 
  If status = 0
    HTTPProxy("http://159.203.45.27:8080")
    
    HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com", "", #PB_HTTP_Asynchronous)
    If HttpRequest
      status = 1
      Debug "started"
    EndIf
  EndIf
 
  If status = 1
    Progress = HTTPProgress(HttpRequest)
    Delay(1000)
    
    If progress
      Debug Progress
    Else
      FinishHTTP(HTTPRequest)
      status = 0
    EndIf
    
    If status And Progress = #PB_HTTP_Success Or Progress = #PB_HTTP_Failed Or Progress = #PB_HTTP_Aborted
     
      If Progress = #PB_HTTP_Success
        *Buffer = HTTPMemory(HTTPRequest)
        Debug PeekS(*Buffer, MemorySize(*Buffer), #PB_UTF8|#PB_ByteLength)
        FreeMemory(*Buffer)
      EndIf
     
      FinishHTTP(HTTPRequest)
      status = 0
      Debug "finished"
    EndIf
  EndIf
 Delay(1000)
ForEver

PS: I know that proxy is currently google-banned, but that's another story :)