use tokio_io::io::write_all
extern crate futures;
extern crate hyper;
+/* extern crate tokio; */
extern crate tokio_core;
extern crate tokio_io;
extern crate tokio_process;
@@ -12,6 +13,7 @@ use self::hyper::header::ContentType;
use self::hyper::server::{Request, Response};
use cgi::tokio_io::AsyncWrite;
use cgi::tokio_process::CommandExt;
+/* use tokio::prelude::*; */
use std::io;
use std::io::BufRead;
use std::io::Read;
@@ -64,20 +66,22 @@ pub fn do_cgi(
let mut child = cmd
.spawn_async_with_handle(&handle.new_tokio_handle())
.expect("can't spawn CGI command");
-
/* Box::new(req.body().concat2().and_then(move |body| { */
/* if !child.stdin().take().unwrap().write_all(&body).is_ok() { */
/* debug!("write_all(body) failed"); */
/* } */
let r = req.body().concat2().and_then(move |body| {
- if !child.stdin().take().unwrap().poll_write(&body).is_ok() {
- debug!("write_all(body) failed");
- }
-
+ /* if !child.stdin().take().unwrap().poll_write(&body).is_ok() { */
+ /* debug!("write_all(body) failed"); */
+ /* } */
+ tokio_io::io::write_all(child.stdin().take().unwrap(), body)
+ .and_then(move |wa| {
child
.wait_with_output()
.map(build_response)
.map_err(|e| e.into())
+ })
+ .map_err(|e| e.into())
});
Box::new(r)
