wala-rust

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README | LICENSE

commit 98c5b8ddfe02d4c669b3afa7f96ed78814cafba0
parent 62842f2f68e5c3eb236ede9f0bd8e406115fdae3
Author: lash <dev@holbrook.no>
Date:   Thu,  6 Oct 2022 16:41:23 +0000

Add wala name and version in server header response

Diffstat:
Msrc/response.rs | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/response.rs b/src/response.rs @@ -77,6 +77,12 @@ pub fn exec_response(req: Request, r: RequestResult) { let auth_origin_headers = origin_headers(); + let server_header_v = format!("wala/{}, tiny_http (Rust)", env!("CARGO_PKG_VERSION")); + let server_header = Header{ + field: HeaderField::from_str("Server").unwrap(), + value: AsciiString::from_ascii(server_header_v).unwrap(), + }; + match r.v { Some(v) => { let mut res = Response::from_string(v); @@ -84,6 +90,7 @@ pub fn exec_response(req: Request, r: RequestResult) { for v in auth_origin_headers.iter() { res.add_header(v.clone()); } + res.add_header(server_header); req.respond(res); return; }, @@ -137,6 +144,7 @@ pub fn exec_response(req: Request, r: RequestResult) { for v in auth_origin_headers.iter() { res.add_header(v.clone()); } + res.add_header(server_header); req.respond(res); return; }, @@ -145,6 +153,7 @@ pub fn exec_response(req: Request, r: RequestResult) { for v in auth_origin_headers.iter() { res.add_header(v.clone()); } + res.add_header(server_header); req.respond(res); return; },