diff options
-rw-r--r-- | backends/networking/sdl_net/handlers/indexpagehandler.cpp | 6 | ||||
-rw-r--r-- | backends/networking/sdl_net/reader.cpp | 36 | ||||
-rw-r--r-- | backends/networking/sdl_net/reader.h | 2 |
3 files changed, 22 insertions, 22 deletions
diff --git a/backends/networking/sdl_net/handlers/indexpagehandler.cpp b/backends/networking/sdl_net/handlers/indexpagehandler.cpp index 04a3f45eff..17e5159768 100644 --- a/backends/networking/sdl_net/handlers/indexpagehandler.cpp +++ b/backends/networking/sdl_net/handlers/indexpagehandler.cpp @@ -37,9 +37,9 @@ IndexPageHandler::~IndexPageHandler() {} Common::String IndexPageHandler::code() const { return _code; } void IndexPageHandler::handle(Client &client) { - Common::String code = client.queryParameter("code"); + Common::String queryCode = client.queryParameter("code"); - if (code == "") { + if (queryCode == "") { // redirect to "/filesAJAX" HandlerUtils::setMessageHandler( client, @@ -53,7 +53,7 @@ void IndexPageHandler::handle(Client &client) { return; } - _code = code; + _code = queryCode; sendCommand(GUI::kStorageCodePassedCmd, 0); HandlerUtils::setMessageHandler(client, _("ScummVM got the code and already connects to your cloud storage!")); } diff --git a/backends/networking/sdl_net/reader.cpp b/backends/networking/sdl_net/reader.cpp index aa9f4746dd..495cf9a90e 100644 --- a/backends/networking/sdl_net/reader.cpp +++ b/backends/networking/sdl_net/reader.cpp @@ -169,25 +169,25 @@ void Reader::handleFirstHeaders(Common::MemoryReadWriteStream *headersStream) { _availableBytes = _contentLength; } -void Reader::parseFirstLine(const Common::String &headers) { - uint32 headersSize = headers.size(); +void Reader::parseFirstLine(const Common::String &headersToParse) { + uint32 headersSize = headersToParse.size(); bool bad = false; if (headersSize > 0) { - const char *cstr = headers.c_str(); + const char *cstr = headersToParse.c_str(); const char *position = strstr(cstr, "\r\n"); if (position) { //we have at least one line - and we want the first one //"<METHOD> <path> HTTP/<VERSION>\r\n" - Common::String method, path, http, buf; + Common::String methodParsed, path, http, buf; uint32 length = position - cstr; if (headersSize > length) headersSize = length; for (uint32 i = 0; i < headersSize; ++i) { - if (headers[i] != ' ') - buf += headers[i]; - if (headers[i] == ' ' || i == headersSize - 1) { - if (method == "") { - method = buf; + if (headersToParse[i] != ' ') + buf += headersToParse[i]; + if (headersToParse[i] == ' ' || i == headersSize - 1) { + if (methodParsed == "") { + methodParsed = buf; } else if (path == "") { path = buf; } else if (http == "") { @@ -201,14 +201,14 @@ void Reader::parseFirstLine(const Common::String &headers) { } //check that method is supported - if (method != "GET" && method != "PUT" && method != "POST") + if (methodParsed != "GET" && methodParsed != "PUT" && methodParsed != "POST") bad = true; //check that HTTP/<VERSION> is OK if (!http.hasPrefix("HTTP/")) bad = true; - _method = method; + _method = methodParsed; parsePathQueryAndAnchor(path); } } @@ -216,29 +216,29 @@ void Reader::parseFirstLine(const Common::String &headers) { if (bad) _isBadRequest = true; } -void Reader::parsePathQueryAndAnchor(Common::String path) { +void Reader::parsePathQueryAndAnchor(Common::String parseToParse) { //<path>[?query][#anchor] bool readingPath = true; bool readingQuery = false; _path = ""; _query = ""; _anchor = ""; - for (uint32 i = 0; i < path.size(); ++i) { + for (uint32 i = 0; i < pathToParse.size(); ++i) { if (readingPath) { - if (path[i] == '?') { + if (pathToParse[i] == '?') { readingPath = false; readingQuery = true; } else { - _path += path[i]; + _path += pathToParse[i]; } } else if (readingQuery) { - if (path[i] == '#') { + if (pathToParse[i] == '#') { readingQuery = false; } else { - _query += path[i]; + _query += pathToParse[i]; } } else { - _anchor += path[i]; + _anchor += pathToParse[i]; } } diff --git a/backends/networking/sdl_net/reader.h b/backends/networking/sdl_net/reader.h index 1a60e7a58d..4955edfc39 100644 --- a/backends/networking/sdl_net/reader.h +++ b/backends/networking/sdl_net/reader.h @@ -100,7 +100,7 @@ class Reader { void handleFirstHeaders(Common::MemoryReadWriteStream *headers); void parseFirstLine(const Common::String &headers); - void parsePathQueryAndAnchor(Common::String path); + void parsePathQueryAndAnchor(Common::String pathToParse); void parseQueryParameters(); void makeWindow(uint32 size); |