Skip to content

Commit

Permalink
Reduce logging
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed May 15, 2022
1 parent 9692865 commit 823695e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions libraries/WebServer/src/Parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ bool WebServer::_parseRequest(WiFiClient& client) {
}
_currentMethod = method;

Log.verbose("method: %s url: %s search: %s", methodStr.c_str(), url.c_str(), searchStr.c_str());
Log.verbose("method: %s url: %s args: %s", methodStr.c_str(), url.c_str(), searchStr.c_str());

//attach handler
RequestHandler* handler;
Expand Down Expand Up @@ -149,8 +149,8 @@ bool WebServer::_parseRequest(WiFiClient& client) {
headerValue.trim();
_collectHeader(headerName.c_str(),headerValue.c_str());

Log.verbose("headerName: %s", headerName.c_str());
Log.verbose("headerValue: %s", headerValue.c_str());
//Log.verbose("headerName: %s", headerName.c_str());
//Log.verbose("headerValue: %s", headerValue.c_str());

if (headerName.equalsIgnoreCase(FPSTR(Content_Type))){
using namespace mime;
Expand Down Expand Up @@ -222,8 +222,8 @@ bool WebServer::_parseRequest(WiFiClient& client) {
headerValue = req.substring(headerDiv + 2);
_collectHeader(headerName.c_str(),headerValue.c_str());

Log.verbose("headerName: %s", headerName.c_str());
Log.verbose("headerValue: %s", headerValue.c_str());
//Log.verbose("headerName: %s", headerName.c_str());
//Log.verbose("headerValue: %s", headerValue.c_str());

if (headerName.equalsIgnoreCase("Host")){
_hostHeader = headerValue;
Expand All @@ -233,8 +233,8 @@ bool WebServer::_parseRequest(WiFiClient& client) {
}
client.flush();

Log.verbose("Request: %s", url.c_str());
Log.verbose(" Arguments: %s", searchStr.c_str());
//Log.verbose("Request: %s", url.c_str());
//Log.verbose(" Arguments: %s", searchStr.c_str());

return true;
}
Expand All @@ -250,7 +250,7 @@ bool WebServer::_collectHeader(const char* headerName, const char* headerValue)
}

void WebServer::_parseArguments(String data) {
Log.verbose("args: %s", data.c_str());
//Log.verbose("args: %s", data.c_str());
if (_currentArgs)
delete[] _currentArgs;
_currentArgs = 0;
Expand All @@ -268,15 +268,15 @@ void WebServer::_parseArguments(String data) {
++i;
++_currentArgCount;
}
Log.verbose("args count: %d", _currentArgCount);
//Log.verbose("args count: %d", _currentArgCount);

_currentArgs = new RequestArgument[_currentArgCount+1];
int pos = 0;
int iarg;
for (iarg = 0; iarg < _currentArgCount;) {
int equal_sign_index = data.indexOf('=', pos);
int next_arg_index = data.indexOf('&', pos);
Log.verbose("pos %d =@%d &@%d", pos, equal_sign_index, next_arg_index);
//Log.verbose("pos %d =@%d &@%d", pos, equal_sign_index, next_arg_index);
if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) {
Log.error("arg missing value: %d", iarg);
if (next_arg_index == -1)
Expand All @@ -287,15 +287,14 @@ void WebServer::_parseArguments(String data) {
RequestArgument& arg = _currentArgs[iarg];
arg.key = urlDecode(data.substring(pos, equal_sign_index));
arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index));
Log.verbose("arg %d key: %s value: %s", iarg, arg.key.c_str(), arg.value.c_str());
//Log.verbose("arg %d key: %s value: %s", iarg, arg.key.c_str(), arg.value.c_str());
++iarg;
if (next_arg_index == -1)
break;
pos = next_arg_index + 1;
}
_currentArgCount = iarg;
Log.verbose("args count: %d", _currentArgCount);

//Log.verbose("args count: %d", _currentArgCount);
}

void WebServer::_uploadWriteByte(uint8_t b){
Expand Down

0 comments on commit 823695e

Please sign in to comment.