Easily create CGI (RFC 3875) programmes in Rust based on hyper's http types.
Installation & Usage
Cargo.toml:
[dependencies]
cgi = "0.3"
Use the cgi_main! macro, with a function that takes a cgi::Request and returns a
cgi::Response.
extern crate cgi;
cgi_main!
If your function returns a Result, you can use cgi_try_main!:
extern crate cgi;
cgi_try_main!
It will parse & extract the CGI environmental variables, and the HTTP request body to create
Request<u8>, call your function to create a response, and convert your Response into the
correct format and print to stdout. If this programme is not called as CGI (e.g. missing
required environmental variables), it will panic.
It is also possible to call the cgi::handle function directly inside your main function:
extern crate cgi;
Several shortcut functions are provided (such as html_response/binary_response)