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

Use of Uri in webserver breaks current implementations #7102

Closed
4 of 6 tasks
TD-er opened this issue Feb 22, 2020 · 5 comments · Fixed by #7105
Closed
4 of 6 tasks

Use of Uri in webserver breaks current implementations #7102

TD-er opened this issue Feb 22, 2020 · 5 comments · Fixed by #7105

Comments

@TD-er
Copy link
Contributor

TD-er commented Feb 22, 2020

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

Problem Description

When calling the WebServer.on(...) function with a flash string, the compiler refuses to build.

Example error:

C:/GitHub/TD-er/ESPEasy/src/WebServer.ino:603:6: error: no matching function for call to 'esp8266webserver::ESP8266WebServerTemplate<WiFiServer>::on(const __FlashStringHelper*, HTTPMethod, WebServerInit()::__lambda4)'

Simple work-around is to replace all calls like this with a String() wrapper around the flash string.

I guess the best fix would be to add a constructor for Uri with const __FlashStringHelper* as parameter.

N.B. some of the derived classes use explicit in the constructor definition, but Uri not. Is this intentional?

@devyte
Copy link
Collaborator

devyte commented Feb 22, 2020

I guess we forgot the forwarder method on(const String & uri,...) that forwards with on(Uri(uri),...).
Broken in #6696.

Edit: the base Uri already has the functionality needed. It's just the forwarder that's missing.

@devyte
Copy link
Collaborator

devyte commented Feb 22, 2020

@Bmooij is there any chance you could help with this? The fix should be easy.

@devyte
Copy link
Collaborator

devyte commented Feb 23, 2020

N.B. some of the derived classes use explicit in the constructor definition, but Uri not. Is this intentional?

Yes. The explicit in the derived classes is meant to force the user to use them and not have an automatic conversion into them, while the lack of it in the base class is meant for exactly that purpose. Which is why the example works.

@devyte
Copy link
Collaborator

devyte commented Feb 23, 2020

@TD-er does #7105 fix your issue?

@TD-er
Copy link
Contributor Author

TD-er commented Feb 23, 2020

@TD-er does #7105 fix your issue?

Yes, it does :)

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

Successfully merging a pull request may close this issue.

2 participants