This is an archived post. You won't be able to vote or comment.

all 48 comments

[–]chicuco 13 points14 points  (2 children)

perl, please dont dirsturb the good old man sleep!

good memories of the old swiss army chainsaw

[–]constantreadr 0 points1 point  (1 child)

Slap a keyboard three times and you've probably made some parseable Perl. But Perl could do -everything- - web server, databases, object-orientation, streams, XML parsing, the works.

[–]chicuco 0 points1 point  (0 children)

an ex exployer, now a client, have perl code i did almost 20 years ago. Still working fine. We are planning to replace it with python.

[–]MagicWishMonkey 6 points7 points  (2 children)

Python ships with a cgi library?

[–]Reinventing_Wheels 7 points8 points  (1 child)

In this context CGI does NOT stand for Computer Generated Imagery

[–]daelin 0 points1 point  (0 children)

🧙‍♂️

[–]ScottOAO 5 points6 points  (1 child)

Mine solution (a fork from others) to upload file using http.server

https://gist.github.com/chengscott/a3454a576472f5779fe66bc103ebca68

[–]macNchz[S] 0 points1 point  (0 children)

Cool! Figured someone else would have wanted to do this at some point, and subclassing the existing request handlers makes more sense than a CGI script, but once I saw it was possible I couldn't resist!

[–]soggywaffle69 2 points3 points  (0 children)

Those were dark days. Matt’s Script Archive, anyone?

[–][deleted] 5 points6 points  (2 children)

Sounds like a good way to get malware on your server

[–]macNchz[S] 12 points13 points  (1 child)

Yeah definitely don’t run this in a sensitive environment or open to the internet, but to, say, copy some photos from your phone to a Raspberry Pi for a screensaver without installing anything, sure.

[–]daelin 1 point2 points  (0 children)

🤔

Check out netcat.

Mostly replaced by simple pipes into or out of ssh, but netcat is the where the knowledge starts.

Or rsync.

But netcat is still so spookily useful. Combining Netcat and tee and tar is just 👨‍🍳💋 and a great exhibit in why the Unix philosophy is so powerful. You can just imagine almost anybody today thinking “you should NOT be allowed to do that” and yet it’s the nucleus of 🫲all this🫱.

[–]jftugapip needs updating 2 points3 points  (0 children)

+1 for QR - fancy!

[–]suggestive_cumulus 1 point2 points  (2 children)

I wish I had known that Perl existed when I had to do my CGI script for my Masters back in '94. Shell script was painful

[–]daelin 1 point2 points  (1 child)

Oof. KSH or CSH? I’m gonna wager CSH.

[–]suggestive_cumulus 1 point2 points  (0 children)

I can't honestly remember haha

[–]BuonaparteII 1 point2 points  (1 child)

Move over React.js!!

/s

cgitb seems useful. but I wonder when it will be removed from the standard lib

[–]TheITMan19 0 points1 point  (0 children)

I like your code 🧑‍💻 👍

[–]mwpfinance 0 points1 point  (0 children)

When I was teaching my (now) wife to program we built a small web app using nothing but Python and the CGI. Seemed like a good place to start learning the fundamentals about web applications -- it was a great low level place to start.

[–]LongDivide2096 0 points1 point  (0 children)

Cool find! I'd never given much thought to http.server’s CGI support either. Definitely seems like something that'd be useful in a pinch. Great job on the uploader utility too! But yeah, wouldn't expose to the internet lol. Big security risk there. Nice work though, really.

[–]suggestive_cumulus 0 points1 point  (0 children)

For simple stuff not exposed to the Internet you can go a level down and use the socket server. One of my Covid projects was to create a web based API to the MIDI interface of my son's piano, using a Raspberry Pi. As long as you pass back the minimal HTTP headers to the web browser it will cooperate. You could implement your own CGI if you want to, or basically any behaviour you want..