Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
08ef6253
Unverified
Commit
08ef6253
authored
Jun 14, 2024
by
Ayush Sharma
Committed by
GitHub
Jun 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: removeRoute should remove all matching routes (#9851)
parent
3428eb6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
libraries/WebServer/src/WebServer.cpp
libraries/WebServer/src/WebServer.cpp
+16
-3
No files found.
libraries/WebServer/src/WebServer.cpp
View file @
08ef6253
...
@@ -333,15 +333,28 @@ bool WebServer::removeRoute(const String &uri) {
...
@@ -333,15 +333,28 @@ bool WebServer::removeRoute(const String &uri) {
}
}
bool
WebServer
::
removeRoute
(
const
String
&
uri
,
HTTPMethod
method
)
{
bool
WebServer
::
removeRoute
(
const
String
&
uri
,
HTTPMethod
method
)
{
// Loop through all request handlers and see if there is a match
bool
anyHandlerRemoved
=
false
;
RequestHandler
*
handler
=
_firstHandler
;
RequestHandler
*
handler
=
_firstHandler
;
RequestHandler
*
previousHandler
=
nullptr
;
while
(
handler
)
{
while
(
handler
)
{
if
(
handler
->
canHandle
(
method
,
uri
))
{
if
(
handler
->
canHandle
(
method
,
uri
))
{
return
_removeRequestHandler
(
handler
);
if
(
_removeRequestHandler
(
handler
))
{
anyHandlerRemoved
=
true
;
// Move to the next handler
if
(
previousHandler
)
{
handler
=
previousHandler
->
next
();
}
else
{
handler
=
_firstHandler
;
}
continue
;
}
}
}
previousHandler
=
handler
;
handler
=
handler
->
next
();
handler
=
handler
->
next
();
}
}
return
false
;
return
anyHandlerRemoved
;
}
}
void
WebServer
::
addHandler
(
RequestHandler
*
handler
)
{
void
WebServer
::
addHandler
(
RequestHandler
*
handler
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment