Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pass String by const reference [3.0]#6583

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
d-a-v merged 2 commits intoesp8266:masterfromdirkmueller:string_cleanups_30
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletionslibraries/ESP8266WebServer/src/detail/RequestHandler.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,10 @@ class RequestHandler {
using WebServerType = ESP8266WebServerTemplate<ServerType>;
public:
virtual ~RequestHandler() { }
virtual bool canHandle(HTTPMethod method, String uri) { (void) method; (void) uri; return false; }
virtual bool canUpload(String uri) { (void) uri; return false; }
virtual bool handle(WebServerType& server, HTTPMethod requestMethod, String requestUri) { (void) server; (void) requestMethod; (void) requestUri; return false; }
virtual void upload(WebServerType& server, String requestUri, HTTPUpload& upload) { (void) server; (void) requestUri; (void) upload; }
virtual bool canHandle(HTTPMethod method,constString& uri) { (void) method; (void) uri; return false; }
virtual bool canUpload(constString& uri) { (void) uri; return false; }
virtual bool handle(WebServerType& server, HTTPMethod requestMethod,constString& requestUri) { (void) server; (void) requestMethod; (void) requestUri; return false; }
virtual void upload(WebServerType& server,constString& requestUri, HTTPUpload& upload) { (void) server; (void) requestUri; (void) upload; }

RequestHandler<ServerType>* next() { return _next; }
void next(RequestHandler<ServerType>* r) { _next = r; }
Expand Down
14 changes: 8 additions & 6 deletionslibraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,21 +25,21 @@ class FunctionRequestHandler : public RequestHandler<ServerType> {
delete _uri;
}

bool canHandle(HTTPMethod requestMethod, String requestUri) override {
bool canHandle(HTTPMethod requestMethod,constString& requestUri) override {
if (_method != HTTP_ANY && _method != requestMethod)
return false;

return _uri->canHandle(requestUri, RequestHandler<ServerType>::pathArgs);
}

bool canUpload(String requestUri) override {
bool canUpload(constString& requestUri) override {
if (!_ufn || !canHandle(HTTP_POST, requestUri))
return false;

return true;
}

bool handle(WebServerType& server, HTTPMethod requestMethod, String requestUri) override {
bool handle(WebServerType& server, HTTPMethod requestMethod,constString& requestUri) override {
(void) server;
if (!canHandle(requestMethod, requestUri))
return false;
Expand All@@ -48,7 +48,7 @@ class FunctionRequestHandler : public RequestHandler<ServerType> {
return true;
}

void upload(WebServerType& server, String requestUri, HTTPUpload& upload) override {
void upload(WebServerType& server,constString& requestUri, HTTPUpload& upload) override {
(void) server;
(void) upload;
if (canUpload(requestUri))
Expand DownExpand Up@@ -85,7 +85,7 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
_baseUriLength = _uri.length();
}

bool canHandle(HTTPMethod requestMethod, String requestUri) override {
bool canHandle(HTTPMethod requestMethod,constString& requestUri) override {
if ((requestMethod != HTTP_GET) && (requestMethod != HTTP_HEAD))
return false;

Expand All@@ -95,7 +95,9 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
return true;
}

bool handle(WebServerType& server, HTTPMethod requestMethod, String requestUri) override {
bool handle(WebServerType& server, HTTPMethod requestMethod, const String& __requestUri) override {
String requestUri(__requestUri);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This String copy can be handled differently in a further fixing commit.

if (!canHandle(requestMethod, requestUri))
return false;

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp