Shell The simplest form of http/https

People already suggested to use C and you said
I think that is the best solution, also for using ssl.

Perhaps to first practice with tcl as in my link above, just to learn some http, and then do it in C. Perhaps for learning http the following is enough for him:


Well, also with tcl are ssl connections possible:

 
How it was done it days before pkg and high speed internet, with native unix tools?
In the early days of the "internet" there was no world wide web, thus no web servers either. That all happened in the late '80s, early '90s. A couple of decades after UNIX came into existence. To transfer files you used UUCP and later FTP. Accessing remote servers was done with telnet(1) or rsh(1)/rlogin(1). All pretty much dead and deprecated nowadays.

By December 1990, Berners-Lee and his work team had built all the tools necessary for a working Web: the HyperText Transfer Protocol (HTTP),[9] the HyperText Markup Language (HTML), the first Web browser (named WorldWideWeb, which was also a Web editor), the first Web server (later known as CERN httpd) and the first Web site (http://info.cern.ch) containing the first Web pages that described the project itself.


 
In the early days of the "internet" there was no world wide web, thus no web servers either. That all happened in the late '80s, early '90s. A couple of decades after UNIX came into existence. To transfer files you used UUCP and later FTP. Accessing remote servers was done with telnet(1) or rsh(1)/rlogin(1). All pretty much dead and deprecated nowadays.
You forgot NNTP. The Usenet is still a thing even this deep into the 21st century.
 
There are ways to create a simple webserver using netcat. You can find many examples on the World Wide Web.
But https is a little more complicated.
So it could be done in a Shell Script, yes, in theory.

But what's the point?
What do you want to do this for? Apache/Nginx are professionals at this, they are solid, stable systems with a certain high level of security. What's the point of building a webserver in a few lines of shell script if it's susceptible to DoS attacks, or vulnerable to File Inclusion or Remote Code Execution?
 
i ran a warez bbs
well, not that much warez cause download speeds sucked ass and i had only one telco line
more like cracks, and game trainers
 
You forgot NNTP. The Usenet is still a thing even this deep into the 21st century.
There are still some free nntp servers. In a time that censorship is beginning to increase, I think a revival of USENET would be very good, because servers are distributed in many countries and news spread on them.

Some newsgroups became really unusable due to spam, others are still OK and alive with few people.
 
Didn't forget. Didn't mention SMTP either. Or gopher. I gave some examples, not a complete list.
SMTP is a good point, but Gopher is more or less contemporaneous with HTTP. Lost out badly.

I think the Usenet is the closest '80s analog to what is considered "the internet" nowadays. Sure, it was almost all academics and weirdos, but still, it was a world-wide forum of sorts. Not that I was on it. I was a PC puke so I spent my online time on BBSes looking for DOS drivers and warez.

"The internet" was really the World Wide Web for most of the last 35 years or so. I'm not sure what it is now that phones have broken the Web.
 
by the time i've got internet access the smtp wizz command was gone
still was very easy to hack because sunos4 boxes that were kind of popular back then had + + in /etc/hosts.equiv and many critical binaries were owned by bin
so you just rsh as bin form you linux/bsd box and change a fingerd which is owned by bin and runs as root
 
blind0ne I'm not sure whether this fits your requirements but I created this C++ library to quickly build HTTP(s) and WS(S) applications with minimal dependencies: https://github.com/tectu/malloy

My motivation for creating that library is somewhat overlapping with what you said: I don't like to rely on higher-level languages and frameworks such as PHP or python because I perceive those as hard-to-maintain.

I'm currently working on another library that is built on top of Malloy which will include some handy features like a template rendering engine.

It works well under FreeBSD.
 
You might want to still consider a very simple HTTP server.

BozoHttpd / inetd (https://man.netbsd.org/NetBSD-7.0/bozohttpd.8)
Mongoose Httpd (https://github.com/cesanta/mongoose)

Then implement the dynamic elements of your site as sh as a CGI script called from the web server (my own wiki uses m4 and awk as cgi).

The mentioned stunnel is useful for adding SSL without faffing with certificates for each service you run. Then use acme.sh to request a signed certificate from letsencrypt. (This has the benefit that the stunnel script can check for opening ports from the acme request to know if it should pass to the temporary acme server or the http server on the host seemlessly and without needing to restart any servers)

This is a very cool example of keeping things simple: https://learnbchs.org/easy.html
 
Back
Top