Created
January 8, 2020 00:56
-
-
Save ChrisPritchard/7abb41d5d9405e84835b4ec303abeb2a to your computer and use it in GitHub Desktop.
Simple console app that helps calculate the hex size for body content in a transfer-encoding request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
[<EntryPoint>] | |
let main argv = | |
printfn "enter lines and end with EOF\n" | |
let sep = "\r\n" | |
let rec builder acc = | |
let line = Console.ReadLine () | |
if line.Contains "EOF" then | |
let final = line.Substring (0, line.IndexOf "EOF") | |
(acc + sep + final).TrimStart (sep.ToCharArray()) | |
else | |
builder (acc + sep + line) | |
let body = builder "" | |
let hexlen = body.Length.ToString "X" | |
printfn "\ncopy between [START and END]\n\n[START\n%s\n%s\n0\n\nEND]" hexlen body | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment