|
10 | 10 |
|
11 | 11 | use crate::{errors::HttpServerError, request::new_request_object, response::new_response_object}; |
12 | 12 | use axum::{ |
13 | | - body::Body, |
| 13 | + body::{self, Body}, |
14 | 14 | http::{Request, Response, StatusCode}, |
15 | 15 | routing::any, |
16 | | - Router, Server, |
| 16 | + Router, |
17 | 17 | }; |
18 | | -use hyper::body; |
19 | 18 | use phper::{ |
20 | 19 | alloc::ToRefOwned, |
21 | 20 | classes::{ClassEntity, Visibility}, |
22 | 21 | functions::Argument, |
23 | 22 | values::ZVal, |
24 | 23 | }; |
25 | | -use std::{cell::RefCell, collections::HashMap, net::SocketAddr}; |
26 | | -use tokio::runtime::{self}; |
| 24 | +use std::{cell::RefCell, collections::HashMap, error::Error, net::SocketAddr}; |
| 25 | +use tokio::{net::TcpListener, runtime}; |
27 | 26 |
|
28 | 27 | const HTTP_SERVER_CLASS_NAME: &str = "HttpServer\\HttpServer"; |
29 | 28 |
|
@@ -95,7 +94,9 @@ pub fn make_server_class() -> ClassEntity<()> { |
95 | 94 | let (parts, body) = req.into_parts(); |
96 | 95 |
|
97 | 96 | // Read all request body content. |
98 | | - let body = body::to_bytes(body).await.map_err(HttpServerError::new)?; |
| 97 | + let body = body::to_bytes(body, usize::MAX) |
| 98 | + .await |
| 99 | + .map_err(HttpServerError::new)?; |
99 | 100 |
|
100 | 101 | // Create PHP `HttpServer\HttpRequest` object. |
101 | 102 | let mut request = new_request_object()?; |
@@ -148,9 +149,9 @@ pub fn make_server_class() -> ClassEntity<()> { |
148 | 149 | ); |
149 | 150 |
|
150 | 151 | // Start the http server. |
151 | | - let server = Server::bind(&addr).serve(app.into_make_service()); |
152 | | - |
153 | | - server.await |
| 152 | + let listener = TcpListener::bind(addr).await?; |
| 153 | + axum::serve(listener, app).await?; |
| 154 | + Ok::<_, Box<dyn Error>>(()) |
154 | 155 | }; |
155 | 156 |
|
156 | 157 | // Build the tokio runtime, with the current thread scheduler, block on |
|
0 commit comments