Skip to content

Commit

Permalink
Modify response headers
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskar Jaiswal <[email protected]>
  • Loading branch information
aryan9600 committed Jun 11, 2021
1 parent aabd5a5 commit 9ce57f5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions linkerd/app/core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,13 @@ impl<RspB: Default + hyper::body::HttpBody> respond::Respond<http::Response<RspB
close.close();
}

const SERVER_HEADER: &str = concat!("linkerd-proxy/", env!("GIT_VERSION"));
if self.is_grpc {
let mut rsp = http::Response::builder()
.version(http::Version::HTTP_2)
.header(http::header::CONTENT_LENGTH, "0")
.header(http::header::CONTENT_TYPE, GRPC_CONTENT_TYPE)
.header(http::header::SERVER, SERVER_HEADER)
.body(ResponseBody::default())
.expect("app::errors response is valid");
let code = set_grpc_status(&*error, rsp.headers_mut());
Expand All @@ -223,6 +225,7 @@ impl<RspB: Default + hyper::body::HttpBody> respond::Respond<http::Response<RspB
.version(self.version)
.status(status)
.header(http::header::CONTENT_LENGTH, "0")
.header(http::header::SERVER, SERVER_HEADER)
.body(ResponseBody::default())
.expect("error response must be valid"))
}
Expand Down

0 comments on commit 9ce57f5

Please sign in to comment.