From 6e1b667dd67b3a99f2a8a2b27cf3dfe032981cbd Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Thu, 16 Jun 2016 11:44:07 +0600 Subject: CLOUD: Minor Client fix --- backends/networking/sdl_net/client.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backends/networking/sdl_net/client.cpp b/backends/networking/sdl_net/client.cpp index 22bfb60a2f..0e86610e54 100644 --- a/backends/networking/sdl_net/client.cpp +++ b/backends/networking/sdl_net/client.cpp @@ -88,8 +88,11 @@ void Client::checkIfBadRequest() { if (position) { //we have at least one line - and we want the first one //" HTTP/\r\n" Common::String method, path, http, buf; + uint32 length = position - cstr; + if (headersSize > length) headersSize = length; for (uint32 i = 0; i < headersSize; ++i) { - if (_headers[i] == ' ') { + if (_headers[i] != ' ') buf += _headers[i]; + if (_headers[i] == ' ' || i == headersSize-1) { if (method == "") method = buf; else if (path == "") path = buf; else if (http == "") http = buf; @@ -98,7 +101,7 @@ void Client::checkIfBadRequest() { break; } buf = ""; - } else buf += _headers[i]; + } } //check that method is supported -- cgit v1.2.3