1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

revert generic service request; add ServerConfig to service factories

This commit is contained in:
Nikolay Kim
2019-03-09 07:37:23 -08:00
parent e324522389
commit ca73f178c9
21 changed files with 222 additions and 139 deletions

View File

@ -1,3 +1,5 @@
use std::{env, io};
use actix_http::HttpMessage;
use actix_http::{h1, Request, Response};
use actix_server::Server;
@ -6,9 +8,8 @@ use bytes::Bytes;
use futures::Future;
use http::header::HeaderValue;
use log::info;
use std::env;
fn main() {
fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "echo=info");
env_logger::init();
@ -27,7 +28,6 @@ fn main() {
})
})
.map(|_| ())
})
.unwrap()
.run();
})?
.run()
}

View File

@ -1,3 +1,5 @@
use std::{env, io};
use actix_http::http::HeaderValue;
use actix_http::HttpMessage;
use actix_http::{h1, Error, Request, Response};
@ -6,7 +8,6 @@ use actix_service::NewService;
use bytes::Bytes;
use futures::Future;
use log::info;
use std::env;
fn handle_request(mut req: Request) -> impl Future<Item = Response, Error = Error> {
req.body().limit(512).from_err().and_then(|bytes: Bytes| {
@ -17,7 +18,7 @@ fn handle_request(mut req: Request) -> impl Future<Item = Response, Error = Erro
})
}
fn main() {
fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "echo=info");
env_logger::init();
@ -29,7 +30,6 @@ fn main() {
.server_hostname("localhost")
.finish(|_req: Request| handle_request(_req))
.map(|_| ())
})
.unwrap()
.run();
})?
.run()
}

View File

@ -1,3 +1,5 @@
use std::{env, io};
use actix_codec::Framed;
use actix_http::{h1, Response, SendResponse, ServiceConfig};
use actix_server::Server;
@ -5,9 +7,8 @@ use actix_service::NewService;
use actix_utils::framed::IntoFramed;
use actix_utils::stream::TakeItem;
use futures::Future;
use std::env;
fn main() {
fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "framed_hello=info");
env_logger::init();
@ -20,7 +21,6 @@ fn main() {
.map_err(|_| ())
.map(|_| ())
})
})
.unwrap()
.run();
})?
.run()
}

View File

@ -1,12 +1,13 @@
use std::{env, io};
use actix_http::{h1, Response};
use actix_server::Server;
use actix_service::NewService;
use futures::future;
use http::header::HeaderValue;
use log::info;
use std::env;
fn main() {
fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "hello_world=info");
env_logger::init();
@ -23,7 +24,6 @@ fn main() {
future::ok::<_, ()>(res.body("Hello world!"))
})
.map(|_| ())
})
.unwrap()
.run();
})?
.run()
}