Live data from Hacker News

TIL: You can make HTTP requests without curl using Bash /dev/TCP

mareksuppa.com

71–80 of 255 posts

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#71
post #31

Earlier quoted context omitted.

This is the most Claude pilled comment I've seen here.

This worries me. Some AI writing styles became mainstream; at first it was the em-dashes, now it’s “A, not B” patterns and excessive acknowledging. There will be more. Was grandparent comment written by an LLM? Or is this a human who copies a style they saw in a blog post, unaware that they’re copying an AI? Or is this a human who spent too much time talking to an AI and now they just talk like this? Or is this an or…

When learning a language, I've heard it's good to find a reference speaker, such as a prolific actor, and mimic them in order to absorb several aspects of what makes them sound authentic as a speaker, such as vocabulary, intonation, diction, pacing.

For many in the next generation of language learners, this reference will be Claude.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#73

As a kid in the late 90s my mind was blown when I realized I could telnet to port 80, 25, or 110 and interact with the servers manually. Simple get: GET / HTTP/1.1 Content-Type: text/html User-Agent: l33t hax0rs lol X-Funny-Monkey: farts For sending a mail message on port 25: HELO mail-from: whoever@whatever.com mail-to: sysadmin@yaya.com Body of the message yay. POP3 was so long ago I forgot but you could list the m…

Last century I would read and send personal email from work using telnet to pop3 and smtp respectively.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#74
post #52

Earlier quoted context omitted.

This is the most Claude pilled comment I've seen here.

It's pretty rough to learn I sound like Claude. Will need to do something about it then. (For what it's worth I did write the message above manually but I understand why no one would believe that now. At least I did not call netcat "load-bearing" [ https://mareksuppa.com/til/load-bearing/ ] or something...)

[dead]

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#75
post #50

Earlier quoted context omitted.

Why wouldn’t you use curl for the quick test?

because in those days there was no curl, or wget. and then when there was, there was no guarantee they'd be installed. telnet was always there though. it also worked for speaking all the other plaintext internet protocols. (imap, pop, smtp, etc)

I used telnet to send mail via SMTP once, it's quite literally a good social protocol because it begins with a polite 'HELO'.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#76

> As it turns out, bash can speak HTTP by itself. No, it can not. Bash lets you open TCP sockets. What you are doing here is trying to speak HTTP yourself, which is fine for testing and debugging, and hella cool for fun to do by hand, but you will shoot yourself in the foot if you try to use this pseudo http client unattended in reality. This toy code does not parse HTTP properly and will break. You could of course w…

Need to be clear that "full http server in pure bash" is incorrect. Bash cannot listen on a TCP/UDP socket for incoming connections.

bash-web-server project builds a C language socket listener [0] that is dynamically loaded at run-time as a "built-in" module that makes the functionality available.

[0] https://github.com/bahamas10/bash-web-server/tree/main/loada...

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#77
post #47

Earlier quoted context omitted.

>No, you can't write 10 lines of code, you have to import a 100k LOC dependency Common misconception, if you want to replace a dependency on a swiss knife you don't need to implement a swiss knife, sometimes you can just implement the last helix of the corkscrew.

it's curious what you'd be building where you think you can hit the reliability of curl with a bash script.

health check, check that website/webapp returns 4xx and some known keyword

api, GET url, content-type aplication/json, parse json

you can even invert it and make a server

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#78

As a kid in the late 90s my mind was blown when I realized I could telnet to port 80, 25, or 110 and interact with the servers manually. Simple get: GET / HTTP/1.1 Content-Type: text/html User-Agent: l33t hax0rs lol X-Funny-Monkey: farts For sending a mail message on port 25: HELO mail-from: whoever@whatever.com mail-to: sysadmin@yaya.com Body of the message yay. POP3 was so long ago I forgot but you could list the m…

When I was 12, I learned about open SMTP relays and how to spoof email this way. I once spoofed an email between two rivals on a community I was a part of and started a flame war.

Good times.

Re: TIL: You can make HTTP requests without curl using Bash /dev/TCP

#79
post #12

> As it turns out, bash can speak HTTP by itself. No, it can not. Bash lets you open TCP sockets. What you are doing here is trying to speak HTTP yourself, which is fine for testing and debugging, and hella cool for fun to do by hand, but you will shoot yourself in the foot if you try to use this pseudo http client unattended in reality. This toy code does not parse HTTP properly and will break. You could of course w…

> No, it can not. Bash lets you open TCP sockets. Very fair pushback -- I did get carried away and will update the article to be more precise. Thanks for raising it! > For less insane, non-bash shells there is always nc which is usually probably the wiser choice. For completeness, `nc` or any netcat equvialent I could think of was not available in the image I was trying this with. It would certainly be a better optio…

FWIW, I didn't read this as AI-like. Even on a re-read, it's only the quasi-em-dash, and _maybe_ the polite acknowledgement of "Very fair pushback" (just good etiquette, IMO!) that would ring any alarm bells. You're fine.
Post reply on HN