diff options
Diffstat (limited to 'backends/networking/sdl_net/reader.cpp')
| -rw-r--r-- | backends/networking/sdl_net/reader.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
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]; } } |
