One can have curl as a bash loadable routine without the need to recompile bash. Headless or not, much more sane[4] than ctypes.sh[1] as curl binary epilog/prolog handle the non-http protocol items within the context of curl module/program. More relevant logic level related to topic beyond http protocol only curl : socat[2] and gnu netcat[3].
Ah, HN doesn't provide a way to conjure up * data tapes (comments not withstanding). Ebnf being battle tested for years & grepping the ANTLER[7] by the horns:
awk interpeting http stream via http protocol[5] via ebnf of http protocol likely to better handle the different protocal layers more gracefully than bash script. Would need to make sure awk is in bit mode and not character/byte mode to avoid line discipline issues / 'stty sane'[4]. Note:
Perl/python provide better layers of abstraction than shell coding for the different levels of protocols used in/with http protocol/ ebnf,Kleene* coding.[6] In shell, having a different command programm for every ebnf set/protocol level vs. awk, different ebnf for each Kleene* protocol level)
---------------------------------------------------------------------------------------------
[0] : Your trerminal is not a terminal: An Introduction to Streams : https://www.lucasfcosta.com/blog/streams-introduction
[1] : ctypes.sh : https://github.com/taviso/ctypes.sh
[2] : socat : https://github.com/3ndG4me/socat/releases
[3] : gnu netcat: https://netcat.sourceforge.net/
[4] : stty sane : https://real-world-systems.com/docs/stty.1.html
https://jaredgorski.org/notes/unix-tty/
[5] : https://www.rfc-editor.org/rfc/rfc9110.pdf