scgi 0.0.3

Simple SCGI parser
docs.rs failed to build scgi-0.0.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: scgi-0.3.4

##rust-scgi Build Status

A simple SCGI connector for Rust. Documentation

[dependencies.scgi]
git = "https://github.com/ArtemGr/rust-scgi"

Example:

pub fn main() {
  let mut acceptor = TcpListener::bind (("127.0.0.1", 8083)) .listen().unwrap();
  for stream in acceptor.incoming() {
    match stream {
      Err (err) => panic! ("Accept error: {}", err),
      Ok (tcp_stream) => spawn (proc() {
        let (raw_headers, mut stream) = scgi::read_headers (tcp_stream) .unwrap();
        let headers_map = scgi::str_map (&raw_headers) .unwrap();
        let uri = headers_map["REQUEST_URI"];

        println! ("SCGI request, uri: {}, headers: {}", uri, headers_map);
        stream.write (b"Status: 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 4\r\nConnection: close\r\n\r\nHi\r\n") .unwrap();
      })
    }
  }
}

A full example with Result error handling.