Skip to content

Add glob-style pattern matching to webserver uri handling #5467

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

Closed
wants to merge 1 commit into from
Closed

Add glob-style pattern matching to webserver uri handling #5467

wants to merge 1 commit into from

Conversation

devyte
Copy link
Collaborator

@devyte devyte commented Dec 10, 2018

Fixes #2019 .
This is an alternate proposal to #5214 .

This adds glob-style pattern matching to the webserver uri handling. Glob patterns are what is used in command line. Examples:

  • server.on("/devices/*", devicesCB) would match any request that starts with /devices/ and call the devicesCB callback.
  • server.on("/led?", ...) would match a request that starts with /led and is followed by one char, such as /led1 or /ledA.
  • server.on("*yomama*", ...) would match a request that contains yomama anywhere in it.

For more details see man glob or man fnmatch under *nix.

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.

I like the sheer simplicity of this, but I think we need to put in its use in an example somewhere.

The original bug talks about using the last bit as a parameter to something else. Maybe have this set a PWM value on the LED pin in the example, taking a URI of /pwm/* and parsing out the final integer?

@devyte devyte self-assigned this Jul 25, 2019
@earlephilhower earlephilhower added merge-conflict PR has a merge conflict that needs manual correction waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. labels Oct 1, 2019
@earlephilhower
Copy link
Collaborator

Thanks for your PR, but the core and libraries have changed enough that this PR now has a merge conflict.

Could you merge it manually with the latest core, so we can consider it for future releases?

@devyte
Copy link
Collaborator Author

devyte commented Nov 6, 2019

Closing in favor of #6696

@devyte devyte closed this Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict PR has a merge conflict that needs manual correction waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an on() function to ESP8266 Webserver that supports startsWith
2 participants