←back to thread

53 points heavensteeth | 7 comments | | HN request time: 0s | source | bottom
Show context
zoobab ◴[] No.43653287[source]
Python has cgi-bin support, I made a proxy of the poor like this:

$ mkdir cgi-bin $ echo -e "#!/bin/bash\necho -e \"Content-type: text/html\n"curl -s -k http://www.zoobab.com -o -" > cgi-bin/proxy.sh $ python -m http.server --cgi 8000 $ curl http://localhost:8000/cgi-bin/proxy.sh

You should get the html page of http://www.zoobab.com

replies(2): >>43653841 #>>43654809 #
1. smittywerben ◴[] No.43653841[source]
Python removed cgi-bin calling it a dead battery module.

> cgi — Common Gateway Interface support Deprecated since version 3.11, removed in version 3.13.

https://docs.python.org/3/library/cgi.html

replies(2): >>43654137 #>>43655992 #
2. at_a_remove ◴[] No.43654137[source]
A shame, I used to use cgi all the time, back when I did web stuff. I wouldn't know what to do now, especially on IIS. Never did understand why I ought to want or need WSGI, other than I "ought to." Nor did I see how I was supposed to code against it, so I simply did cgi. It never raised a problem for me.
replies(1): >>43657530 #
3. ryao ◴[] No.43655992[source]
That is irrelevant as he is talking about the Python http server that runs CGI executables, not using Python as a CGI executable. As for the latter, it is still an option:

https://pypi.org/project/legacy-cgi/

replies(1): >>43672010 #
4. mxuribe ◴[] No.43657530[source]
When i started dabbling in python back in the day, and when i had a need for cgi-bin sort of functionality (for simple web front-end), i think it was the sunsetting of popularity of python cgi, and more of the rise of WSGI...so there was less blog posts out there showing best practices around cgi, and more on wsgi...and to me it often felt like i was doing more unnecessary work via wsgi...but then, maybe i'm old and stodgy, and came from the php world prior to dabbling python? Then again, even though i feel i am more mentally sharper now than my younger self...it sure feels like back in the day i was able to be more productive sooner...and nowadays there's just so much setup and harnesses to begin with.
replies(1): >>43664531 #
5. at_a_remove ◴[] No.43664531{3}[source]
I think started a little earlier, back when every site had a cgi-bin directory.

And, yeah, so much ... cruft now, and I rarely hear reasons for the tradeoff, other than "should" and "It will be great."

And if it is so great, why did it go away?

replies(1): >>43665406 #
6. mxuribe ◴[] No.43665406{4}[source]
Thanks for making me feel good knowing that i'm not the only one feeling that there's too much cruft in some areas nowadays! :-)

Simiarly, i either hear no discussion about tradeoffs, or they tend to be so vauge or weak...and it eventually boils down to "Ain't no body got time to figure out the 'right way', and this new $thing is popular, so this new way is the right way everyone...".

As far as why it went away, i frankly don;'t know...but i imagine for the same reasons other good stuff goes away: maybe contributors stopped working on it, or there is money to be made in the new ways, or the zeitgeist of the new way (due to management consultants whispering in the ear of IT senior leaders) takes over the attention of the everyday devs, etc. Then again, i suppose if one were to preserve certain local infra. in a way to use old stuff, i guess one may still be able to run things the old way...but that's an uphill battle, and likely not worth it.

7. smittywerben ◴[] No.43672010[source]
Just pip uninstall pep 206 interface then connect execute this remote code repo that the community uses into your supply chain and pip install pep 206 that's the secure way to run the http test server in production. Like just break the source code that works by removing it because "just parse the syntax tree to override it that's the correct way" just pip install the cgi interface specification from the back alley it's better than paying Oracle to keep your code working because you can just override the interface the right way then lets pull out lincoln logs out because nobody can figure out how the fuck to install the real webserver or parse the AST of the test server to use their per-process GIL locked python interpreter and then when they've almost fixed that lets pull out the http test server too then we're ready to write some more code!

Signed, almost dead battery