Skip to content

Instantly share code, notes, and snippets.

@smvv
Created August 15, 2013 13:10
Show Gist options
  • Save smvv/6240717 to your computer and use it in GitHub Desktop.
Save smvv/6240717 to your computer and use it in GitHub Desktop.
fn spawn(&self, request: mongrel2::Request) {
let (_, callback) = self.routes[0]; // TODO: url routing
let (port, chan) : (Port<~str>, Chan<~str>) = stream();
let env_request = request.clone();
do spawn {
callback(~Env {
out_ch: &chan,
request: &env_request,
});
}
let rep_body = port.recv();
let headers = mongrel2::Headers();
self.conn.reply_http(&request, 200u, "OK", headers, rep_body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment