Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a ValueAbsent for all the downstream-tls related functions instead of a NotAvailable #315

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions lib/src/wiggle_abi/req_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ impl FastlyHttpReq for Session {
Err(Error::NotAvailable("Client original header fingerprint"))
}

#[allow(unused_variables)] // FIXME KTM 2020-06-25: Remove this directive once implemented.
fn downstream_tls_cipher_openssl_name(
fn downstream_tls_cipher_openssl_name<'a>(
&mut self,
cipher_out: &GuestPtr<'_, u8>,
cipher_max_len: u32,
nwritten_out: &GuestPtr<u32>,
_cipher_out: &GuestPtr<'a, u8>,
_cipher_max_len: u32,
_nwritten_out: &GuestPtr<u32>,
) -> Result<(), Error> {
Err(Error::NotAvailable("Client TLS data"))
// FIXME JDC 2023-09-27: For now, we don't support incoming TLS connections, this function currently only implements the solution for non-tls connections.
Err(Error::ValueAbsent)
}

#[allow(unused_variables)] // FIXME ACF 2022-05-03: Remove this directive once implemented.
Expand Down Expand Up @@ -184,14 +184,14 @@ impl FastlyHttpReq for Session {
Err(Error::NotAvailable("Redirect to Fanout/GRIP proxy"))
}

#[allow(unused_variables)] // FIXME KTM 2020-06-25: Remove this directive once implemented.
fn downstream_tls_protocol(
fn downstream_tls_protocol<'a>(
&mut self,
protocol_out: &GuestPtr<'_, u8>,
protocol_max_len: u32,
nwritten_out: &GuestPtr<u32>,
_protocol_out: &GuestPtr<'a, u8>,
_protocol_max_len: u32,
_nwritten_out: &GuestPtr<u32>,
) -> Result<(), Error> {
Err(Error::NotAvailable("Client TLS data"))
// FIXME JDC 2023-09-27: For now, we don't support incoming TLS connections, this function currently only implements the solution for non-tls connections.
Err(Error::ValueAbsent)
}

#[allow(unused_variables)] // FIXME KTM 2020-06-25: Remove this directive once implemented.
Expand All @@ -201,29 +201,30 @@ impl FastlyHttpReq for Session {
chello_max_len: u32,
nwritten_out: &GuestPtr<u32>,
) -> Result<(), Error> {
Err(Error::NotAvailable("Client TLS data"))
// FIXME JDC 2023-09-27: For now, we don't support incoming TLS connections, this function currently only implements the solution for non-tls connections.
Err(Error::ValueAbsent)
}

#[allow(unused_variables)] // FIXME HL 2022-09-19: Remove this directive once implemented.
fn downstream_tls_raw_client_certificate(
fn downstream_tls_raw_client_certificate<'a>(
&mut self,
_raw_client_cert_out: &GuestPtr<'_, u8>,
_tokio_rustlsraw_client_cert_out: &GuestPtr<'a, u8>,
_raw_client_cert_max_len: u32,
_nwritten_out: &GuestPtr<u32>,
) -> Result<(), Error> {
Err(Error::NotAvailable("Client TLS data"))
// FIXME JDC 2023-09-27: For now, we don't support incoming TLS connections, this function currently only implements the solution for non-tls connections.
Err(Error::ValueAbsent)
}

#[allow(unused_variables)] // FIXME HL 2022-09-19: Remove this directive once implemented.
fn downstream_tls_client_cert_verify_result(
&mut self,
) -> Result<ClientCertVerifyResult, Error> {
Err(Error::NotAvailable("Client TLS data"))
// FIXME JDC 2023-09-27: For now, we don't support incoming TLS connections, this function currently only implements the solution for non-tls connections.
Err(Error::ValueAbsent)
}

#[allow(unused_variables)] // FIXME ACF 2022-05-03: Remove this directive once implemented.
fn downstream_tls_ja3_md5(&mut self, ja3_md5_out: &GuestPtr<u8>) -> Result<u32, Error> {
Err(Error::NotAvailable("Client TLS JA3 hash"))
fn downstream_tls_ja3_md5(&mut self, _ja3_md5_out: &GuestPtr<u8>) -> Result<u32, Error> {
// FIXME JDC 2023-09-27: For now, we don't support incoming TLS connections, this function currently only implements the solution for non-tls connections.
Err(Error::ValueAbsent)
}

#[allow(unused_variables)] // FIXME UFSM 2024-02-19: Remove this directive once implemented.
Expand Down
9 changes: 9 additions & 0 deletions test-fixtures/src/bin/downstream-req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ fn main() {

let localhost: IpAddr = "127.0.0.1".parse().unwrap();
assert_eq!(client_req.get_client_ip_addr().unwrap(), localhost);

assert_eq!(client_req.get_tls_cipher_openssl_name(), None);
assert_eq!(client_req.get_tls_cipher_openssl_name_bytes(), None);
assert_eq!(client_req.get_tls_client_hello(), None);
assert_eq!(client_req.get_tls_protocol(), None);
assert_eq!(client_req.get_tls_protocol_bytes(), None);
// NOTE: This currently fails, waiting on a patch to land in the fastly crate
// assert_eq!(client_req.get_tls_raw_client_certificate(), None);
assert_eq!(client_req.get_tls_raw_client_certificate_bytes(), None);
}
Loading