Skip to content

Commit

Permalink
[cHttpRequest] Fix sending byte-arrays and import root CAs from file
Browse files Browse the repository at this point in the history
  • Loading branch information
wqweto committed Oct 25, 2022
1 parent a80b1db commit 62114be
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions contrib/cHttpRequest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ End Property

Public Property Let Option_(ByVal eOption As WinHttpRequestOption, ByVal RHS As Variant)
If IsObject(m_vOptions(eOption)) Then
Set m_vOptions(eOption) = RHS
If eOption = WinHttpRequestOption_RootCA And Not IsObject(RHS) Then
Dim oRootCa As New cTlsSocket
oRootCa.ImportPemRootCaCertStore CStr(RHS)
Set m_vOptions(eOption) = oRootCa
Else
Set m_vOptions(eOption) = RHS
End If
Else
Select Case VarType(m_vOptions(eOption))
Case vbBoolean
Expand Down Expand Up @@ -466,8 +472,9 @@ Public Sub Send(Optional ByVal Body As Variant)
ElseIf IsMissing(Body) Or IsEmpty(Body) Or IsNull(Body) Then
Set .SendStream = Nothing
ElseIf VarType(Body) = vbByte + vbArray Then
If UBound(Body) >= 0 Then
Set .SendStream = SHCreateMemStream(Body(0), UBound(Body) + 1)
baData = Body
If UBound(baData) >= 0 Then
Set .SendStream = SHCreateMemStream(baData(0), UBound(baData) + 1)
Else
Set .SendStream = Nothing
End If
Expand Down Expand Up @@ -2112,7 +2119,7 @@ Private Sub Class_Initialize()
m_vOptions(WinHttpRequestOption_EnableCertificateRevocationCheck) = False
m_vOptions(WinHttpRequestOption_RejectUserpwd) = False
Set m_vOptions(WinHttpRequestOption_RootCA) = Nothing
SetTimeouts 5000, 5000, 15000, 15000
SetTimeouts 5000, 5000, 30000, 30000
Set m_uRequest.Headers = CreateObject("Scripting.Dictionary")
m_uRequest.Headers.CompareMode = vbTextCompare
Set m_uResponse.Headers = CreateObject("Scripting.Dictionary")
Expand Down

0 comments on commit 62114be

Please sign in to comment.