File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ use std::net::SocketAddr;
8
8
use std:: path:: Path ;
9
9
use std:: str;
10
10
use std:: str:: FromStr ;
11
+ use tokio:: io:: AsyncWriteExt ;
11
12
use tokio:: net:: { TcpListener , TcpStream } ;
12
13
use url:: Url ;
13
14
14
15
async fn process_stream (
15
- stream : TcpStream ,
16
+ mut stream : TcpStream ,
16
17
services_dir : String ,
17
18
mem_limit : u16 ,
18
19
service_timeout : u16 ,
@@ -49,6 +50,15 @@ async fn process_stream(
49
50
let host = str:: from_utf8 ( host) . unwrap_or ( "example.com" ) ; // TODO: configure the default host
50
51
let req_path = req. path . unwrap_or_default ( ) ;
51
52
53
+ // if the request is for the health endpoint return a 200 OK response
54
+ if req_path == "/_internal/health" {
55
+ stream
56
+ . write_all ( b"HTTP/1.1 200 OK\r \n content-length: 0\r \n \r \n " )
57
+ . await ?;
58
+ stream. flush ( ) . await ?;
59
+ return Ok ( ( ) ) ;
60
+ }
61
+
52
62
let url = Url :: parse ( & format ! ( "http://{}{}" , & host, & req_path) . as_str ( ) ) ?;
53
63
let path_segments = url. path_segments ( ) ;
54
64
if path_segments. is_none ( ) {
You can’t perform that action at this time.
0 commit comments