Skip to content

Commit 4b438b0

Browse files
committed
Chore: Fix WinHTTP timeout coding
1 parent 3da7c84 commit 4b438b0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

wd_core.au3

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ Global Const $WD_Element_Invalid = "invalid argument"
332332
Global Const $WD_Element_Intercept = "element click intercepted"
333333
Global Const $WD_Element_NotInteract = "element not interactable"
334334

335+
Global Const $WD_WinHTTPTimeoutMsg = "WinHTTP request timed out before Webdriver"
335336
#EndRegion Global Constants
336337

337338

@@ -1432,7 +1433,7 @@ Func __WD_Get($sURL)
14321433
Local $hOpen = _WinHttpOpen()
14331434

14341435
If $_WD_WINHTTP_TIMEOUTS Then
1435-
_WinHttpSetTimeouts($_WD_HTTPTimeOuts[0], $_WD_HTTPTimeOuts[1], $_WD_HTTPTimeOuts[2], $_WD_HTTPTimeOuts[3])
1436+
_WinHttpSetTimeouts($hOpen, $_WD_HTTPTimeOuts[0], $_WD_HTTPTimeOuts[1], $_WD_HTTPTimeOuts[2], $_WD_HTTPTimeOuts[3])
14361437
EndIf
14371438

14381439
; Get connection handle
@@ -1455,6 +1456,7 @@ Func __WD_Get($sURL)
14551456

14561457
If $iErr Then
14571458
$iResult = $_WD_ERROR_SendRecv
1459+
$sResponseText = $WD_WinHTTPTimeoutMsg
14581460
ElseIf $_WD_HTTPRESULT = $HTTP_STATUS_SERVER_ERROR Then
14591461
$iResult = $_WD_ERROR_Timeout
14601462
EndIf
@@ -1517,7 +1519,7 @@ Func __WD_Post($sURL, $sData)
15171519
Local $hOpen = _WinHttpOpen()
15181520

15191521
If $_WD_WINHTTP_TIMEOUTS Then
1520-
_WinHttpSetTimeouts($_WD_HTTPTimeOuts[0], $_WD_HTTPTimeOuts[1], $_WD_HTTPTimeOuts[2], $_WD_HTTPTimeOuts[3])
1522+
_WinHttpSetTimeouts($hOpen, $_WD_HTTPTimeOuts[0], $_WD_HTTPTimeOuts[1], $_WD_HTTPTimeOuts[2], $_WD_HTTPTimeOuts[3])
15211523
EndIf
15221524

15231525
; Get connection handle
@@ -1540,6 +1542,7 @@ Func __WD_Post($sURL, $sData)
15401542

15411543
If $iErr Then
15421544
$iResult = $_WD_ERROR_SendRecv
1545+
$sResponseText = $WD_WinHTTPTimeoutMsg
15431546
ElseIf $_WD_HTTPRESULT = $HTTP_STATUS_SERVER_ERROR Then
15441547
$iResult = $_WD_ERROR_Timeout
15451548
EndIf
@@ -1598,7 +1601,7 @@ Func __WD_Delete($sURL)
15981601
Local $hOpen = _WinHttpOpen()
15991602

16001603
If $_WD_WINHTTP_TIMEOUTS Then
1601-
_WinHttpSetTimeouts($_WD_HTTPTimeOuts[0], $_WD_HTTPTimeOuts[1], $_WD_HTTPTimeOuts[2], $_WD_HTTPTimeOuts[3])
1604+
_WinHttpSetTimeouts($hOpen, $_WD_HTTPTimeOuts[0], $_WD_HTTPTimeOuts[1], $_WD_HTTPTimeOuts[2], $_WD_HTTPTimeOuts[3])
16021605
EndIf
16031606

16041607
; Get connection handle
@@ -1621,6 +1624,7 @@ Func __WD_Delete($sURL)
16211624

16221625
If $iErr Then
16231626
$iResult = $_WD_ERROR_SendRecv
1627+
$sResponseText = $WD_WinHTTPTimeoutMsg
16241628
ElseIf $_WD_HTTPRESULT = $HTTP_STATUS_SERVER_ERROR Then
16251629
$iResult = $_WD_ERROR_Timeout
16261630
EndIf

0 commit comments

Comments
 (0)