Add CGI feature to enable server-side scripting#682
Closed
oliver-moran wants to merge 11 commits intohttp-party:masterfrom
Closed
Add CGI feature to enable server-side scripting#682oliver-moran wants to merge 11 commits intohttp-party:masterfrom
oliver-moran wants to merge 11 commits intohttp-party:masterfrom
Conversation
2 tasks
Member
|
While I think this is a really neat feature, I'm not so sure this is within the scope of http-server, which is a static content server. Would this be better suited as a companion package which depends on http-server? |
Member
|
I'm going to close this due to inactivity and possibly being out of scope for now, we can always re-open later if this is highly desired functionality |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure that your pull request fulfills these requirements:
masterbranchWhat is the purpose of this pull request? (bug fix, enhancement, new feature,...)
Adds a CGI feature. This enables execution of server-side scripts in a
/cgi-bin/directory using the Common Gateway Interface. Use case is for when small server-side scripting is needed to support static files (e.g. saving form data to a flat-file database, serving a file listing from a directory).What changes did you make?
Added an interface to the
cgimodule, with error prevention and usability assumptions (e.g..jsfiles don't need to be set to executable on Unix).Provide some example code that this change will affect, if applicable:
Place this file in
/public/cgi-bin/and name itscript.js:Run
http-serverwith the--cgioption:Open
http://127.0.0.1:8080/cgi-bin/script.jsand the script is executed:Is there anything you'd like reviewers to focus on?
Error handling, especially common mistakes that novice users of CGI would make. One known issue is in the handling of malformed headers by the
cgimodule. Error handling is not implemented in the latest released version of this module. I've added a pull request to fix this but the module does not appear to be maintained.Execution of scripts on different operating systems. For JavaScript files (
.js), there should be no difference between OSes. These don't need to be set to executable in Unix systems. On Unix, there is better choice of executing scripts in different languages (e.g. Python, bash). However, these need to be set to executable. On Windows,.bat,.cmdand.exeare supported in addition to JavaScript (.js).Please provide testing instructions, if applicable:
It's a scripting language, so go wild!