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

WiFiClientSecure::write only sends the first 16KB #3193

Closed
marcelstoer opened this issue Sep 9, 2019 · 23 comments
Closed

WiFiClientSecure::write only sends the first 16KB #3193

marcelstoer opened this issue Sep 9, 2019 · 23 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@marcelstoer
Copy link
Contributor

marcelstoer commented Sep 9, 2019

Description:

Shouldn't WiFiClientSecure::write send the whole buffer even beyond SSL fragment length? Currently it only writes up to mbedTLS maximum fragment length which is 16KB by default.

According to ARM mbed TLS mbedtls_ssl_write has the following limitation

If the requested length is greater than the maximum fragment length (either the built-in limit or the one set or negotiated with the peer), then:

  • with TLS, less bytes than requested are written.

It appears that mbedtls_ssl_write is only called once at https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/src/ssl_client.cpp#L280

Sketch

While the (simplified) workaround below works ok it does feel like such a use case should be handled by WiFiClientSecure internally. Opinions?

size_t sent = 0; 
size_t remaining = fileSize; 
size_t offset = 0;

while (true) {
  sent = client->write(buffer + offset, remaining);
  remaining = remaining - sent;
  offset += sent;
  if (remaining <= 0 || sent <= 0) {
    break;
  }
}
@stale
Copy link

stale bot commented Nov 8, 2019

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Nov 8, 2019
@marcelstoer
Copy link
Contributor Author

@me-no-dev according to the commit history you might be familiar with the subject?

@stale
Copy link

stale bot commented Nov 8, 2019

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Nov 8, 2019
@stale
Copy link

stale bot commented Jan 7, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jan 7, 2020
@marcelstoer
Copy link
Contributor Author

@me-no-dev what can I do to get some feedback from a developer to find out if my expectations are justified or not?

@stale
Copy link

stale bot commented Jan 8, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Jan 8, 2020
@me-no-dev
Copy link
Member

This should definitelly not be the case and I will put it on my list of things to check. Doing such while loops in FreeRTOS might not be a good idea, but I need to have a better look at what goes underneath to know if this can do or not.

@stale
Copy link

stale bot commented Mar 20, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Mar 20, 2020
@marcelstoer
Copy link
Contributor Author

"Hey bot, shut up. The grown-ups are talking." Not frequently but they do 😜

@stale
Copy link

stale bot commented Mar 20, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Mar 20, 2020
@stale
Copy link

stale bot commented May 19, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label May 19, 2020
@marcelstoer
Copy link
Contributor Author

nudge

@stale
Copy link

stale bot commented May 19, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label May 19, 2020
@atanisoft
Copy link
Collaborator

@marcelstoer perhaps submit a PR with your proposal?

@marcelstoer
Copy link
Contributor Author

Re: PR; Normally not an issue but I'm not familiar with the inner workings of the affected class(es) to make a meaningful proposal.

Besides @me-no-dev stated that

Doing such while loops in FreeRTOS might not be a good idea

This confirms my initial suspicion that there must be a better solution.

@stale
Copy link

stale bot commented Jul 18, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jul 18, 2020
@marcelstoer
Copy link
Contributor Author

This should definitelly not be the case and I will put it on my list of things to check.

@me-no-dev is it still there?

@stale
Copy link

stale bot commented Jul 18, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Jul 18, 2020
@stale
Copy link

stale bot commented Sep 17, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Sep 17, 2020
@stale
Copy link

stale bot commented Sep 17, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Sep 17, 2020
@stale
Copy link

stale bot commented Nov 16, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Nov 16, 2020
@stale
Copy link

stale bot commented Nov 30, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@everslick
Copy link
Contributor

hehe, I feel your pain. I had the pretty same experience in #2494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

4 participants