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

Allow control over authorization String allocation #8225

Merged
merged 4 commits into from
Sep 4, 2021
Merged

Allow control over authorization String allocation #8225

merged 4 commits into from
Sep 4, 2021

Conversation

paulocsanz
Copy link
Contributor

@paulocsanz paulocsanz commented Jul 18, 2021

Fixes #8224

It seems one allocation is inevitable here, but allowing the user to control it solves the non-null terminated string-view problem. That currently needs two allocations to fix.

This replace(String('\n'), ...) doesn't seem ideal, should I implement String::replace(char, String&), or String::remove(char) to avoid allocating here needlessly? Of course this virtually has no impact since it's immediately freed, it won't cause heap fragmentation, so it seems overkill. But this kind of API bothers me a lot, where allocation is not needed but happens. It makes everything less deterministic.

@paulocsanz
Copy link
Contributor Author

Nevermind forgot about SSO for a second. Ignore the String::replace part.

Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@earlephilhower earlephilhower added this to the 3.1 milestone Jul 19, 2021
@earlephilhower earlephilhower merged commit 058ce7c into esp8266:master Sep 4, 2021
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.

HTTPClient::setAuthorization needs two allocations to support non-null terminated string views
2 participants