Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing CGI files #76

Open
Neyo-odu opened this issue Dec 2, 2019 · 3 comments
Open

Executing CGI files #76

Neyo-odu opened this issue Dec 2, 2019 · 3 comments
Labels
Question Need some information Resolved The issue is resolved or got answered

Comments

@Neyo-odu
Copy link
Contributor

Neyo-odu commented Dec 2, 2019

I realize this is a bad time to discover this issue however, I've noticed that I've been coding my server incorrectly when it comes to executing CGI scripts. I may have missed the lecture where this was discussed but I was assuming they were handled as plain text and executed through some sort of function after the information was parsed similar to the "WeMustProtectThisHouse!" files. However, I realize I was dreadfully wrong.

Could you possibly link me to a resource on how this is done using python? I've reviewed the lecture slides, RFC 3875, and various resources on the web. Nothing does well at explaining how to remotely execute a CGI file via Python given a path. The resource linked in the powerpoint lecture "http://hoohoo.ncsa.uiuc.edu/cgi/" is currently down. There are many resources on what CGI is and what it does but my issue is in this context how would I go about executing the script from my web server file.

Thank you for any help.

@ibnesayeed ibnesayeed added the Question Need some information label Dec 2, 2019
@ibnesayeed
Copy link
Collaborator

Python has a standard module to run processes called subprocess. Read the documentation to explore how to connect to the STDIN, STDOUT, and STDERR and how to pass environment variables to the process.

@Neyo-odu
Copy link
Contributor Author

Neyo-odu commented Dec 3, 2019

Is this something that will work stand-alone in this context? There seems to be something I need to do with perl. I'm guessing it needs to be installed via docker?

@ibnesayeed
Copy link
Collaborator

CGI scripts can be written in any language as long as they can be executed as scripts, take input from environment variables and STDIN and yield output on STDOUT in a specific format. The scripts supplied in the test suit are written in Perl, which means your Docker image should have basic Perl runtime environment installed in it. Luckily, Perl is one of the ubiquitous runtimes in Linux distros, so most likely it will already be present in your base image, but if you are using a minimal base image then you will have to write necessary instructions in your Dockerfile to install Perl.

@ibnesayeed ibnesayeed added the Resolved The issue is resolved or got answered label Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Need some information Resolved The issue is resolved or got answered
Projects
None yet
Development

No branches or pull requests

2 participants