Replace Hyper with Warp for HTTP server

- Use Warp
- Optimize clones
- HTTPS server
- Content-Length limit
- HTTP Basic Auth
- Stop server with Ctrl-C
This commit is contained in:
Adrián Arroyo Calle
2023-09-05 20:40:58 +02:00
parent 841aaa78b4
commit 660860bccf
9 changed files with 682 additions and 339 deletions

View File

@@ -5499,6 +5499,17 @@ impl Machine {
if interruption {
self.machine_st.throw_interrupt_exception();
self.machine_st.backtrack();
#[cfg(not(target_arch = "wasm32"))]
let runtime = tokio::runtime::Runtime::new().unwrap();
#[cfg(target_arch = "wasm32")]
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();
let old_runtime = std::mem::replace(&mut self.runtime, runtime);
old_runtime.shutdown_background();
}
}
Err(_) => unreachable!(),