Created
February 26, 2025 02:16
-
-
Save ueno1969/bba3947fc8338b27f4ec3a14006b37c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| curl --no-progress-meter -o /dev/null --trace - "$@" | ( | |
| set -- awk | |
| type gawk >/dev/null 2>&1 && set -- gawk -n | |
| LC_ALL=C "$@" ' | |
| BEGIN { | |
| printed_header = 0 | |
| printed_data = 0 | |
| output_stdout = 0 | |
| } | |
| /^[0-9a-f]+:/ { | |
| $0 = substr($0, 7, 47) | |
| for (i = 1; i <= NF; i++) { | |
| line = sprintf("%c", int("0x" (last = $i))) | |
| if (output_stdout) { | |
| printf "%s", line | |
| } else { | |
| printf "%s", line > "/dev/stderr" | |
| } | |
| } | |
| } | |
| /^<= Recv header/ { | |
| if (!printed_header) { | |
| line = "========================================" | |
| if (output_stdout) { | |
| print line | |
| } else { | |
| print line > "/dev/stderr" | |
| } | |
| printed_header = 1 | |
| } | |
| } | |
| /^== Info: .* sent off/ { | |
| if (last != "0a") { | |
| if (output_stdout) { | |
| print "" | |
| } else { | |
| print "" > "/dev/stderr" | |
| } | |
| } | |
| line = "========================================" | |
| if (output_stdout) { | |
| print line | |
| } else { | |
| print line > "/dev/stderr" | |
| } | |
| } | |
| /^<= Recv data/ { | |
| if (!printed_data) { | |
| line = "========================================" | |
| if (output_stdout) { | |
| print line | |
| } else { | |
| print line > "/dev/stderr" | |
| } | |
| printed_data = 1 | |
| } | |
| output_stdout = 1 | |
| END { | |
| print "" | |
| } | |
| ' | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment