Skip to content

Commit f6e3052

Browse files
committed
Added: "text/plain" enctype to _WinHttpSimpleFormFill.
1 parent 94edde2 commit f6e3052

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

WinHttp.au3

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,11 +1239,11 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
12391239
If @error Then Return SetError(2, 0, "") ; invalid form
12401240
Local $aInputIds[4][UBound($aInput)]
12411241
Switch $sEnctype
1242-
Case "", "application/x-www-form-urlencoded"
1242+
Case "", "application/x-www-form-urlencoded", "text/plain"
12431243
For $i = 0 To UBound($aInput) - 1 ; for all input elements
12441244
__WinHttpFormAttrib($aInputIds, $i, $aInput[$i])
12451245
If $aInputIds[1][$i] Then ; if there is 'name' field then add it
1246-
$aInputIds[2][$i] = __WinHttpURLEncode($aInputIds[2][$i])
1246+
$aInputIds[2][$i] = __WinHttpURLEncode($aInputIds[2][$i], $sEnctype)
12471247
$sAddData &= $aInputIds[1][$i] & "=" & $aInputIds[2][$i] & "&"
12481248
If $aInputIds[3][$i] = "submit" Then $sSubmit &= $aInputIds[1][$i] & "=" & $aInputIds[2][$i] & $sGrSep ; add to overall "submit" string
12491249
If $aInputIds[3][$i] = "radio" Then $sRadio &= $aInputIds[1][$i] & "=" & $aInputIds[2][$i] & $sGrSep ; add to overall "radio" string
@@ -1257,7 +1257,7 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
12571257
$sButton = StringTrimRight($sButton, 1)
12581258
$sAddData = StringTrimRight($sAddData, 1)
12591259
For $k = 1 To $iNumParams
1260-
$sPassedData = __WinHttpURLEncode($aDtas[$k])
1260+
$sPassedData = __WinHttpURLEncode($aDtas[$k], $sEnctype)
12611261
$aDtas[$k] = 0
12621262
$sPassedId = $aFlds[$k]
12631263
$aFlds[$k] = 0
@@ -2003,9 +2003,10 @@ Func __WinHttpCharSet($sContentType)
20032003
If $sContentType = "utf-8" Then Return 65001
20042004
EndFunc
20052005

2006-
Func __WinHttpURLEncode($vData)
2006+
Func __WinHttpURLEncode($vData, $sEncType = "")
20072007
If IsBool($vData) Then Return $vData
20082008
$vData = __WinHttpHTMLDecode($vData)
2009+
If $sEnctype = "text/plain" Then Return StringReplace($vData, " ", "+")
20092010
Local $aData = StringToASCIIArray($vData, Default, Default, 2)
20102011
Local $sOut
20112012
For $i = 0 To UBound($aData) - 1

0 commit comments

Comments
 (0)