Skip to content

Make BearSSL::write() blocking #4804

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

Merged
merged 1 commit into from
Jun 12, 2018

Conversation

earlephilhower
Copy link
Collaborator

When a message is sent by the app that is larger than the SSL buffer,
it will take multiple TLS fragments to transfer. Writes will now
loop through and not complete until either all data is transferred
or there is an error.

The prior behavior caused an error in HTTPClient (and others) as it would only write the first chunk (i.e. 512b by default) and return "512" no matter how large the app write request was. Unless the app was expecting this and trying it in a loop, this would either cause a protocol error if the app did not check write's return value, or an app error if it detected the short write.

When a message is sent by the app that is larger than the SSL buffer,
it will take multiple TLS fragments to transfer.  Writes will loop
through and not return until either all data is transferred or there
is an error.
@earlephilhower
Copy link
Collaborator Author

Just tested this patch sending a 4096 byte char[] to an openssl s_server and it went through fine using the default 512b send fragment size.

@earlephilhower earlephilhower merged commit c0cfe87 into esp8266:master Jun 12, 2018
@earlephilhower earlephilhower deleted the partialwrite branch June 12, 2018 20:18
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.

1 participant