1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Added a cont to specify base64 line wrap.

This commit is contained in:
Guenter Knauf 2013-04-04 00:55:01 +02:00
parent ce8a35c318
commit 7ba091ca82

View File

@ -26,7 +26,7 @@
'* Hacked by Guenter Knauf '* Hacked by Guenter Knauf
'*************************************************************************** '***************************************************************************
Option Explicit Option Explicit
Const myVersion = "0.3.6" Const myVersion = "0.3.7"
Const myUrl = "http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1" Const myUrl = "http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1"
@ -36,6 +36,7 @@ Const myCdSavF = FALSE ' Flag: save downloaded data to file certdata.txt
Const myCaBakF = TRUE ' Flag: backup existing ca-bundle certificate Const myCaBakF = TRUE ' Flag: backup existing ca-bundle certificate
Const myAskLiF = TRUE ' Flag: display certdata.txt license agreement Const myAskLiF = TRUE ' Flag: display certdata.txt license agreement
Const myAskTiF = TRUE ' Flag: ask to include certificate text info Const myAskTiF = TRUE ' Flag: ask to include certificate text info
Const myWrapLe = 76 ' Default length of base64 output lines
'******************* Nothing to configure below! ******************* '******************* Nothing to configure below! *******************
Dim objShell, objNetwork, objFSO, objHttp Dim objShell, objNetwork, objFSO, objHttp
@ -239,7 +240,8 @@ End Function
Function Base64Encode(inData) Function Base64Encode(inData)
Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dim cOut, sOut, I Dim cOut, sOut, lWrap, I
lWrap = Int(myWrapLe * 3 / 4)
'For each group of 3 bytes 'For each group of 3 bytes
For I = 1 To Len(inData) Step 3 For I = 1 To Len(inData) Step 3
@ -265,9 +267,9 @@ Function Base64Encode(inData)
'Add the part To OutPut string 'Add the part To OutPut string
sOut = sOut + pOut sOut = sOut + pOut
'Add a new line For Each 76 chars In dest (76*3/4 = 57) 'Add a new line For Each myWrapLe chars In dest
If (I < Len(inData) - 2) Then If (I < Len(inData) - 2) Then
If (I + 2) Mod 57 = 0 Then sOut = sOut & vbLf If (I + 2) Mod lWrap = 0 Then sOut = sOut & vbLf
End If End If
Next Next
Select Case Len(inData) Mod 3 Select Case Len(inData) Mod 3