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

Fix issue where read_to_end() into provided rx_buf does not work with… #115

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rmja
Copy link
Member

@rmja rmja commented Feb 24, 2025

… tls

This is a fix for #114. The issue is that embedded-tls may provide a different buffer when calling buf_read() than we expect, so this PR allows us to force to not use its buffer.

// Also, if requests on embedded platforms fail with Error::Dns, then try to
// enable the "alloc" feature on embedded-tls to enable RSA ciphers.
let mut request = client
.request(Method::GET, "https://api.dictionaryapi.dev/api/v2/entries/en/orange")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to test this without actually hitting this external API? We probably don't want the test to start failing if this website ever goes dark.

@rmja
Copy link
Member Author

rmja commented Feb 25, 2025

@lulf do you have any good idea on how we could setup a test harness that can recreate this issue?
The not-working behavior can be re-introduced by setting force_local_buffer: false. embedded-tls must be included in the test for the issue to show.

@rmja
Copy link
Member Author

rmja commented Feb 25, 2025

I wonder if there is something similar to Verify for rust, where we could load desired responses raw from disk, and then compare them to a desired and expected response.

@lulf
Copy link
Member

lulf commented Feb 25, 2025

Hmm, I'm not familiar with any appropriate mocking framework, but maybe one could use something like https://github.com/drogue-iot/embedded-tls/blob/main/tests/tlsserver.rs to reproduce it. It requires a bit more work to setup though.

@PhoebeSzmucer
Copy link

Are there more potential uses for something like https://github.com/drogue-iot/embedded-tls/blob/main/tests/tlsserver.rs in this repo, or is this going into the territory of testing embedded-tls itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants