Skip to content

Adding onBefore()#2651

Open
holgerlembke wants to merge 1 commit intoesp8266:masterfrom
holgerlembke:webserver-onbefore
Open

Adding onBefore()#2651
holgerlembke wants to merge 1 commit intoesp8266:masterfrom
holgerlembke:webserver-onbefore

Conversation

@holgerlembke
Copy link
Copy Markdown
Contributor

ith adding a onBefore() it is easy to block/grant access, log requests, verify data etc. for any on()-webrequest.

bool AllowWebServerAccess() {
HTTPMethod m = webserver->method();

if (m == HTTP_POST) {
if (webserver->client().remoteIP().toString().startsWith("192.168.")) {
return true;
} else {
Serial.print("Access blocked to ");
return false;
}
} else {
return true;
}

// paranoid.
return false;
}

ith adding a onBefore() it is easy to block/grant access, log requests, verify data etc. for any on()-webrequest.

bool AllowWebServerAccess() {
 HTTPMethod m = webserver->method();

if (m == HTTP_POST) {
 if (webserver->client().remoteIP().toString().startsWith("192.168.")) {
 return true;
 } else {
 Serial.print("Access blocked to ");
 return false;
 }
 } else {
 return true;
 }

// paranoid.
 return false;
 }
@codecov-io
Copy link
Copy Markdown

Current coverage is 27.80% (diff: 100%)

Merging #2651 into master will not change coverage

@@             master      #2651   diff @@
==========================================
  Files            20         20          
  Lines          3625       3625          
  Methods         335        335          
  Messages          0          0          
  Branches        656        656          
==========================================
  Hits           1008       1008          
  Misses         2441       2441          
  Partials        176        176          

Powered by Codecov. Last update 4897e00...fbb19a4

@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
Copy Markdown
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?

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.

3 participants