Skip to content

allow F() to be used for uri parameter #2319

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
Jul 26, 2016
Merged

allow F() to be used for uri parameter #2319

merged 1 commit into from
Jul 26, 2016

Conversation

everslick
Copy link
Contributor

@everslick everslick commented Jul 23, 2016

currently we can only pass const char * ("foo") as uri parameter to the on() method of the webserver. in more complex sketches with many uri handlers those strings use significant amount of RAM (in my case 250+ bytes). changing the uri parameter from const char * to const String &, allows strings to be moved to flash by wrapping them in the F() macro. example:

webserver->on(F("/files"), HTTP_GET, handle_file_page_cb);

@codecov-io
Copy link

codecov-io commented Jul 23, 2016

Current coverage is 27.62% (diff: 100%)

Merging #2319 into master will not change coverage

@@             master      #2319   diff @@
==========================================
  Files            20         20          
  Lines          3656       3656          
  Methods         335        335          
  Messages          0          0          
  Branches        678        678          
==========================================
  Hits           1010       1010          
  Misses         2468       2468          
  Partials        178        178          

Powered by Codecov. Last update 7900132...f7febd9

@igrr igrr merged commit 4dc4e75 into esp8266:master Jul 26, 2016
@andig
Copy link
Contributor

andig commented Jul 27, 2016

Wouldn't it make sense to update serveStatic as well?

@everslick
Copy link
Contributor Author

from my point of few, yes it would. but i wanted the PR to be as small as
possible to increase the chance of being merged soon.

in the long run the whole libraries would need a big overhaul to unify the
API, but i guess this will never happen as it would break backwards
compatibility.

but at least one could review all APIs and replace 'const char *' by 'const
String &' everywhere. i think is is safe regarding code, that is out there,
still compiling.

On Wed, Jul 27, 2016 at 10:17 AM, andig [email protected] wrote:

Wouldn't it make sense to update serveStatic as well?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2319 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB0jL9jtTWQWyPwYbrLCToDMf3Ojkjqhks5qZxQkgaJpZM4JTcLE
.

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.

4 participants