Hacker News new | past | comments | ask | show | jobs | submit login

Here is an HTTPS server in one line of posix shell and openssl¹ which also works as an alternative to `python -m SimpleHTTPServer`:

openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-384 -sha512 -subj /CN=localhost -keyout - -out - -nodes -addext subjectAltName=IP:::,IP:::1,IP:0.0.0.0,IP:127.0.0.1|openssl s_server -accept 8443 -WWW -no_ssl3 -no_tls1 -no_tls1_1 -cert -

I put this into https.sh marked executable and run anywhere.

¹ https://www.openssl.org/docs/man1.1.1/man1/openssl-s_server....




Sigh. Yes, ANYTHING can be one line... if you're allowed to call tens of thousands of lines of code compiled in a different library.

It really defeats the purpose of showing off minimal coding skill if hundreds of other developers did all the heavy lifting over three decades.


# one line of Bash

apachectl -f ./httpd.conf


Sounds like you are describing Python, Go and whatever is the next programming language du jour. Folks "showing off minimal coding skill" proclaim "X in Y lines of code" for these "batteries included" languages all the time. Yet I never see any snarky comments pointing out the size, age or authors of the libraries they are using. All the parent comment did was demonstrate using the openssl binary, which is ubiquitous.

The GP referred to using nc. Assuming the original from 1995, that is not 10s of 1000s of LOC and was not written over three decades. It is the work of one person.

Yes, it is true. Everytime we use the OpenSSL library we are using 10s of 1000s of LOC written by a changing team of developers over several decades, a project with a long legacy of ad hoc development and mistakes. I doubt the parent is trying to take credit for any of that "heavy lifting".


I stuck that in /usr/bin/s, and now I present to you an HTTPS server in one character:

    s


Well in that case I one-up you with HTTPS server command without requiring write privileges by adding the command as an alias in your posix shell. Could even put the port argument last to scale usability.

alias s=...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: