From 3f35219e1446fd51d2db42719c174a5c89f25c50 Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Fri, 28 Aug 2020 15:58:10 +0200 Subject: [PATCH] fix use without initialization error in session.cpp --- lib/api/session.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/api/session.cpp b/lib/api/session.cpp index 26b6bc1be..0134bfaab 100644 --- a/lib/api/session.cpp +++ b/lib/api/session.cpp @@ -146,6 +146,20 @@ void Session::open(void *in, size_t len) } catch (const std::invalid_argument &) { contentLength = 0; } + + /* This is an OPTIONS request. + * + * We immediatly send headers and close the connection + * without waiting for a POST body */ + if (meth == Request::Method::OPTIONS) + lws_callback_on_writable(wsi); + /* This request has no body. + * We can reply immediatly */ + else if (contentLength == 0) + api->pending.push(this); + else { + /* This request has a HTTP body. We wait for more data to arrive */ + } } catch (const Error &e) { response = new ErrorResponse(this, e); lws_callback_on_writable(wsi); @@ -153,20 +167,6 @@ void Session::open(void *in, size_t len) response = new ErrorResponse(this, e); lws_callback_on_writable(wsi); } - - /* This is an OPTIONS request. - * - * We immediatly send headers and close the connection - * without waiting for a POST body */ - if (meth == Request::Method::OPTIONS) - lws_callback_on_writable(wsi); - /* This request has no body. - * We can reply immediatly */ - else if (contentLength == 0) - api->pending.push(this); - else { - /* This request has a HTTP body. We wait for more data to arrive */ - } } void Session::body(void *in, size_t len)