Get a binding of CGI #2433
Replies: 2 comments
-
Wouldn't it make more sense to have an http server package in core? (which is already planned) CGI has largely fallen out of favor outside of personal websites on university systems. And aside from correctly parsing query strings and form data (which would be part of the http package anyway), it's not that hard to implement yourself by pulling from environment variables and stdin if you really wanted to write a cgi script in Odin. I feel like you might as well stand up an apache server and run perl scripts if you really want to do CGI. These days, there are just so many easier options for a webserver that I just don't see the appeal to using CGI, especially if you have to deal with all the string conversion manually into a strong, distinct, static type system. You can probably generate some foreign bindings for Odin to whatever c library exists for cgi. I think what we really need is better tools for doing this. There is one that is old and archived linked in the wiki which might serve as a base. Even still, in a lot of cases, you have to write a fair bit of custom code to make the binding behave nicely and may also need to generate decent wrappers. I imagine this will be a lot easier with a fully-functioning c parser in core:c rather than just the lexer. Zig may actually be the best tool for the job until then. |
Beta Was this translation helpful? Give feedback.
-
CGI is still used in some scenarios, but it's not common. Example A way to achieve CGI without much hazzle is following these steps:
You can see an implementation of this workflow for CGI In my experimental web framework for Wren: Here is the same concept applied to executing Clojure in PHP hosts Keep in mind some shared hosts have old liberary versions, so odin must be compiled to be compatible with such environments.
|
Beta Was this translation helpful? Give feedback.
-
I would like the idea of Common Gateway Interface (CGI) as a possible
vendor
package.If it already exists, please tell me.
Beta Was this translation helpful? Give feedback.
All reactions