Live data from Hacker News

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

mareksuppa.com

251–255 of 255 posts

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

#251

Earlier quoted context omitted.

But they were right and you were wrong. Your mistake is in thinking that years are cardinal numbers when they're actually ordinal. The current year counting was based on the same way years were counted in the past, so you had things like "the 10th year of Caesar's reign". So the year 1 A D. was the first year of Christ's reign. The year 2000 was the 2000th year of Christ's reign so that's what is celebrated. Alternat…

The first 10 years are 1 through 10. That is the first decade. Consequently, the next decade is years 11 through 20. The first century is years 1 through 100. Therefore, the second century is years 201 through 300. The first millenium is years 1 through 1000. Therefore, the second millenium is years 2001 through 3000. There is no year zero.

The first year of Christ's reign is the year 1.

The hundredth year of Christ's reign is the year 100.

The thousandth year of Christ's reign is 1000.

The two thousandth year of Christ's reign is 2000.

There is no year zero.

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

#253
post #206

Earlier quoted context omitted.

It used to be even more literally so - network mail started off as using FTP to SNDMSG onto a remote system instead of your own. In RFC475, FTP has MAIL and MLFL (mailfile) commands to support this. I think it's neat that you can still find echoes of this. MAIL worked by just appending to MLFL, separating records with CRLF.CRLF - which is still how Data segments are terminated in SMTP.

Was that before or after UUCP? I know that UUCP carried a command in each message, so you would specify a message body with a tag that says pass it to the mail receiving peogram.

SNDMSG-over-ftp pre-dates UUCP by 5 years, so I think that one's pretty clear-cut.

(Not that I'm claiming anything's original here, ftp & smtp are both in the nwg/ietf family tree, which makes it easy to draw parallels. There's probably 100 other influences.)

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

#254

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…

I sent many an email from jacques.chirac@elysee.fr, the veneer of the terminal helping, my friends were quite impressed by how good a hacker I was. Good olde days when many DKIM/SPF weren't a thing yet and SMTP servers weren't even authenticated.

I ran an EFnet server in the mid-90s and therefore could fake DNS entries for myself. I was often on IRC from "aliens.gov" which seemed funny at the time, but now that domain finally became an unfunny reality.

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

#255

Earlier quoted context omitted.

With agents in the house now, we don't use curl at all. Slowly they all are becoming implementation details.

Probably curl is safer than whatever cobbled up bash script your agent invented. Battle tested for years, and free, why replace that?

Guess streams was a mixed analog / digital world thing[0]. Is 'curl' the higher order wave crest of LC_NETWORK (aka 'sane' http protocol reference to type bundled 0,1,2 file descriptors)

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

[6] : https://grokipedia.com/page/Kleene_star

[7] : https://en.wikipedia.org/wiki/ANTLR

Post reply on HN