Archives

ArchivesSearch for:

curl now warns before outputting binary data to terminal

Without the -O flag, curl normally outputs what it retrieves, even when a binary file is requested. I’ve “rendered” binary files this way more times than I can remember, making the 7.55.0 release quite welcome.

One of the least favorite habits of curl during all these years, I’ve been told, is when users forget to instruct the command line tool where to store the downloaded file and as a direct consequence, curl instead sends a lot of binary “gunk” to the terminal. The end result of that is at best just a busload of weird-looking characters on the screen, but with just a little bit of bad luck it can also lock up the terminal completely or change it in other ways.

Starting in curl 7.55.0 (from this commit), curl will inspect the beginning of each download that has been told to get sent to the terminal (tty!) and attempt to detect and prevent raw binary output to get sent there.